Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/game/machinery/_machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ Class Procs:
var/wire_compatible = FALSE

var/list/component_parts = null //list of all the parts used to build it, if made from certain kinds of frames.
var/works_with_rped_anyways = FALSE //whether it has special RPED behavior despite not having component parts
var/panel_open = FALSE
var/state_open = FALSE
var/critical_machine = FALSE //If this machine is critical to station operation and should have the area be excempted from power failures.
Expand Down
29 changes: 29 additions & 0 deletions code/modules/power/apc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
integrity_failure = 50
resistance_flags = FIRE_PROOF
interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OPEN_SILICON
works_with_rped_anyways = TRUE
FASTDMM_PROP(\
set_instance_vars(\
pixel_x = dir == EAST ? 24 : (dir == WEST ? -25 : INSTANCE_VAR_DEFAULT),\
Expand Down Expand Up @@ -291,6 +292,34 @@
if(issilicon(user))
. += span_notice("Ctrl-Click the APC to switch the breaker [ operating ? "off" : "on"].")

/obj/machinery/power/apc/exchange_parts(mob/user, obj/item/storage/part_replacer/W)
if(!istype(W))
return FALSE
if(!opened && !W.works_from_distance)
return FALSE
var/current_cell_rating = cell ? cell.get_part_rating() : -1
var/best_cell_rating = current_cell_rating
var/obj/item/stock_parts/cell/best_cell
for(var/C in W.contents)
var/obj/item/stock_parts/cell/cell = C
if (!cell || !istype(cell))
continue
var/cell_rating = cell.get_part_rating()
if (cell_rating > best_cell_rating || (cell_rating == best_cell_rating && cell.charge > best_cell.charge))
best_cell_rating = cell_rating
best_cell = cell
if (best_cell)
if (cell)
SEND_SIGNAL(W, COMSIG_TRY_STORAGE_INSERT, cell, null, null, TRUE)
to_chat(user, span_notice("[capitalize(cell.name)] replaced with [best_cell.name]."))
best_cell.forceMove(src)
var/amount_to_charge = min(best_cell.maxcharge - best_cell.charge, cell.charge)
if (cell.use(amount_to_charge))
best_cell.give(amount_to_charge)
cell = best_cell
W.play_rped_sound()


// update the APC icon to show the three base states
// also add overlays for indicator lights
/obj/machinery/power/apc/update_icon()
Expand Down
4 changes: 2 additions & 2 deletions code/modules/research/stock_parts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If you create T5+ please take a pass at gene_modder.dm [L40]. Max_values MUST fi
var/alt_sound = null

/obj/item/storage/part_replacer/pre_attack(obj/machinery/T, mob/living/user, params)
if(!istype(T) || !T.component_parts)
if(!istype(T) || (!T.component_parts && !T.works_with_rped_anyways))
return ..()
if(user.Adjacent(T)) // no TK upgrading.
if(works_from_distance)
Expand All @@ -25,7 +25,7 @@ If you create T5+ please take a pass at gene_modder.dm [L40]. Max_values MUST fi
return ..()

/obj/item/storage/part_replacer/afterattack(obj/machinery/T, mob/living/user, adjacent, params)
if(adjacent || !istype(T) || !T.component_parts)
if(adjacent || !istype(T) || (!T.component_parts && !T.works_with_rped_anyways))
return ..()
if(works_from_distance)
user.Beam(T, icon_state = "rped_upgrade", time = 5)
Expand Down