Skip to content

Commit

Permalink
no more bugs (#11217)
Browse files Browse the repository at this point in the history
  • Loading branch information
XeonMations authored Jul 25, 2024
1 parent f1aba21 commit 5497ee5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
22 changes: 13 additions & 9 deletions code/game/machinery/spaceheater.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
interacts_with_air = TRUE

///The cell we spawn with
var/obj/item/stock_parts/cell/cell = /obj/item/stock_parts/cell
var/obj/item/stock_parts/cell/cell = null
///Is the machine on?
var/on = FALSE
///What is the mode we are in now?
Expand All @@ -47,8 +47,6 @@

/obj/machinery/space_heater/Initialize(mapload)
. = ..()
if(ispath(cell))
cell = new cell(src)
update_appearance()
SSair.start_processing_machine(src)

Expand All @@ -57,9 +55,6 @@
return..()

/obj/machinery/space_heater/on_deconstruction()
if(cell)
LAZYADD(component_parts, cell)
cell = null
return ..()

/obj/machinery/space_heater/examine(mob/user)
Expand Down Expand Up @@ -131,12 +126,15 @@

/obj/machinery/space_heater/RefreshParts()
. = ..()
cell = null
var/laser = 0
var/cap = 0
for(var/obj/item/stock_parts/micro_laser/M in component_parts)
laser += M.rating
for(var/obj/item/stock_parts/capacitor/M in component_parts)
cap += M.rating
for(var/obj/item/stock_parts/cell/M in component_parts)
cell = M

heating_power = (laser * 2) * 100000
settable_temperature_range = cap * 30
Expand Down Expand Up @@ -179,6 +177,7 @@
if(!user.transferItemToLoc(I, src))
return
cell = I
component_parts.Add(I)
I.add_fingerprint(usr)
user.visible_message("<span class='notice'>\The [user] inserts a power cell into \the [src].</span>", "<span class ='notice'>You insert the power cell into \the [src].<span>")
SStgui.update_uis(src)
Expand Down Expand Up @@ -270,11 +269,13 @@
settable_temperature_median + settable_temperature_range)
if("eject")
if(panel_open && cell)
cell.forceMove(drop_location())
cell = null
for(var/obj/item/stock_parts/cell/M in component_parts)
M.forceMove(drop_location())
component_parts.Remove(M)
. = TRUE

//Space Heaters without cel
//Space Heaters without a cell
/obj/machinery/space_heater/no_cell
cell = null

Expand All @@ -287,7 +288,10 @@
/obj/machinery/space_heater/atmos

/obj/machinery/space_heater/atmos/Initialize(mapload)
cell = /obj/item/stock_parts/cell/hyper
for(var/obj/item/stock_parts/cell/M in component_parts)
QDEL_NULL(M)
component_parts.Add(/obj/item/stock_parts/cell/hyper)
RefreshParts()
. = ..()

#undef HEATER_MODE_STANDBY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@
req_components = list(
/obj/item/stock_parts/micro_laser = 1,
/obj/item/stock_parts/capacitor = 1,
/obj/item/stock_parts/cell = 1,
/obj/item/stack/cable_coil = 3)
needs_anchored = FALSE

Expand Down

0 comments on commit 5497ee5

Please sign in to comment.