Skip to content

Commit

Permalink
Colony wall heater qol & fixes (#3428)
Browse files Browse the repository at this point in the history
* Space Heaters no longer deplete their starting cell instantly, and scale appropriately

* Update spaceheater.dm

* Adjust wall heaters

Also, fixes them having the height offset element & droping machine
frames upon deconstruction

* fix decon dropping frames, no cell duping

* there's really no reason for all this but yeah

* adjust power a bit

* tippies

* interact return value

Co-authored-by: Bloop <[email protected]>

---------

Co-authored-by: necromanceranne <[email protected]>
Co-authored-by: Bloop <[email protected]>
  • Loading branch information
3 people authored and StealsThePRs committed Jul 3, 2024
1 parent 1558655 commit ac8a94f
Showing 1 changed file with 71 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
anchored = TRUE
density = FALSE
circuit = null
heating_energy = 20 KILO JOULES
efficiency = 10
heating_energy = STANDARD_CELL_RATE * 0.2
efficiency = 30
display_panel = TRUE
cell = null
/// What this repacks into when its wrenched off a wall
var/repacked_type = /obj/item/wallframe/wall_heater

Expand All @@ -18,11 +19,13 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/space_heater/wall_mounted, 29)
. = ..()
find_and_hang_on_wall()
AddElement(/datum/element/manufacturer_examine, COMPANY_FRONTIER)
RemoveElement(/datum/element/elevation, pixel_shift = 8) //they're on the wall, you can't climb this
RemoveElement(/datum/element/climbable)

/obj/machinery/space_heater/wall_mounted/RefreshParts()
. = ..()
heating_energy = 20 KILO JOULES
efficiency = 10
heating_energy = STANDARD_CELL_RATE * 0.2
efficiency = 30

/obj/machinery/space_heater/wall_mounted/default_deconstruction_crowbar()
return
Expand All @@ -37,7 +40,12 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/space_heater/wall_mounted, 29)

/obj/machinery/space_heater/wall_mounted/on_deconstruction(disassembled)
if(disassembled)
new repacked_type(drop_location())
var/obj/item/wallframe/wall_heater/frame = new repacked_type(drop_location())
frame.cell = cell
cell?.forceMove(frame)
else
cell.forceMove(drop_location())
cell = null
return ..()

// Wallmount for creating the heaters
Expand All @@ -56,3 +64,61 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/space_heater/wall_mounted, 29)
/datum/material/silver = SHEET_MATERIAL_AMOUNT * 1,
/datum/material/gold = SMALL_MATERIAL_AMOUNT,
)
/// lazy-initialized cell stored in the actual heater (so that it can start with one without making a new one every placement)
var/obj/item/stock_parts/power_store/cell = /obj/machinery/space_heater::cell

/obj/item/wallframe/wall_heater/Initialize(mapload)
. = ..()
register_context()

/obj/item/wallframe/wall_heater/after_attach(obj/machinery/space_heater/wall_mounted/attached_to)
. = ..()
if(!istype(attached_to))
return
if(ispath(cell))
cell = new cell
attached_to.cell = cell
cell?.forceMove(attached_to)
cell = null

/obj/item/wallframe/wall_heater/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(!istype(tool, /obj/item/stock_parts/power_store/cell))
return NONE
if(ispath(cell))
cell = new cell
playsound(src, 'sound/machines/click.ogg', 75, TRUE)
user.transferItemToLoc(tool, src)
if(!isnull(cell))
user.put_in_hands(cell)
user.balloon_alert(user, "swapped")
cell = tool
return ITEM_INTERACT_SUCCESS

/obj/item/wallframe/wall_heater/attack_hand_secondary(mob/user, list/modifiers)
. = ..()
if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN)
return
if(isnull(cell))
return SECONDARY_ATTACK_CALL_NORMAL
if(ispath(cell))
cell = new cell
playsound(src, 'sound/machines/click.ogg', 75, TRUE)
user.put_in_hands(cell)
cell = null
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN

/obj/item/wallframe/wall_heater/examine(mob/user)
. = ..()
if(cell)
. += span_notice("It contains a [ispath(cell) ? cell::name : cell.name], which could be replaced.")
else
. += span_notice("It is empty. You could insert a [span_bold("cell")].")

/obj/item/wallframe/wall_heater/add_context(atom/source, list/context, obj/item/held_item, mob/user)
. = ..()
if(!isnull(cell) && isnull(held_item))
context[SCREENTIP_CONTEXT_RMB] = "Remove cell"
. = CONTEXTUAL_SCREENTIP_SET
if(istype(held_item, /obj/item/stock_parts/power_store))
context[SCREENTIP_CONTEXT_LMB] = "Insert cell"
. = CONTEXTUAL_SCREENTIP_SET

0 comments on commit ac8a94f

Please sign in to comment.