mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 22:19:30 +01:00
Fixes Ninjas not being able to use adrenaline while unconscious + code improvement (#73538)
## About The Pull Request ### Bugfix Fixes #73521 Ninja's adrenaline is supposed to cure unconscious, but you can't activate it while unconscious. This pr fixes that ### Code improvement Combined all the allow variables into a bitflag ## Why It's Good For The Game bugfix ## Changelog 🆑 fix: You can use ninja adrenaline to cure unconsciousness as intended code: Cleaned up some modsuit code /🆑 --------- Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
This commit is contained in:
@@ -133,6 +133,9 @@
|
||||
button_icon_state = linked_module.icon_state
|
||||
..()
|
||||
module = linked_module
|
||||
if(linked_module.allow_flags & MODULE_ALLOW_INCAPACITATED)
|
||||
// clears check hands and check conscious
|
||||
check_flags = NONE
|
||||
name = "Activate [capitalize(linked_module.name)]"
|
||||
desc = "Quickly activate [linked_module]."
|
||||
RegisterSignals(linked_module, list(COMSIG_MODULE_ACTIVATED, COMSIG_MODULE_DEACTIVATED, COMSIG_MODULE_USED), PROC_REF(module_interacted_with))
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
playsound(src, 'sound/machines/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
|
||||
return FALSE
|
||||
for(var/obj/item/mod/module/module as anything in modules)
|
||||
if(!module.active || module.allowed_inactive)
|
||||
if(!module.active || (module.allow_flags & MODULE_ALLOW_INACTIVE))
|
||||
continue
|
||||
module.on_deactivation(display_message = FALSE)
|
||||
activating = TRUE
|
||||
|
||||
@@ -41,10 +41,8 @@
|
||||
var/used_signal
|
||||
/// List of REF()s mobs we are pinned to, linked with their action buttons
|
||||
var/list/pinned_to = list()
|
||||
/// If we're allowed to use this module while phased out.
|
||||
var/allowed_in_phaseout = FALSE
|
||||
/// If we're allowed to use this module while the suit is disabled.
|
||||
var/allowed_inactive = FALSE
|
||||
/// flags that let the module ability be used in odd circumstances
|
||||
var/allow_flags = NONE
|
||||
/// Timer for the cooldown
|
||||
COOLDOWN_DECLARE(cooldown_timer)
|
||||
|
||||
@@ -73,7 +71,7 @@
|
||||
|
||||
/// Called when the module is selected from the TGUI, radial or the action button
|
||||
/obj/item/mod/module/proc/on_select()
|
||||
if(((!mod.active || mod.activating) && !allowed_inactive) || module_type == MODULE_PASSIVE)
|
||||
if(((!mod.active || mod.activating) && !(allow_flags & MODULE_ALLOW_INACTIVE)) || module_type == MODULE_PASSIVE)
|
||||
if(mod.wearer)
|
||||
balloon_alert(mod.wearer, "not active!")
|
||||
return
|
||||
@@ -94,7 +92,7 @@
|
||||
if(!mod.active || mod.activating || !mod.get_charge())
|
||||
balloon_alert(mod.wearer, "unpowered!")
|
||||
return FALSE
|
||||
if(!allowed_in_phaseout && istype(mod.wearer.loc, /obj/effect/dummy/phased_mob))
|
||||
if(!(allow_flags & MODULE_ALLOW_PHASEOUT) && istype(mod.wearer.loc, /obj/effect/dummy/phased_mob))
|
||||
//specifically a to_chat because the user is phased out.
|
||||
to_chat(mod.wearer, span_warning("You cannot activate this right now."))
|
||||
return FALSE
|
||||
@@ -149,7 +147,7 @@
|
||||
if(!check_power(use_power_cost))
|
||||
balloon_alert(mod.wearer, "not enough charge!")
|
||||
return FALSE
|
||||
if(!allowed_in_phaseout && istype(mod.wearer.loc, /obj/effect/dummy/phased_mob))
|
||||
if(!(allow_flags & MODULE_ALLOW_PHASEOUT) && istype(mod.wearer.loc, /obj/effect/dummy/phased_mob))
|
||||
//specifically a to_chat because the user is phased out.
|
||||
to_chat(mod.wearer, span_warning("You cannot activate this right now."))
|
||||
return FALSE
|
||||
@@ -163,7 +161,7 @@
|
||||
|
||||
/// Called when an activated module without a device is used
|
||||
/obj/item/mod/module/proc/on_select_use(atom/target)
|
||||
if(mod.wearer.incapacitated(IGNORE_GRAB))
|
||||
if(!(allow_flags & MODULE_ALLOW_INCAPACITATED) && mod.wearer.incapacitated(IGNORE_GRAB))
|
||||
return FALSE
|
||||
mod.wearer.face_atom(target)
|
||||
if(!on_use())
|
||||
|
||||
@@ -362,7 +362,7 @@
|
||||
complexity = 2
|
||||
incompatible_modules = list(/obj/item/mod/module/chameleon)
|
||||
cooldown_time = 0.5 SECONDS
|
||||
allowed_inactive = TRUE
|
||||
allow_flags = MODULE_ALLOW_INACTIVE
|
||||
/// A list of all the items the suit can disguise as.
|
||||
var/list/possible_disguises = list()
|
||||
/// The path of the item we're disguised as.
|
||||
|
||||
@@ -379,6 +379,7 @@
|
||||
icon_state = "adrenaline_boost"
|
||||
removable = FALSE
|
||||
module_type = MODULE_USABLE
|
||||
allow_flags = MODULE_ALLOW_INCAPACITATED
|
||||
incompatible_modules = list(/obj/item/mod/module/adrenaline_boost)
|
||||
cooldown_time = 12 SECONDS
|
||||
/// What reagent we need to refill?
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
complexity = 2
|
||||
incompatible_modules = list(/obj/item/mod/module/holster)
|
||||
cooldown_time = 0.5 SECONDS
|
||||
allowed_inactive = TRUE
|
||||
allow_flags = MODULE_ALLOW_INACTIVE
|
||||
/// Gun we have holstered.
|
||||
var/obj/item/gun/holstered
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
use_power_cost = DEFAULT_CHARGE_DRAIN * 0.2
|
||||
incompatible_modules = list(/obj/item/mod/module/gps)
|
||||
cooldown_time = 0.5 SECONDS
|
||||
allowed_inactive = TRUE
|
||||
allow_flags = MODULE_ALLOW_INACTIVE
|
||||
|
||||
/obj/item/mod/module/gps/Initialize(mapload)
|
||||
. = ..()
|
||||
@@ -173,7 +173,7 @@
|
||||
use_power_cost = DEFAULT_CHARGE_DRAIN * 0.2
|
||||
incompatible_modules = list(/obj/item/mod/module/orebag)
|
||||
cooldown_time = 0.5 SECONDS
|
||||
allowed_inactive = TRUE
|
||||
allow_flags = MODULE_ALLOW_INACTIVE
|
||||
/// The ores stored in the bag.
|
||||
var/list/ores = list()
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
use_power_cost = DEFAULT_CHARGE_DRAIN * 5
|
||||
incompatible_modules = list(/obj/item/mod/module/timeline_jumper)
|
||||
cooldown_time = 5 SECONDS
|
||||
allowed_in_phaseout = TRUE
|
||||
allow_flags = MODULE_ALLOW_PHASEOUT
|
||||
///The dummy for phasing from this module, the wearer is phased out while this exists.
|
||||
var/obj/effect/dummy/phased_mob/chrono/phased_mob
|
||||
|
||||
|
||||
Reference in New Issue
Block a user