mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 16:18:01 +01:00
MODsuit now uses spacesuit cell hud element (#81985)
## About The Pull Request Rather than using screen alerts, MODsuits will now use the spacesuit cell hud element, which normal space suits use to show how much cell is left. Also adds some new states to the cell hud icon to accommodate. ## Why It's Good For The Game 1. Less clutter in the alerts tab. Allows for higher priority screen alerts to be displayed, such as being on fire. 2. Less confusing for Ethereals using MODsuits. 3. Consistency with normal space suits. ## Changelog 🆑 Melbert add: MODsuits now use the "suit charge" HUD element to show how much charge they have left, rather than a screen alert /🆑
This commit is contained in:
@@ -47,7 +47,6 @@
|
||||
#define ALERT_HACKING_APC "hackingapc"
|
||||
|
||||
/** MODsuit/Mech related */
|
||||
#define ALERT_MODSUIT_CHARGE "mod_charge"
|
||||
#define ALERT_MECH_DAMAGE "mech_damage"
|
||||
|
||||
/** Food related */
|
||||
|
||||
@@ -808,8 +808,7 @@
|
||||
hud_used.stamina.icon_state = "stamina_full"
|
||||
|
||||
/mob/living/carbon/proc/update_spacesuit_hud_icon(cell_state = "empty")
|
||||
if(hud_used?.spacesuit)
|
||||
hud_used.spacesuit.icon_state = "spacesuit_[cell_state]"
|
||||
hud_used?.spacesuit?.icon_state = "spacesuit_[cell_state]"
|
||||
|
||||
/mob/living/carbon/set_health(new_value)
|
||||
. = ..()
|
||||
|
||||
@@ -238,7 +238,8 @@
|
||||
for(var/obj/item/mod/module/module as anything in modules)
|
||||
module.on_suit_deactivation()
|
||||
update_speed()
|
||||
update_icon_state()
|
||||
update_appearance(UPDATE_ICON_STATE)
|
||||
update_charge_alert()
|
||||
wearer.update_clothing(slot_flags)
|
||||
|
||||
/// Quickly deploys all the suit parts and if successful, seals them and turns on the suit. Intended mostly for outfits.
|
||||
|
||||
@@ -243,7 +243,6 @@
|
||||
if(malfunctioning)
|
||||
malfunctioning_charge_drain = rand(1,20)
|
||||
subtract_charge((charge_drain + malfunctioning_charge_drain) * seconds_per_tick)
|
||||
update_charge_alert()
|
||||
for(var/obj/item/mod/module/module as anything in modules)
|
||||
if(malfunctioning && module.active && SPT_PROB(5, seconds_per_tick))
|
||||
module.on_deactivation(display_message = TRUE)
|
||||
@@ -319,7 +318,6 @@
|
||||
wrench.play_tool_sound(src, 100)
|
||||
balloon_alert(user, "core removed")
|
||||
core.forceMove(drop_location())
|
||||
update_charge_alert()
|
||||
return TRUE
|
||||
return ..()
|
||||
|
||||
@@ -402,7 +400,6 @@
|
||||
attacking_core.install(src)
|
||||
balloon_alert(user, "core installed")
|
||||
playsound(src, 'sound/machines/click.ogg', 50, TRUE, SILENCED_SOUND_EXTRARANGE)
|
||||
update_charge_alert()
|
||||
return TRUE
|
||||
else if(is_wire_tool(attacking_item) && open)
|
||||
wires.interact(user)
|
||||
@@ -487,8 +484,8 @@
|
||||
for(var/obj/item/mod/module/module as anything in modules)
|
||||
module.on_unequip()
|
||||
UnregisterSignal(wearer, list(COMSIG_ATOM_EXITED, COMSIG_SPECIES_GAIN))
|
||||
wearer.clear_alert(ALERT_MODSUIT_CHARGE)
|
||||
SEND_SIGNAL(src, COMSIG_MOD_WEARER_UNSET, wearer)
|
||||
wearer.update_spacesuit_hud_icon("0")
|
||||
wearer = null
|
||||
|
||||
/obj/item/mod/control/proc/clean_up()
|
||||
@@ -631,13 +628,21 @@
|
||||
/obj/item/mod/control/proc/check_charge(amount)
|
||||
return core?.check_charge(amount) || FALSE
|
||||
|
||||
/**
|
||||
* Updates the wearer's hud according to the current state of the MODsuit
|
||||
*/
|
||||
/obj/item/mod/control/proc/update_charge_alert()
|
||||
if(!wearer)
|
||||
if(isnull(wearer))
|
||||
return
|
||||
if(!core)
|
||||
wearer.throw_alert(ALERT_MODSUIT_CHARGE, /atom/movable/screen/alert/nocore)
|
||||
return
|
||||
core.update_charge_alert()
|
||||
var/state_to_use
|
||||
if(!active)
|
||||
state_to_use = "0"
|
||||
else if(isnull(core))
|
||||
state_to_use = "coreless"
|
||||
else
|
||||
state_to_use = core.get_charge_icon_state()
|
||||
|
||||
wearer.update_spacesuit_hud_icon(state_to_use || "0")
|
||||
|
||||
/obj/item/mod/control/proc/update_speed()
|
||||
var/list/all_parts = mod_parts + src
|
||||
@@ -703,7 +708,6 @@
|
||||
return
|
||||
if(part == core)
|
||||
core.uninstall()
|
||||
update_charge_alert()
|
||||
return
|
||||
if(part.loc == wearer)
|
||||
return
|
||||
|
||||
@@ -18,9 +18,11 @@
|
||||
mod = mod_unit
|
||||
mod.core = src
|
||||
forceMove(mod)
|
||||
mod.update_charge_alert()
|
||||
|
||||
/obj/item/mod/core/proc/uninstall()
|
||||
mod.core = null
|
||||
mod.update_charge_alert()
|
||||
mod = null
|
||||
|
||||
/obj/item/mod/core/proc/charge_source()
|
||||
@@ -41,8 +43,11 @@
|
||||
/obj/item/mod/core/proc/check_charge(amount)
|
||||
return FALSE
|
||||
|
||||
/obj/item/mod/core/proc/update_charge_alert()
|
||||
mod.wearer.clear_alert(ALERT_MODSUIT_CHARGE)
|
||||
/**
|
||||
* Gets what icon state to display on the HUD for the charge level of this core
|
||||
*/
|
||||
/obj/item/mod/core/proc/get_charge_icon_state()
|
||||
return "0"
|
||||
|
||||
/obj/item/mod/core/infinite
|
||||
name = "MOD infinite core"
|
||||
@@ -68,6 +73,9 @@
|
||||
/obj/item/mod/core/infinite/check_charge(amount)
|
||||
return TRUE
|
||||
|
||||
/obj/item/mod/core/infinite/get_charge_icon_state()
|
||||
return "high"
|
||||
|
||||
/obj/item/mod/core/standard
|
||||
name = "MOD standard core"
|
||||
icon_state = "mod-core-standard"
|
||||
@@ -80,8 +88,7 @@
|
||||
var/obj/item/stock_parts/cell/cell
|
||||
|
||||
/obj/item/mod/core/standard/Destroy()
|
||||
if(cell)
|
||||
QDEL_NULL(cell)
|
||||
QDEL_NULL(cell)
|
||||
return ..()
|
||||
|
||||
/obj/item/mod/core/standard/install(obj/item/mod/control/mod_unit)
|
||||
@@ -116,54 +123,57 @@
|
||||
|
||||
/obj/item/mod/core/standard/add_charge(amount)
|
||||
var/obj/item/stock_parts/cell/charge_source = charge_source()
|
||||
if(!charge_source)
|
||||
if(isnull(charge_source))
|
||||
return FALSE
|
||||
return charge_source.give(amount)
|
||||
. = charge_source.give(amount)
|
||||
if(.)
|
||||
mod.update_charge_alert()
|
||||
return .
|
||||
|
||||
/obj/item/mod/core/standard/subtract_charge(amount)
|
||||
var/obj/item/stock_parts/cell/charge_source = charge_source()
|
||||
if(!charge_source)
|
||||
if(isnull(charge_source))
|
||||
return FALSE
|
||||
return charge_source.use(amount, TRUE)
|
||||
. = charge_source.use(amount, TRUE)
|
||||
if(.)
|
||||
mod.update_charge_alert()
|
||||
return .
|
||||
|
||||
/obj/item/mod/core/standard/check_charge(amount)
|
||||
return charge_amount() >= amount
|
||||
|
||||
/obj/item/mod/core/standard/update_charge_alert()
|
||||
var/obj/item/stock_parts/cell/charge_source = charge_source()
|
||||
if(!charge_source)
|
||||
mod.wearer.throw_alert(ALERT_MODSUIT_CHARGE, /atom/movable/screen/alert/nocell)
|
||||
return
|
||||
var/remaining_cell = charge_amount() / max_charge_amount()
|
||||
switch(remaining_cell)
|
||||
/obj/item/mod/core/standard/get_charge_icon_state()
|
||||
if(isnull(charge_source()))
|
||||
return "missing"
|
||||
|
||||
switch(round(charge_amount() / max_charge_amount(), 0.01))
|
||||
if(0.75 to INFINITY)
|
||||
mod.wearer.clear_alert(ALERT_MODSUIT_CHARGE)
|
||||
return "high"
|
||||
if(0.5 to 0.75)
|
||||
mod.wearer.throw_alert(ALERT_MODSUIT_CHARGE, /atom/movable/screen/alert/lowcell, 1)
|
||||
return "mid"
|
||||
if(0.25 to 0.5)
|
||||
mod.wearer.throw_alert(ALERT_MODSUIT_CHARGE, /atom/movable/screen/alert/lowcell, 2)
|
||||
if(0.01 to 0.25)
|
||||
mod.wearer.throw_alert(ALERT_MODSUIT_CHARGE, /atom/movable/screen/alert/lowcell, 3)
|
||||
else
|
||||
mod.wearer.throw_alert(ALERT_MODSUIT_CHARGE, /atom/movable/screen/alert/emptycell)
|
||||
return "low"
|
||||
if(0.02 to 0.25)
|
||||
return "very_low"
|
||||
|
||||
return "empty"
|
||||
|
||||
/obj/item/mod/core/standard/proc/install_cell(new_cell)
|
||||
cell = new_cell
|
||||
cell.forceMove(src)
|
||||
RegisterSignal(src, COMSIG_ATOM_EXITED, PROC_REF(on_exit))
|
||||
mod.update_charge_alert()
|
||||
|
||||
/obj/item/mod/core/standard/proc/uninstall_cell()
|
||||
if(!cell)
|
||||
return
|
||||
cell.update_appearance()
|
||||
cell = null
|
||||
UnregisterSignal(src, COMSIG_ATOM_EXITED)
|
||||
mod.update_charge_alert()
|
||||
|
||||
/obj/item/mod/core/standard/proc/on_exit(datum/source, obj/item/stock_parts/cell, direction)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(!istype(cell) || cell.loc == src)
|
||||
return
|
||||
uninstall_cell()
|
||||
/obj/item/mod/core/standard/Exited(atom/movable/gone, direction)
|
||||
. = ..()
|
||||
if(gone == cell)
|
||||
uninstall_cell()
|
||||
|
||||
/obj/item/mod/core/standard/proc/on_examine(datum/source, mob/examiner, list/examine_text)
|
||||
SIGNAL_HANDLER
|
||||
@@ -195,7 +205,6 @@
|
||||
var/obj/item/cell_to_move = cell
|
||||
cell_to_move.forceMove(drop_location())
|
||||
user.put_in_hands(cell_to_move)
|
||||
mod.update_charge_alert()
|
||||
|
||||
/obj/item/mod/core/standard/proc/on_attackby(datum/source, obj/item/attacking_item, mob/user)
|
||||
SIGNAL_HANDLER
|
||||
@@ -212,7 +221,6 @@
|
||||
install_cell(attacking_item)
|
||||
mod.balloon_alert(user, "cell installed")
|
||||
playsound(mod, 'sound/machines/click.ogg', 50, TRUE, SILENCED_SOUND_EXTRARANGE)
|
||||
mod.update_charge_alert()
|
||||
return COMPONENT_NO_AFTERATTACK
|
||||
return NONE
|
||||
|
||||
@@ -232,7 +240,6 @@
|
||||
SIGNAL_HANDLER
|
||||
|
||||
add_charge(amount)
|
||||
mod.update_charge_alert()
|
||||
|
||||
/obj/item/mod/core/ethereal
|
||||
name = "MOD ethereal core"
|
||||
@@ -272,12 +279,8 @@
|
||||
/obj/item/mod/core/ethereal/check_charge(amount)
|
||||
return charge_amount() >= amount*charge_modifier
|
||||
|
||||
/obj/item/mod/core/ethereal/update_charge_alert()
|
||||
var/obj/item/organ/internal/stomach/ethereal/charge_source = charge_source()
|
||||
if(charge_source)
|
||||
mod.wearer.clear_alert(ALERT_MODSUIT_CHARGE)
|
||||
return
|
||||
mod.wearer.throw_alert(ALERT_MODSUIT_CHARGE, /atom/movable/screen/alert/nocell)
|
||||
/obj/item/mod/core/ethereal/get_charge_icon_state()
|
||||
return charge_source() ? "0" : "missing"
|
||||
|
||||
#define PLASMA_CORE_ORE_CHARGE 1500
|
||||
#define PLASMA_CORE_SHEET_CHARGE 2000
|
||||
@@ -318,28 +321,29 @@
|
||||
|
||||
/obj/item/mod/core/plasma/add_charge(amount)
|
||||
charge = min(maxcharge, charge + amount)
|
||||
mod.update_charge_alert()
|
||||
return TRUE
|
||||
|
||||
/obj/item/mod/core/plasma/subtract_charge(amount)
|
||||
charge = max(0, charge - amount)
|
||||
mod.update_charge_alert()
|
||||
return TRUE
|
||||
|
||||
/obj/item/mod/core/plasma/check_charge(amount)
|
||||
return charge_amount() >= amount
|
||||
|
||||
/obj/item/mod/core/plasma/update_charge_alert()
|
||||
var/remaining_plasma = charge_amount() / max_charge_amount()
|
||||
switch(remaining_plasma)
|
||||
/obj/item/mod/core/plasma/get_charge_icon_state()
|
||||
switch(round(charge_amount() / max_charge_amount(), 0.01))
|
||||
if(0.75 to INFINITY)
|
||||
mod.wearer.clear_alert(ALERT_MODSUIT_CHARGE)
|
||||
return "high"
|
||||
if(0.5 to 0.75)
|
||||
mod.wearer.throw_alert(ALERT_MODSUIT_CHARGE, /atom/movable/screen/alert/lowcell/plasma, 1)
|
||||
return "mid"
|
||||
if(0.25 to 0.5)
|
||||
mod.wearer.throw_alert(ALERT_MODSUIT_CHARGE, /atom/movable/screen/alert/lowcell/plasma, 2)
|
||||
if(0.01 to 0.25)
|
||||
mod.wearer.throw_alert(ALERT_MODSUIT_CHARGE, /atom/movable/screen/alert/lowcell/plasma, 3)
|
||||
else
|
||||
mod.wearer.throw_alert(ALERT_MODSUIT_CHARGE, /atom/movable/screen/alert/emptycell/plasma)
|
||||
return "low"
|
||||
if(0.02 to 0.25)
|
||||
return "very_low"
|
||||
|
||||
return "empty"
|
||||
|
||||
/obj/item/mod/core/plasma/proc/on_attackby(datum/source, obj/item/attacking_item, mob/user)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
@@ -225,7 +225,6 @@
|
||||
if(!check_power(amount))
|
||||
return FALSE
|
||||
mod.subtract_charge(amount)
|
||||
mod.update_charge_alert()
|
||||
return TRUE
|
||||
|
||||
/// Checks if there is enough power in the suit
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 110 KiB |
Reference in New Issue
Block a user