mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 12:37:26 +01:00
APC & Machinery Refactor + Local Powernets (#19991)
* local powernet and machine power refactor * some fixes * more tweaks + powerchange() refactor * fixes var edited apcs on meatpackers.dmm * fixes issue with power channels * Reviews * delta fix * Update code/game/machinery/portable_turret.dm Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com> * removed area power change proc * damn morgues * requested changes * request changes * deconfliction * mapping fixes * some fixes from TM --------- Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
move_resist = INFINITY
|
||||
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
|
||||
flags_2 = RAD_NO_CONTAMINATE_2
|
||||
use_power = NO_POWER_USE
|
||||
power_state = NO_POWER_USE
|
||||
light_range = 4
|
||||
layer = OBJ_LAYER + 0.1
|
||||
var/obj/machinery/field/generator/FG1 = null
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
density = TRUE
|
||||
req_access = list(ACCESS_ENGINE_EQUIP)
|
||||
|
||||
use_power = NO_POWER_USE
|
||||
idle_power_usage = 10
|
||||
active_power_usage = 300
|
||||
power_state = NO_POWER_USE
|
||||
idle_power_consumption = 10
|
||||
active_power_consumption = 300
|
||||
|
||||
/// Is the emitter turned on
|
||||
var/active = FALSE
|
||||
@@ -70,7 +70,7 @@
|
||||
fire_delay = firedelay
|
||||
for(var/obj/item/stock_parts/manipulator/M in component_parts)
|
||||
power_usage -= 50 * M.rating
|
||||
active_power_usage = power_usage
|
||||
active_power_consumption = power_usage
|
||||
|
||||
/obj/machinery/power/emitter/verb/rotate()
|
||||
set name = "Rotate"
|
||||
@@ -98,7 +98,7 @@
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/emitter/update_icon_state()
|
||||
if(active && powernet && avail(active_power_usage))
|
||||
if(active && powernet && avail(active_power_consumption))
|
||||
icon_state = "emitter_+a"
|
||||
else
|
||||
icon_state = "emitter"
|
||||
@@ -246,13 +246,13 @@
|
||||
/obj/machinery/power/emitter/process()
|
||||
if((stat & BROKEN) || !active)
|
||||
return
|
||||
if(state != EMITTER_WELDED || (!powernet && active_power_usage))
|
||||
if(state != EMITTER_WELDED || (!powernet && active_power_consumption))
|
||||
active = FALSE
|
||||
update_icon()
|
||||
return
|
||||
|
||||
if(!active_power_usage || surplus() >= active_power_usage)
|
||||
add_load(active_power_usage)
|
||||
if(!active_power_consumption || surplus() >= active_power_consumption)
|
||||
add_load(active_power_consumption)
|
||||
if(!powered)
|
||||
powered = TRUE
|
||||
update_icon()
|
||||
|
||||
@@ -25,7 +25,7 @@ field_generator power level display
|
||||
icon_state = "Field_Gen"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
use_power = NO_POWER_USE
|
||||
power_state = NO_POWER_USE
|
||||
max_integrity = 500
|
||||
//100% immune to lasers and energy projectiles since it absorbs their energy.
|
||||
armor = list(MELEE = 25, BULLET = 10, LASER = 100, ENERGY = 100, BOMB = 0, BIO = 0, RAD = 0, FIRE = 50, ACID = 70)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
icon_state = "TheSingGen"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
use_power = NO_POWER_USE
|
||||
power_state = NO_POWER_USE
|
||||
resistance_flags = FIRE_PROOF
|
||||
var/energy = 0
|
||||
var/creation_type = /obj/singularity
|
||||
|
||||
@@ -251,9 +251,8 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
|
||||
icon_state = "none"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
use_power = NO_POWER_USE
|
||||
idle_power_usage = 0
|
||||
active_power_usage = 0
|
||||
power_state = NO_POWER_USE
|
||||
|
||||
var/construction_state = 0
|
||||
var/active = FALSE
|
||||
var/reference = null
|
||||
@@ -309,11 +308,11 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
|
||||
if(construction_state == ACCELERATOR_WIRED)
|
||||
SCREWDRIVER_CLOSE_PANEL_MESSAGE
|
||||
construction_state = ACCELERATOR_READY
|
||||
use_power = IDLE_POWER_USE
|
||||
change_power_mode(IDLE_POWER_USE)
|
||||
else
|
||||
construction_state = ACCELERATOR_WIRED
|
||||
SCREWDRIVER_OPEN_PANEL_MESSAGE
|
||||
use_power = NO_POWER_USE
|
||||
change_power_mode(NO_POWER_USE)
|
||||
update_state()
|
||||
update_icon()
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
reference = "control_box"
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
use_power = NO_POWER_USE
|
||||
idle_power_usage = 500
|
||||
active_power_usage = 10000
|
||||
power_state = NO_POWER_USE
|
||||
idle_power_consumption = 500
|
||||
active_power_consumption = 10000
|
||||
construction_state = 0
|
||||
active = FALSE
|
||||
dir = 1
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/update_state()
|
||||
if(construction_state < 3)
|
||||
use_power = NO_POWER_USE
|
||||
change_power_mode(NO_POWER_USE)
|
||||
assembled = 0
|
||||
active = FALSE
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
@@ -58,7 +58,7 @@
|
||||
connected_parts = list()
|
||||
return
|
||||
if(!part_scan())
|
||||
use_power = IDLE_POWER_USE
|
||||
change_power_mode(IDLE_POWER_USE)
|
||||
active = FALSE
|
||||
connected_parts = list()
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
if(stat & NOPOWER)
|
||||
icon_state = "[reference]w"
|
||||
return
|
||||
else if(use_power && assembled)
|
||||
else if(power_state && assembled)
|
||||
icon_state = "[reference]p"
|
||||
else
|
||||
switch(construction_state)
|
||||
@@ -150,9 +150,9 @@
|
||||
..()
|
||||
if(stat & NOPOWER)
|
||||
active = FALSE
|
||||
use_power = NO_POWER_USE
|
||||
change_power_mode(NO_POWER_USE)
|
||||
else if(!stat && construction_state <= 3)
|
||||
use_power = IDLE_POWER_USE
|
||||
change_power_mode(IDLE_POWER_USE)
|
||||
update_icon()
|
||||
|
||||
if((stat & NOPOWER) || (!stat && construction_state <= 3)) //Only update the part icons if something's changed (i.e. any of the above condition sets are met).
|
||||
@@ -234,13 +234,13 @@
|
||||
usr.create_log(MISC_LOG, "PA Control Computer turned ON", src)
|
||||
log_game("PA Control Computer turned ON by [key_name(usr)] in ([x],[y],[z])")
|
||||
if(active)
|
||||
use_power = ACTIVE_POWER_USE
|
||||
change_power_mode(ACTIVE_POWER_USE)
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = strength
|
||||
part.powered = TRUE
|
||||
part.update_icon()
|
||||
else
|
||||
use_power = IDLE_POWER_USE
|
||||
change_power_mode(IDLE_POWER_USE)
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = null
|
||||
part.powered = FALSE
|
||||
|
||||
Reference in New Issue
Block a user