Skip to content

Commit

Permalink
[MIRROR] mobile defibrillator mount (#2512) (#3342)
Browse files Browse the repository at this point in the history
* mobile defibrillator mount (#83000)

## About The Pull Request


![image](https://github.com/tgstation/tgstation/assets/70376633/e8650bc6-e915-499c-8a63-eba0a70b4a96)

![image](https://github.com/tgstation/tgstation/assets/70376633/14a95345-e436-43c7-b4a7-de2502fc59cc)


5 iron and 1 sheet of silver and 15 cable to craft

its a defib mount but mobile, thats basically it

## Why It's Good For The Game

good for maps where there are no good spots to place wall defib mounts
or if you cant or dont want to take off your backpack (maybe using a
modsuit?) and theres no defib mount nearby


## Changelog
:cl:
add: mobile defibrillator mount
/:cl:

* mobile defibrillator mount

---------

Co-authored-by: NovaBot <[email protected]>
Co-authored-by: jimmyl <[email protected]>
Co-authored-by: NovaBot13 <[email protected]>
  • Loading branch information
4 people authored May 16, 2024
1 parent 38e18a3 commit 45d2f51
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 12 deletions.
12 changes: 12 additions & 0 deletions code/datums/components/crafting/furniture.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,15 @@
tool_behaviors = list(TOOL_SCREWDRIVER)
category = CAT_FURNITURE
time = 5 SECONDS

/datum/crafting_recipe/defib_mobile
name = "Mobile Defibrillator Mount"
reqs = list(
/obj/item/stack/sheet/mineral/silver = 1,
/obj/item/stack/sheet/iron = 5,
/obj/item/stack/cable_coil = 15,
)
result = /obj/machinery/defibrillator_mount/mobile
tool_behaviors = list(TOOL_SCREWDRIVER)
category = CAT_FURNITURE
time = 7 SECONDS
56 changes: 44 additions & 12 deletions code/game/machinery/defibrillator_mount.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,23 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/defibrillator_mount, 28)

/obj/machinery/defibrillator_mount/update_overlays()
. = ..()

if(!defib)
if(isnull(defib))
return

. += "defib"
var/mutable_appearance/defib_overlay = mutable_appearance(icon, "defib", layer = layer+0.01, offset_spokesman = src)

if(defib.powered)
var/obj/item/stock_parts/cell/C = get_cell()
. += (defib.safety ? "online" : "emagged")
var/ratio = C.charge / C.maxcharge
ratio = CEILING(ratio * 4, 1) * 25
. += "charge[ratio]"
var/obj/item/stock_parts/cell/cell = defib.cell
var/mutable_appearance/safety = mutable_appearance(icon, defib.safety ? "online" : "emagged", offset_spokesman = src)
var/mutable_appearance/charge_overlay = mutable_appearance(icon, "charge[CEILING((cell.charge / cell.maxcharge) * 4, 1) * 25]", offset_spokesman = src)

defib_overlay.overlays += list(safety, charge_overlay)

if(clamps_locked)
. += "clamps"
var/mutable_appearance/clamps = mutable_appearance(icon, "clamps", offset_spokesman = src)
defib_overlay.overlays += clamps

/obj/machinery/defibrillator_mount/get_cell()
if(defib)
return defib.get_cell()
. += defib_overlay

//defib interaction
/obj/machinery/defibrillator_mount/attack_hand(mob/living/user, list/modifiers)
Expand Down Expand Up @@ -220,3 +218,37 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/defibrillator_mount, 28)
icon_state = "penlite_mount"
custom_materials = list(/datum/material/iron = SMALL_MATERIAL_AMOUNT * 3, /datum/material/glass = SMALL_MATERIAL_AMOUNT, /datum/material/silver = SMALL_MATERIAL_AMOUNT * 0.5)
result_path = /obj/machinery/defibrillator_mount/charging

//mobile defib

/obj/machinery/defibrillator_mount/mobile
name = "mobile defibrillator mount"
icon_state = "mobile"
anchored = FALSE
density = TRUE

/obj/machinery/defibrillator_mount/mobile/Initialize(mapload)
. = ..()
AddElement(/datum/element/noisy_movement)

/obj/machinery/defibrillator_mount/mobile/wrench_act_secondary(mob/living/user, obj/item/tool)
if(user.combat_mode)
return ..()
if(defib)
to_chat(user, span_warning("The mount can't be deconstructed while a defibrillator unit is loaded!"))
..()
return TRUE
balloon_alert(user, "deconstructing...")
tool.play_tool_sound(src)
if(tool.use_tool(src, user, 5 SECONDS))
playsound(loc, 'sound/items/deconstruct.ogg', 50, vary = TRUE)
deconstruct()
return TRUE

/obj/machinery/defibrillator_mount/mobile/on_deconstruction(disassembled)
if(disassembled)
new /obj/item/stack/sheet/iron(drop_location(), 5)
new /obj/item/stack/sheet/mineral/silver(drop_location(), 1)
new /obj/item/stack/cable_coil(drop_location(), 15)
else
new /obj/item/stack/sheet/iron(drop_location(), 5)
2 changes: 2 additions & 0 deletions code/game/objects/items/defib.dm
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@
if(!req_defib)
return
RegisterSignal(user, COMSIG_MOVABLE_MOVED, PROC_REF(check_range))
RegisterSignal(defib.loc, COMSIG_MOVABLE_MOVED, PROC_REF(check_range))

/obj/item/shockpaddles/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change = TRUE)
. = ..()
Expand Down Expand Up @@ -434,6 +435,7 @@
. = ..()
if(user)
UnregisterSignal(user, COMSIG_MOVABLE_MOVED)
UnregisterSignal(defib.loc, COMSIG_MOVABLE_MOVED)
if(req_defib)
if(user)
to_chat(user, span_notice("The paddles snap back into the main unit."))
Expand Down
Binary file modified icons/obj/machines/defib_mount.dmi
Binary file not shown.

0 comments on commit 45d2f51

Please sign in to comment.