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:
tralezab
2023-02-20 20:30:51 +01:00
committed by GitHub
co-authored by MrMelbert
parent 994c41c365
commit 47206594b9
9 changed files with 23 additions and 14 deletions
+6 -8
View File
@@ -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())
+1 -1
View File
@@ -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?
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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()
+1 -1
View File
@@ -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