diff --git a/code/game/objects/items/tools/weldingtool.dm b/code/game/objects/items/tools/weldingtool.dm index 2d544690a47..d936d6deba3 100644 --- a/code/game/objects/items/tools/weldingtool.dm +++ b/code/game/objects/items/tools/weldingtool.dm @@ -223,7 +223,6 @@ if(get_fuel() >= used) reagents.remove_reagent(/datum/reagent/fuel, used) - SEND_SIGNAL(src, COMSIG_UPDATE_AMMO_HUD) //SKYRAT EDIT ADDITION check_fuel() return TRUE else @@ -237,7 +236,6 @@ . = welding welding = new_value set_light_on(welding) - SEND_SIGNAL(src, COMSIG_UPDATE_AMMO_HUD) //SKYRAT EDIT ADDITION /// Turns off the welder if there is no more fuel (does this really need to be its own proc?) @@ -396,7 +394,6 @@ /obj/item/weldingtool/abductor/process() if(get_fuel() <= max_fuel) reagents.add_reagent(/datum/reagent/fuel, 1) - SEND_SIGNAL(src, COMSIG_UPDATE_AMMO_HUD) //SKYRAT EDIT ADDITION ..() /obj/item/weldingtool/hugetank @@ -427,7 +424,6 @@ if(get_fuel() < max_fuel && nextrefueltick < world.time) nextrefueltick = world.time + 10 reagents.add_reagent(/datum/reagent/fuel, 1) - SEND_SIGNAL(src, COMSIG_UPDATE_AMMO_HUD) //SKYRAT EDIT ADDITION #undef WELDER_FUEL_BURN_INTERVAL diff --git a/code/modules/projectiles/guns/ballistic.dm b/code/modules/projectiles/guns/ballistic.dm index 44a8aea5256..2190dcbbc30 100644 --- a/code/modules/projectiles/guns/ballistic.dm +++ b/code/modules/projectiles/guns/ballistic.dm @@ -339,7 +339,6 @@ balloon_alert(user, "[magazine_wording] unloaded") update_appearance() - SEND_SIGNAL(src, COMSIG_UPDATE_AMMO_HUD) //SKYRAT EDIT ADDITION /obj/item/gun/ballistic/can_shoot() return chambered?.loaded_projectile @@ -452,7 +451,6 @@ bolt_locked = TRUE playsound(src, bolt_drop_sound, bolt_drop_sound_volume) update_appearance() - SEND_SIGNAL(src, COMSIG_UPDATE_AMMO_HUD) ///postfire empty checks for bolt locking and sound alarms /obj/item/gun/ballistic/proc/postfire_empty_checks(last_shot_succeeded) diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index b6cf2a454f2..69dbd3a4738 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -152,7 +152,6 @@ cell.give(100) if(!chambered) //if empty chamber we try to charge a new shot recharge_newshot(TRUE) - SEND_SIGNAL(src, COMSIG_UPDATE_AMMO_HUD) //SKYRAT EDIT ADDITION update_appearance() /obj/item/gun/energy/attack_self(mob/living/user as mob) @@ -210,7 +209,6 @@ chambered = null recharge_newshot(TRUE) update_appearance() - SEND_SIGNAL(src, COMSIG_UPDATE_AMMO_HUD) //SKYRAT EDIT ADDITION /obj/item/gun/energy/update_icon_state() var/skip_inhand = initial(inhand_icon_state) //only build if we aren't using a preset inhand icon diff --git a/code/modules/reagents/reagent_dispenser.dm b/code/modules/reagents/reagent_dispenser.dm index c1a18ab9ae4..30b1ff6ede6 100644 --- a/code/modules/reagents/reagent_dispenser.dm +++ b/code/modules/reagents/reagent_dispenser.dm @@ -298,7 +298,6 @@ user.visible_message(span_notice("[user] refills [user.p_their()] [W.name]."), span_notice("You refill [W].")) playsound(src, 'sound/effects/refill.ogg', 50, TRUE) W.update_appearance() - SEND_SIGNAL(src, COMSIG_UPDATE_AMMO_HUD) //SKYRAT EDIT ADDITION else user.visible_message(span_danger("[user] catastrophically fails at refilling [user.p_their()] [I.name]!"), span_userdanger("That was stupid of you.")) log_bomber(user, "detonated a", src, "via welding tool") diff --git a/modular_skyrat/master_files/code/game/objects/items/tools/weldingtool.dm b/modular_skyrat/master_files/code/game/objects/items/tools/weldingtool.dm index 3fcfef9442c..fecef3acdaf 100644 --- a/modular_skyrat/master_files/code/game/objects/items/tools/weldingtool.dm +++ b/modular_skyrat/master_files/code/game/objects/items/tools/weldingtool.dm @@ -4,3 +4,23 @@ /// How long it takes to weld your own robotic limbs. var/other_delay = 1 SECONDS +/obj/item/weldingtool/Initialize(mapload) + . = ..() + RegisterSignals(reagents, + list( + COMSIG_REAGENTS_ADD_REAGENT, + COMSIG_REAGENTS_NEW_REAGENT, + COMSIG_REAGENTS_REM_REAGENT, + COMSIG_REAGENTS_DEL_REAGENT, + COMSIG_REAGENTS_CLEAR_REAGENTS, + COMSIG_REAGENTS_REACTED,), + PROC_REF(update_ammo_hud)) + +/obj/item/weldingtool/set_welding(new_value) + . = ..() + update_ammo_hud() + +/obj/item/weldingtool/proc/update_ammo_hud() + SIGNAL_HANDLER + + SEND_SIGNAL(src, COMSIG_UPDATE_AMMO_HUD) diff --git a/modular_skyrat/master_files/code/modules/projectiles/guns/ballistic.dm b/modular_skyrat/master_files/code/modules/projectiles/guns/ballistic.dm new file mode 100644 index 00000000000..3a70dc9f5c0 --- /dev/null +++ b/modular_skyrat/master_files/code/modules/projectiles/guns/ballistic.dm @@ -0,0 +1,8 @@ +/obj/item/gun/ballistic/eject_magazine(mob/user, display_message, obj/item/ammo_box/magazine/tac_load) + . = ..() + SEND_SIGNAL(src, COMSIG_UPDATE_AMMO_HUD) + +/obj/item/gun/ballistic/insert_magazine(mob/user, obj/item/ammo_box/magazine/AM, display_message) + . = ..() + if(.) + SEND_SIGNAL(src, COMSIG_UPDATE_AMMO_HUD) diff --git a/modular_skyrat/master_files/code/modules/projectiles/guns/energy.dm b/modular_skyrat/master_files/code/modules/projectiles/guns/energy.dm new file mode 100644 index 00000000000..b40dc722950 --- /dev/null +++ b/modular_skyrat/master_files/code/modules/projectiles/guns/energy.dm @@ -0,0 +1,8 @@ +/obj/item/gun/energy/process(seconds_per_tick) + . = ..() + if(selfcharge && cell && cell.percent() < 100) + SEND_SIGNAL(src, COMSIG_UPDATE_AMMO_HUD) + +/obj/item/gun/energy/select_fire(mob/living/user) + . = ..() + SEND_SIGNAL(src, COMSIG_UPDATE_AMMO_HUD) diff --git a/modular_skyrat/modules/gunhud/code/gun_hud_component.dm b/modular_skyrat/modules/gunhud/code/gun_hud_component.dm index f32981b01e4..9d62cf8436e 100644 --- a/modular_skyrat/modules/gunhud/code/gun_hud_component.dm +++ b/modular_skyrat/modules/gunhud/code/gun_hud_component.dm @@ -14,8 +14,6 @@ /datum/component/ammo_hud/proc/wake_up(datum/source, mob/user, slot) SIGNAL_HANDLER - RegisterSignals(parent, list(COMSIG_PARENT_PREQDELETED, COMSIG_ITEM_DROPPED), PROC_REF(turn_off)) - if(ishuman(user)) var/mob/living/carbon/human/H = user if(H.is_holding(parent)) @@ -28,7 +26,8 @@ /datum/component/ammo_hud/proc/turn_on() SIGNAL_HANDLER - RegisterSignal(parent, COMSIG_UPDATE_AMMO_HUD, PROC_REF(update_hud)) + RegisterSignals(parent, list(COMSIG_PARENT_PREQDELETED, COMSIG_ITEM_DROPPED), PROC_REF(turn_off)) + RegisterSignals(parent, list(COMSIG_UPDATE_AMMO_HUD, COMSIG_GUN_CHAMBER_PROCESSED), PROC_REF(update_hud)) hud.turn_on() update_hud() @@ -36,7 +35,7 @@ /datum/component/ammo_hud/proc/turn_off() SIGNAL_HANDLER - UnregisterSignal(parent, list(COMSIG_PARENT_PREQDELETED, COMSIG_ITEM_DROPPED, COMSIG_UPDATE_AMMO_HUD)) + UnregisterSignal(parent, list(COMSIG_PARENT_PREQDELETED, COMSIG_ITEM_DROPPED, COMSIG_UPDATE_AMMO_HUD, COMSIG_GUN_CHAMBER_PROCESSED)) if(hud) hud.turn_off() diff --git a/modular_skyrat/modules/gunhud/readme.md b/modular_skyrat/modules/gunhud/readme.md index e580d96643a..72538eb7857 100644 --- a/modular_skyrat/modules/gunhud/readme.md +++ b/modular_skyrat/modules/gunhud/readme.md @@ -17,6 +17,9 @@ Adds a dynamic hud system for energy and some ballistics guns. ### Master file additions - Hud directory > _defines.dm, human.dm, hud.dm +- `modular_skyrat\master_files\code\game\objects\items\tools\weldingtool.dm`: `proc/Initialize`, `proc/set_welding` +- `modular_skyrat\master_files\code\modules\projectiles\guns\ballistic.dm`: `proc/eject_magazine`, `proc/insert_magazine` +- `modular_skyrat\master_files\code\modules\projectiles\guns\energy.dm`: `proc/process`, `proc/select_fire` ### Included files that are not contained in this module: @@ -24,3 +27,4 @@ Adds a dynamic hud system for energy and some ballistics guns. ### Credits: Gandalf2k15 - OG creation. +Larentoun - modularisation diff --git a/tgstation.dme b/tgstation.dme index f620381a39a..f59a7f0a5d3 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -5597,6 +5597,8 @@ #include "modular_skyrat\master_files\code\modules\power\singularity\containment_field.dm" #include "modular_skyrat\master_files\code\modules\projectiles\boxes_magazines\external\shotgun.dm" #include "modular_skyrat\master_files\code\modules\projectiles\boxes_magazines\external\smg.dm" +#include "modular_skyrat\master_files\code\modules\projectiles\guns\ballistic.dm" +#include "modular_skyrat\master_files\code\modules\projectiles\guns\energy.dm" #include "modular_skyrat\master_files\code\modules\projectiles\guns\ballistic\revolver.dm" #include "modular_skyrat\master_files\code\modules\projectiles\guns\ballistic\bows\_bow.dm" #include "modular_skyrat\master_files\code\modules\projectiles\guns\ballistic\bows\bow_quivers.dm"