-
-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
215 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
//* This file is explicitly licensed under the MIT license. *// | ||
//* Copyright (c) 2025 Citadel Station Developers *// | ||
|
||
// todo: datumize impairments; the way this works right now is pretty stupid | ||
// it's because we're using different components since i was too | ||
// lazy to do a single tracking component | ||
|
||
/** | ||
* Component added to a mob by the mob themselves to feign an impairment | ||
*/ | ||
/datum/component/mob_feign_impairment | ||
var/power | ||
var/feign_impairment_type | ||
|
||
/datum/component/mob_feign_impairment/Initialize(power) | ||
if(!ismob(parent)) | ||
return COMPONENT_INCOMPATIBLE | ||
. = ..() | ||
if(. == COMPONENT_INCOMPATIBLE) | ||
return | ||
src.power = power | ||
|
||
/datum/component/mob_feign_impairment/RegisterWithParent() | ||
. = ..() | ||
// todo: on update stat | ||
RegisterSignal(parent, COMSIG_MOB_ON_UPDATE_MOBILITY, PROC_REF(recheck_stat)) | ||
|
||
/datum/component/mob_feign_impairment/UnregisterFromParent() | ||
. = ..() | ||
// todo: on update stat | ||
UnregisterSignal(parent, COMSIG_MOB_ON_UPDATE_MOBILITY) | ||
var/mob/mob_parent = parent | ||
LAZYREMOVE(mob_parent.impairments_feigned, feign_impairment_type) | ||
|
||
/datum/component/mob_feign_impairment/proc/recheck_stat(mob/source) | ||
SIGNAL_HANDLER | ||
if(IS_CONSCIOUS(source)) | ||
return | ||
qdel(src) | ||
|
||
/datum/component/mob_feign_impairment/slurring | ||
// this must be set | ||
registered_type = /datum/component/mob_feign_impairment/slurring | ||
feign_impairment_type = /datum/feign_impairment/slurring | ||
|
||
/datum/component/mob_feign_impairment/stutter | ||
// this must be set | ||
registered_type = /datum/component/mob_feign_impairment/stutter | ||
feign_impairment_type = /datum/feign_impairment/stutter | ||
|
||
/datum/component/mob_feign_impairment/jitter | ||
// this must be set | ||
registered_type = /datum/component/mob_feign_impairment/jitter | ||
feign_impairment_type = /datum/feign_impairment/jitter | ||
|
||
/datum/component/mob_feign_impairment/jitter/RegisterWithParent() | ||
. = ..() | ||
// shitcode but whatever | ||
var/mob/mob_parent = parent | ||
mob_parent.make_jittery(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//* This file is explicitly licensed under the MIT license. *// | ||
//* Copyright (c) 2025 Citadel Station Developers *// | ||
|
||
//* Impairments *// | ||
|
||
// hey! listen | ||
// if you're thinking about find-replacing checks for the var with this | ||
// well fucking don't | ||
// | ||
// the reason this is separate from main vars for these things | ||
// is because people keep abusing vars to implement features that have a | ||
// ton of unintended side effects | ||
// | ||
// these should only be used for the actual effects; it is **not** | ||
// allowed to use for any other effects like xenochimera feral, | ||
// traumatic shock, etc | ||
|
||
// todo: /datum/mob_impairment ? | ||
|
||
/mob/proc/get_effective_impairment_power_slurring() | ||
. = slurring | ||
var/datum/component/mob_feign_impairment/slurring/feigned = GetComponent(/datum/component/mob_feign_impairment/slurring) | ||
if(feigned) | ||
. = max(., feigned.power) | ||
|
||
/mob/proc/get_effective_impairment_power_jitter() | ||
. = jitteriness | ||
var/datum/component/mob_feign_impairment/jitter/feigned = GetComponent(/datum/component/mob_feign_impairment/jitter) | ||
if(feigned) | ||
. = max(., feigned.power) | ||
|
||
/mob/proc/get_effective_impairment_power_stutter() | ||
. = stuttering | ||
var/datum/component/mob_feign_impairment/stutter/feigned = GetComponent(/datum/component/mob_feign_impairment/stutter) | ||
if(feigned) | ||
. = max(., feigned.power) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
//* This file is explicitly licensed under the MIT license. *// | ||
//* Copyright (c) 2025 Citadel Station Developers *// | ||
|
||
GLOBAL_LIST_INIT(feign_impairment_types, init_feign_impairment_types()) | ||
|
||
/proc/init_feign_impairment_types() | ||
. = list() | ||
var/list/component_collision_check = list() | ||
for(var/datum/feign_impairment/path as anything in subtypesof(/datum/feign_impairment)) | ||
if(initial(path.abstract_type) == path) | ||
continue | ||
var/datum/feign_impairment/instance = new path | ||
if(component_collision_check[instance.component_type]) | ||
stack_trace("collision between [component_collision_check[instance.component_type]:type] and [instance.type] on component type [instance.component_type]") | ||
continue | ||
component_collision_check[instance.component_type] = instance | ||
.[path] = instance | ||
|
||
/datum/feign_impairment | ||
abstract_type = /datum/feign_impairment | ||
var/name | ||
var/adjective | ||
var/component_type | ||
var/power_min = 0 | ||
var/power_max = 0 | ||
|
||
/datum/feign_impairment/slurring | ||
name = "Slurring" | ||
adjective = "slurring" | ||
component_type = /datum/component/mob_feign_impairment/slurring | ||
power_min = 10 | ||
power_max = 500 | ||
|
||
/datum/feign_impairment/stutter | ||
name = "Stuttering" | ||
adjective = "stuttering" | ||
component_type = /datum/component/mob_feign_impairment/stutter | ||
power_min = 10 | ||
power_max = 500 | ||
|
||
/datum/feign_impairment/jitter | ||
name = "Jittering" | ||
adjective = "jittering" | ||
component_type = /datum/component/mob_feign_impairment/jitter | ||
power_min = 10 | ||
power_max = 2000 | ||
|
||
// todo: DECLARE_MOB_VERB | ||
/mob/verb/feign_impairment() | ||
set name = "Feign Impairment" | ||
set category = VERB_CATEGORY_IC | ||
set desc = "Pretend like you're slurring, stuttering, jittering, and more." | ||
|
||
var/list/name_to_type = list() | ||
for(var/datum/feign_impairment/path as anything in subtypesof(/datum/feign_impairment)) | ||
if(initial(path.abstract_type) == path) | ||
continue | ||
var/is_active = impairments_feigned?[path] | ||
name_to_type["[initial(path.name)] (Currently: [is_active ? "Active" : "Inactive"])"] = path | ||
|
||
var/choice = tgui_input_list(src, "Choose an impairment to toggle.", "Feign Impairment", name_to_type) | ||
if(!choice) | ||
return | ||
|
||
var/path = name_to_type[choice] | ||
var/new_active = !impairments_feigned?[path] | ||
var/datum/feign_impairment/impairment = GLOB.feign_impairment_types[path] | ||
|
||
var/power | ||
|
||
if(new_active) | ||
power = tgui_input_number( | ||
src, | ||
"What power? ([impairment.power_min] - [impairment.power_max])", | ||
"Feign Impairment", | ||
impairment.power_min, | ||
impairment.power_max, | ||
impairment.power_min, | ||
round_value = TRUE, | ||
) | ||
|
||
// todo: better logging | ||
log_game("[key_name(src)] toggled [impairment] to [new_active ?"on, with power [power]" : "off"]") | ||
|
||
if(new_active) | ||
AddComponent(impairment.component_type, power) | ||
else | ||
qdel(GetComponent(impairment.component_type)) | ||
|
||
to_chat(src, SPAN_NOTICE("You are now <b>[new_active ? "pretending" : "no longer pretending"]</b> to be [impairment.adjective]. This will be automatically reset should you lose consciousness.")) | ||
|
||
/mob/proc/clear_feign_impairment() | ||
QDEL_LIST_ASSOC_VAL(impairments_feigned) | ||
impairments_feigned = null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters