From fdd2ca94d4556a7654979aa71e204670acfad969 Mon Sep 17 00:00:00 2001 From: Arkatos1 Date: Sat, 18 May 2019 23:52:18 +0200 Subject: [PATCH] added get_cell() proc to remaining items using cells --- code/game/machinery/defib_mount.dm | 5 ++++- code/game/machinery/floodlight.dm | 2 ++ code/game/machinery/spaceheater.dm | 4 +++- code/game/mecha/mecha.dm | 4 ++++ code/game/objects/items/weapons/defib.dm | 3 +++ code/modules/clothing/gloves/miscellaneous.dm | 4 +++- code/modules/clothing/spacesuits/rig/rig.dm | 3 +++ code/modules/mob/living/silicon/robot/robot.dm | 3 +++ code/modules/mob/living/simple_animal/bot/mulebot.dm | 3 +++ .../modular_computers/computers/item/computer_power.dm | 4 ++++ code/modules/ninja/suit/suit.dm | 3 +++ code/modules/ninja/suit/suit_attackby.dm | 4 +--- code/modules/power/apc.dm | 4 +++- code/modules/projectiles/guns/throw/crossbow.dm | 3 +++ code/modules/reagents/chemistry/machinery/chem_dispenser.dm | 3 +++ code/modules/spacepods/spacepod.dm | 2 ++ 16 files changed, 47 insertions(+), 7 deletions(-) diff --git a/code/game/machinery/defib_mount.dm b/code/game/machinery/defib_mount.dm index 49c5fbcbce6..77d68590efa 100644 --- a/code/game/machinery/defib_mount.dm +++ b/code/game/machinery/defib_mount.dm @@ -15,6 +15,10 @@ var/obj/item/defibrillator/defib //this mount's defibrillator var/clamps_locked = FALSE //if true, and a defib is loaded, it can't be removed without unlocking the clamps +/obj/machinery/defibrillator_mount/get_cell() + if(defib) + return defib.get_cell() + /obj/machinery/defibrillator_mount/New(location, direction, building = 0) ..() @@ -28,7 +32,6 @@ pixel_x = (dir & 3)? 0 : (dir == 4 ? -30 : 30) pixel_y = (dir & 3)? (dir == 1 ? -30 : 30) : 0 - /obj/machinery/defibrillator_mount/loaded/New() //loaded subtype for mapping use ..() defib = new/obj/item/defibrillator/loaded(src) diff --git a/code/game/machinery/floodlight.dm b/code/game/machinery/floodlight.dm index c11b3d7a725..68e22f2e8c7 100644 --- a/code/game/machinery/floodlight.dm +++ b/code/game/machinery/floodlight.dm @@ -12,6 +12,8 @@ var/open = FALSE var/brightness_on = 14 +/obj/machinery/floodlight/get_cell() + return cell /obj/machinery/floodlight/Initialize() . = ..() diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm index 3777dfc866d..ccba902b058 100644 --- a/code/game/machinery/spaceheater.dm +++ b/code/game/machinery/spaceheater.dm @@ -12,6 +12,9 @@ var/set_temperature = 50 // in celcius, add T0C for kelvin var/heating_power = 40000 +/obj/machinery/space_heater/get_cell() + return cell + /obj/machinery/space_heater/New() ..() cell = new(src) @@ -39,7 +42,6 @@ else to_chat(user, "The charge meter reads [cell ? round(cell.percent(),1) : 0]%") - /obj/machinery/space_heater/emp_act(severity) if(stat & (BROKEN|NOPOWER)) ..(severity) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index d9d9d5dd261..2ff5cabaaaa 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -137,6 +137,10 @@ //////////////////////// ////// Helpers ///////// //////////////////////// + +/obj/mecha/get_cell() + return cell + /obj/mecha/proc/add_airtank() internal_tank = new /obj/machinery/portable_atmospherics/canister/air(src) return internal_tank diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm index ea70e29ef83..3b388bd75f8 100644 --- a/code/game/objects/items/weapons/defib.dm +++ b/code/game/objects/items/weapons/defib.dm @@ -23,6 +23,9 @@ var/obj/item/stock_parts/cell/high/bcell = null var/combat = 0 //can we revive through space suits? +/obj/item/defibrillator/get_cell() + return bcell + /obj/item/defibrillator/New() //starts without a cell for rnd ..() paddles = make_paddles() diff --git a/code/modules/clothing/gloves/miscellaneous.dm b/code/modules/clothing/gloves/miscellaneous.dm index 227374bd420..8e5e658e31a 100644 --- a/code/modules/clothing/gloves/miscellaneous.dm +++ b/code/modules/clothing/gloves/miscellaneous.dm @@ -64,7 +64,6 @@ item_state = "lgloves" flags = NODROP - /obj/item/clothing/gloves/color/yellow/stun name = "stun gloves" desc = "Horrendous and awful. It smells like cancer. The fact it has wires attached to it is incidental." @@ -72,6 +71,9 @@ var/stun_strength = 5 var/stun_cost = 2000 +/obj/item/clothing/gloves/color/yellow/stun/get_cell() + return cell + /obj/item/clothing/gloves/color/yellow/stun/New() ..() update_icon() diff --git a/code/modules/clothing/spacesuits/rig/rig.dm b/code/modules/clothing/spacesuits/rig/rig.dm index 913e65af734..b463a513764 100644 --- a/code/modules/clothing/spacesuits/rig/rig.dm +++ b/code/modules/clothing/spacesuits/rig/rig.dm @@ -97,6 +97,9 @@ to_chat(usr, "The maintenance panel is [open ? "open" : "closed"].") to_chat(usr, "Hardsuit systems are [offline ? "offline" : "online"].") +/obj/item/rig/get_cell() + return cell + /obj/item/rig/New() ..() diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 7521270346e..14a9e94f57b 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -103,6 +103,9 @@ var/list/robot_verbs_default = list( var/datum/action/item_action/toggle_research_scanner/scanner = null var/list/module_actions = list() +/mob/living/silicon/robot/get_cell() + return cell + /mob/living/silicon/robot/New(loc,var/syndie = 0,var/unfinished = 0, var/alien = 0) spark_system = new /datum/effect_system/spark_spread() spark_system.set_up(5, 0, src) diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index 49a3b2718db..1db149418c7 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -50,6 +50,9 @@ var/currentBloodColor = "#A10808" var/currentDNA = null +/mob/living/simple_animal/bot/mulebot/get_cell() + return cell + /mob/living/simple_animal/bot/mulebot/New() ..() wires = new /datum/wires/mulebot(src) diff --git a/code/modules/modular_computers/computers/item/computer_power.dm b/code/modules/modular_computers/computers/item/computer_power.dm index 0a7955cfe52..27c81d48190 100644 --- a/code/modules/modular_computers/computers/item/computer_power.dm +++ b/code/modules/modular_computers/computers/item/computer_power.dm @@ -26,6 +26,10 @@ return battery_module.battery.give(amount) return 0 +/obj/item/modular_computer/get_cell() + var/obj/item/computer_hardware/battery/battery_module = all_components[MC_CELL] + if(battery_module && battery_module.battery) + return battery_module.battery // Used in following function to reduce copypaste /obj/item/modular_computer/proc/power_failure() diff --git a/code/modules/ninja/suit/suit.dm b/code/modules/ninja/suit/suit.dm index dfd430a5754..6e550e64893 100644 --- a/code/modules/ninja/suit/suit.dm +++ b/code/modules/ninja/suit/suit.dm @@ -27,6 +27,9 @@ Contents: var/obj/item/clothing/mask/gas/space_ninja/suitMask var/mob/living/carbon/human/suitOccupant +/obj/item/clothing/suit/space/space_ninja/get_cell() + return suitCell + /obj/item/clothing/suit/space/space_ninja/proc/toggle_suit_lock(mob/living/carbon/human/user) if(!suitActive) if(!istype(user.wear_suit, /obj/item/clothing/suit/space/space_ninja)) diff --git a/code/modules/ninja/suit/suit_attackby.dm b/code/modules/ninja/suit/suit_attackby.dm index ab6250a2b0f..2a2683a2826 100644 --- a/code/modules/ninja/suit/suit_attackby.dm +++ b/code/modules/ninja/suit/suit_attackby.dm @@ -1,5 +1,3 @@ - - /obj/item/clothing/suit/space/space_ninja/attackby(obj/item/I, mob/U, params) if(U==suitOccupant)//Safety, in case you try doing this without wearing the suit/being the person with the suit. if(istype(I, /obj/item/stock_parts/cell)) @@ -21,4 +19,4 @@ else to_chat(U, "Procedure interrupted. Protocol terminated.") return - ..() \ No newline at end of file + ..() diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index a3186b115a4..357d716197e 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -117,7 +117,6 @@ lighting = 0 operating = 0 - /obj/machinery/power/apc/noalarm report_power_alarm = 0 @@ -133,6 +132,9 @@ usesound = 'sound/items/deconstruct.ogg' toolspeed = 1 +/obj/machinery/power/apc/get_cell() + return cell + /obj/machinery/power/apc/connect_to_network() //Override because the APC does not directly connect to the network; it goes through a terminal. //The terminal is what the power computer looks for anyway. diff --git a/code/modules/projectiles/guns/throw/crossbow.dm b/code/modules/projectiles/guns/throw/crossbow.dm index bf101cd49c3..9c87f7949a9 100644 --- a/code/modules/projectiles/guns/throw/crossbow.dm +++ b/code/modules/projectiles/guns/throw/crossbow.dm @@ -22,6 +22,9 @@ var/obj/item/stock_parts/cell/cell = null // Used for firing superheated rods. var/list/possible_tensions = list(XBOW_TENSION_20, XBOW_TENSION_40, XBOW_TENSION_60, XBOW_TENSION_80, XBOW_TENSION_FULL) +/obj/item/gun/throw/crossbow/get_cell() + return cell + /obj/item/gun/throw/crossbow/emp_act(severity) if(cell && severity) emp_act(severity) diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm index 57a57ef8e0a..51a26533ea7 100644 --- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm +++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm @@ -24,6 +24,9 @@ var/hack_message = "You disable the safety safeguards, enabling the \"Mad Scientist\" mode." var/unhack_message = "You re-enable the safety safeguards, enabling the \"NT Standard\" mode." +/obj/machinery/chem_dispenser/get_cell() + return cell + /obj/machinery/chem_dispenser/New() ..() component_parts = list() diff --git a/code/modules/spacepods/spacepod.dm b/code/modules/spacepods/spacepod.dm index 273ea75e832..16f8e8f067f 100644 --- a/code/modules/spacepods/spacepod.dm +++ b/code/modules/spacepods/spacepod.dm @@ -92,6 +92,8 @@ has_paint = 1 update_icons() +/obj/spacepod/get_cell() + return battery /obj/spacepod/New() . = ..()