mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-21 12:02:31 +01:00
Rig maintenance panel pryable (#19216)
Made hardsuits maintenance panel pryable open, large chance it will shock you if you don't have insulating gloves, takes a while to do. Minor refactoring of the attackby code for the hardsuits, DMDoc'd and minor refactor of the electrocute_mob proc. Fixes #19173
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/obj/item/rig/attackby(obj/item/attacking_item, mob/user)
|
||||
|
||||
if(!istype(user,/mob/living)) return 0
|
||||
if(!isliving(user))
|
||||
return FALSE
|
||||
|
||||
if(electrified != 0)
|
||||
if(shock(user)) //Handles removing charge from the cell, as well. No need to do that here.
|
||||
@@ -8,17 +9,17 @@
|
||||
|
||||
// Pass repair items on to the chestpiece.
|
||||
if(chest && (istype(attacking_item, /obj/item/stack/material) || attacking_item.iswelder()))
|
||||
return chest.attackby(attacking_item,user)
|
||||
return chest.attackby(attacking_item, user)
|
||||
|
||||
// Lock or unlock the access panel.
|
||||
if(attacking_item.GetID())
|
||||
if(subverted)
|
||||
locked = 0
|
||||
locked = FALSE
|
||||
to_chat(user, SPAN_DANGER("It looks like the locking system has been shorted out."))
|
||||
return
|
||||
|
||||
if((!req_access || !req_access.len) && (!req_one_access || !req_one_access.len))
|
||||
locked = 0
|
||||
locked = FALSE
|
||||
to_chat(user, SPAN_DANGER("\The [src] doesn't seem to have a locking mechanism."))
|
||||
return
|
||||
|
||||
@@ -27,17 +28,31 @@
|
||||
return
|
||||
|
||||
locked = !locked
|
||||
to_chat(user, "You [locked ? "lock" : "unlock"] \the [src] access panel.")
|
||||
to_chat(user, SPAN_NOTICE("You [locked ? "lock" : "unlock"] \the [src] access panel."))
|
||||
return
|
||||
|
||||
else if(attacking_item.iscrowbar())
|
||||
|
||||
if(!open && locked)
|
||||
to_chat(user, "The access panel is locked shut.")
|
||||
return
|
||||
//Ask to confirm the attempt, otherwise leave
|
||||
if(tgui_alert(user, "Do you want to try to force the hardsuit maintenance panel open?", "Force Open", list("Yes", "No")) != "Yes")
|
||||
return
|
||||
|
||||
//Take a while to pry it open
|
||||
to_chat(user, SPAN_NOTICE("You start to pry open the maintenance panel of \the [src]."))
|
||||
if(do_after(user, 30 SECONDS, src))
|
||||
//You might be lucky not to touch any wire; emphasis on might
|
||||
if(prob(80))
|
||||
//If you get shocked, you lose all the progress, start over
|
||||
if(electrocute_mob(user, src.cell, src))
|
||||
to_chat(user, SPAN_ALERT("\The [src] wires electrocute you, before closing shut again!"))
|
||||
return
|
||||
|
||||
//You did it, the Aut'akh are smiling upon you
|
||||
to_chat(user, SPAN_NOTICE("You manage to pry open \the [src] maintenance panel!"))
|
||||
|
||||
open = !open
|
||||
to_chat(user, "You [open ? "open" : "close"] the access panel.")
|
||||
to_chat(user, SPAN_NOTICE("You [open ? "open" : "close"] the access panel."))
|
||||
return
|
||||
|
||||
if(open)
|
||||
@@ -48,20 +63,22 @@
|
||||
if(open)
|
||||
wires.interact(user)
|
||||
else
|
||||
to_chat(user, "You can't reach the wiring.")
|
||||
to_chat(user, SPAN_ALERT("You can't reach the wiring."))
|
||||
|
||||
return
|
||||
// Air tank.
|
||||
if(istype(attacking_item,/obj/item/tank)) //Todo, some kind of check for suits without integrated air supplies.
|
||||
|
||||
if(air_supply)
|
||||
to_chat(user, "\The [src] already has a tank installed.")
|
||||
to_chat(user, SPAN_NOTICE("\The [src] already has a tank installed."))
|
||||
return
|
||||
|
||||
if(!user.unEquip(attacking_item))
|
||||
return
|
||||
|
||||
if(!user.unEquip(attacking_item)) return
|
||||
air_supply = attacking_item
|
||||
attacking_item.forceMove(src)
|
||||
to_chat(user, "You slot [attacking_item] into [src] and tighten the connecting valve.")
|
||||
to_chat(user, SPAN_NOTICE("You slot [attacking_item] into [src] and tighten the connecting valve."))
|
||||
return
|
||||
|
||||
// Check if this is a hardsuit upgrade or a modification.
|
||||
@@ -84,17 +101,20 @@
|
||||
if(installed_modules.len)
|
||||
for(var/obj/item/rig_module/installed_mod in installed_modules)
|
||||
if(!installed_mod.redundant && istype(installed_mod, attacking_item))
|
||||
to_chat(user, "The hardsuit already has a module of that class installed.")
|
||||
to_chat(user, SPAN_NOTICE("The hardsuit already has a module of that class installed."))
|
||||
return 1
|
||||
|
||||
var/obj/item/rig_module/mod = attacking_item
|
||||
to_chat(user, "You begin installing \the [mod] into \the [src].")
|
||||
to_chat(user, SPAN_NOTICE("You begin installing \the [mod] into \the [src]."))
|
||||
|
||||
if(!do_after(user,40))
|
||||
return
|
||||
if(!user || !attacking_item)
|
||||
return
|
||||
if(!user.unEquip(mod)) return
|
||||
to_chat(user, "You install \the [mod] into \the [src].")
|
||||
if(!user.unEquip(mod))
|
||||
return
|
||||
|
||||
to_chat(user, SPAN_NOTICE("You install \the [mod] into \the [src]."))
|
||||
installed_modules |= mod
|
||||
mod.forceMove(src)
|
||||
mod.installed(src)
|
||||
@@ -104,7 +124,7 @@
|
||||
else if(!cell && istype(attacking_item,/obj/item/cell))
|
||||
|
||||
if(!user.unEquip(attacking_item)) return
|
||||
to_chat(user, "You jack \the [attacking_item] into \the [src]'s battery mount.")
|
||||
to_chat(user, SPAN_NOTICE("You jack \the [attacking_item] into \the [src]'s battery mount."))
|
||||
attacking_item.forceMove(src)
|
||||
src.cell = attacking_item
|
||||
return
|
||||
@@ -112,14 +132,14 @@
|
||||
else if(attacking_item.iswrench())
|
||||
|
||||
if(!air_supply)
|
||||
to_chat(user, "There is not tank to remove.")
|
||||
to_chat(user, SPAN_WARNING("There is not tank to remove."))
|
||||
return
|
||||
|
||||
if(user.r_hand && user.l_hand)
|
||||
air_supply.forceMove(get_turf(user))
|
||||
else
|
||||
user.put_in_hands(air_supply)
|
||||
to_chat(user, "You detach and remove \the [air_supply].")
|
||||
to_chat(user, SPAN_NOTICE("You detach and remove \the [air_supply]."))
|
||||
air_supply = null
|
||||
return
|
||||
|
||||
@@ -136,7 +156,7 @@
|
||||
if(istype(src.loc,/mob/living/carbon/human) && to_remove != "cell")
|
||||
var/mob/living/carbon/human/H = src.loc
|
||||
if(H.back == src)
|
||||
to_chat(user, "You can't remove an installed device while the hardsuit is being worn.")
|
||||
to_chat(user, SPAN_WARNING("You can't remove an installed device while the hardsuit is being worn."))
|
||||
return
|
||||
|
||||
switch(to_remove)
|
||||
@@ -144,7 +164,7 @@
|
||||
if("cell")
|
||||
|
||||
if(cell)
|
||||
to_chat(user, "You detach \the [cell] from \the [src]'s battery mount.")
|
||||
to_chat(user, SPAN_NOTICE("You detach \the [cell] from \the [src]'s battery mount."))
|
||||
for(var/obj/item/rig_module/module in installed_modules)
|
||||
module.deactivate()
|
||||
if(user.r_hand && user.l_hand)
|
||||
@@ -153,7 +173,7 @@
|
||||
cell.forceMove(user.put_in_hands(cell))
|
||||
cell = null
|
||||
else
|
||||
to_chat(user, "There is nothing loaded in that mount.")
|
||||
to_chat(user, SPAN_WARNING("There is nothing loaded in that mount."))
|
||||
|
||||
if("system module")
|
||||
|
||||
@@ -164,7 +184,7 @@
|
||||
possible_removals[module.name] = module
|
||||
|
||||
if(!possible_removals.len)
|
||||
to_chat(user, "There are no installed modules to remove.")
|
||||
to_chat(user, SPAN_WARNING("There are no installed modules to remove."))
|
||||
return
|
||||
|
||||
var/removal_choice = tgui_input_list(usr, "Which module would you like to remove?", "Hardsuit Modification", possible_removals)
|
||||
@@ -172,7 +192,7 @@
|
||||
return
|
||||
|
||||
var/obj/item/rig_module/removed = possible_removals[removal_choice]
|
||||
to_chat(user, "You detach \the [removed] from \the [src].")
|
||||
to_chat(user, SPAN_NOTICE("You detach \the [removed] from \the [src]."))
|
||||
removed.forceMove(get_turf(src))
|
||||
removed.removed()
|
||||
installed_modules -= removed
|
||||
@@ -182,11 +202,11 @@
|
||||
var/obj/item/stack/S = attacking_item
|
||||
if(malfunctioning || malfunction_delay)
|
||||
if(S.use(1))
|
||||
to_chat(user, "You pour some of \the [S] over \the [src]'s control circuitry.")
|
||||
to_chat(user, SPAN_NOTICE("You pour some of \the [S] over \the [src]'s control circuitry."))
|
||||
malfunctioning = 0
|
||||
malfunction_delay = 0
|
||||
else
|
||||
to_chat(user, "\The [S] is empty!")
|
||||
to_chat(user, SPAN_WARNING("\The [S] is empty!"))
|
||||
|
||||
return
|
||||
|
||||
@@ -213,7 +233,7 @@
|
||||
if(!subverted)
|
||||
req_access.Cut()
|
||||
req_one_access.Cut()
|
||||
locked = 0
|
||||
locked = FALSE
|
||||
subverted = 1
|
||||
to_chat(user, SPAN_DANGER("You short out the access protocol for the suit."))
|
||||
return 1
|
||||
|
||||
+21
-13
@@ -254,14 +254,22 @@
|
||||
|
||||
return net1
|
||||
|
||||
//Determines how strong could be shock, deals damage to mob, uses power.
|
||||
//M is a mob who touched wire/whatever
|
||||
//power_source is a source of electricity, can be powercell, area, apc, cable, powernet or null
|
||||
//source is an object caused electrocuting (airlock, grille, etc)
|
||||
//No animations will be performed by this proc.
|
||||
/proc/electrocute_mob(mob/living/carbon/M as mob, var/power_source, var/obj/source, var/siemens_coeff = 1.0, var/contact_zone = "hand")
|
||||
/**
|
||||
* Determines how strong could be shock, deals damage to mob, uses power
|
||||
*
|
||||
* No animations will be performed by this proc
|
||||
*
|
||||
* * victim - The mob who has to be shocked
|
||||
* * power_source - is a source of electricity, can be power cell, area, apc, cable, powernet or null
|
||||
* * source - An object caused electrocuting (airlock, grille, etc)
|
||||
* * siemens_coeff - Layman's terms, conductivity
|
||||
* * contact_zone - Where the electrocution is happening, see BP_* defines in `code\__DEFINES\mobs.dm`
|
||||
*
|
||||
* Returns the amount of energy that was used to electrocute the mob, or `null` / `FALSE` if the electrocution didn't happen
|
||||
*/
|
||||
/proc/electrocute_mob(mob/living/carbon/victim, power_source, obj/source, siemens_coeff = 1.0, contact_zone = "hand")
|
||||
|
||||
if (!M)
|
||||
if (!victim)
|
||||
return 0
|
||||
var/area/source_area
|
||||
if(istype(power_source,/area))
|
||||
@@ -286,15 +294,15 @@
|
||||
else if (!power_source)
|
||||
return 0
|
||||
else
|
||||
log_admin("ERROR: /proc/electrocute_mob([M], [power_source], [source]): wrong power_source")
|
||||
log_admin("ERROR: /proc/electrocute_mob([victim], [power_source], [source]): wrong power_source")
|
||||
return 0
|
||||
//Triggers powernet warning, but only for 5 ticks (if applicable)
|
||||
//If following checks determine user is protected we won't alarm for long.
|
||||
if(PN)
|
||||
PN.trigger_warning(5)
|
||||
var/mob/living/carbon/human/H
|
||||
if(ishuman(M))
|
||||
H = M
|
||||
if(ishuman(victim))
|
||||
H = victim
|
||||
if(H)
|
||||
if(H.species.siemens_coefficient == 0)
|
||||
return
|
||||
@@ -327,14 +335,14 @@
|
||||
var/drained_hp
|
||||
var/touchy_hand
|
||||
if(contact_zone == "hand")
|
||||
if(M.hand)
|
||||
if(victim.hand)
|
||||
touchy_hand = BP_R_HAND
|
||||
else
|
||||
touchy_hand = BP_L_HAND
|
||||
if(!touchy_hand)
|
||||
drained_hp = M.electrocute_act(shock_damage, source, siemens_coeff, ground_zero = contact_zone) //zzzzzzap!
|
||||
drained_hp = victim.electrocute_act(shock_damage, source, siemens_coeff, ground_zero = contact_zone) //zzzzzzap!
|
||||
else
|
||||
drained_hp = M.electrocute_act(shock_damage, source, siemens_coeff, ground_zero = touchy_hand) //zzzzzzap!
|
||||
drained_hp = victim.electrocute_act(shock_damage, source, siemens_coeff, ground_zero = touchy_hand) //zzzzzzap!
|
||||
var/drained_energy = drained_hp*20
|
||||
|
||||
if (source_area)
|
||||
|
||||
Reference in New Issue
Block a user