mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 03:57:13 +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:
@@ -209,9 +209,9 @@
|
||||
return area_created
|
||||
var/area/A = new
|
||||
A.name = str
|
||||
A.power_equip = FALSE
|
||||
A.power_light = FALSE
|
||||
A.power_environ = FALSE
|
||||
A.powernet.equipment_powered = FALSE
|
||||
A.powernet.lighting_powered = FALSE
|
||||
A.powernet.environment_powered = FALSE
|
||||
A.always_unpowered = FALSE
|
||||
A.set_dynamic_lighting()
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
/obj/machinery/computer/security/camera_bug
|
||||
name = "invasive camera utility"
|
||||
desc = "How did this get here?! Please report this as a bug to github"
|
||||
use_power = NO_POWER_USE
|
||||
power_state = NO_POWER_USE
|
||||
silent_console = TRUE
|
||||
|
||||
/obj/item/camera_bug/Initialize(mapload)
|
||||
|
||||
@@ -249,25 +249,25 @@
|
||||
if(!current_area)
|
||||
return
|
||||
if(on)
|
||||
RegisterSignal(current_area, COMSIG_AREA_POWER_CHANGE, PROC_REF(AreaPowerCheck))
|
||||
RegisterSignal(current_area.powernet, COMSIG_POWERNET_POWER_CHANGE, PROC_REF(local_powernet_check))
|
||||
else
|
||||
UnregisterSignal(current_area, COMSIG_AREA_POWER_CHANGE)
|
||||
UnregisterSignal(current_area.powernet, COMSIG_POWERNET_POWER_CHANGE)
|
||||
|
||||
/**
|
||||
* Proc called whenever the intercom's area loses or gains power. Responsible for setting the `on` variable and calling `update_icon()`.
|
||||
* Proc called whenever the intercom's local powernet loses or gains power. Responsible for setting the `on` variable and calling `update_icon()`.
|
||||
*
|
||||
* Normally called after the intercom's area recieves the `COMSIG_AREA_POWER_CHANGE` signal, but it can also be called directly.
|
||||
* Normally called after the intercom's local powernet sends the `COMSIG_POWERNET_POWER_CHANGE` signal, but it can also be called directly.
|
||||
* Arguments:
|
||||
*
|
||||
* source - the area that just had a power change.
|
||||
*/
|
||||
/obj/item/radio/intercom/proc/AreaPowerCheck(datum/source)
|
||||
/obj/item/radio/intercom/proc/local_powernet_check(datum/source)
|
||||
var/area/current_area = get_area(src)
|
||||
if(!current_area)
|
||||
on = FALSE
|
||||
set_light(0)
|
||||
else
|
||||
on = current_area.powered(EQUIP) // set "on" to the equipment power status of our area.
|
||||
on = current_area.powernet.has_power(PW_CHANNEL_EQUIPMENT) // set "on" to the equipment power status of our area.
|
||||
set_light(1, LIGHTING_MINIMUM_POWER)
|
||||
update_icon(UPDATE_ICON_STATE | UPDATE_OVERLAYS)
|
||||
|
||||
|
||||
@@ -75,10 +75,9 @@
|
||||
var/area/A = get_area(src)
|
||||
if(!isarea(A))
|
||||
return
|
||||
if(!A.powered(EQUIP))
|
||||
if(!A.powernet.has_power(PW_CHANNEL_EQUIPMENT))
|
||||
return
|
||||
A.use_power(5000, EQUIP)
|
||||
var/light = A.power_light
|
||||
A.powernet.use_active_power(PW_CHANNEL_EQUIPMENT, 5000)
|
||||
A.update_icon(UPDATE_ICON_STATE)
|
||||
|
||||
flick("echair_shock", src)
|
||||
@@ -91,5 +90,3 @@
|
||||
to_chat(buckled_mob, "<span class='danger'>You feel a deep shock course through your body!</span>")
|
||||
spawn(1)
|
||||
buckled_mob.electrocute_act(110, src, 1)
|
||||
A.power_light = light
|
||||
A.update_icon(UPDATE_ICON_STATE)
|
||||
|
||||
@@ -542,10 +542,10 @@ GLOBAL_LIST_EMPTY(crematoriums)
|
||||
icon = 'icons/obj/power.dmi'
|
||||
icon_state = "crema_switch"
|
||||
resistance_flags = INDESTRUCTIBLE // could use a more elegant solution like being able to be rebuilt, broken and repaired, or by directly attaching the switch to the crematorium
|
||||
power_channel = EQUIP
|
||||
use_power = IDLE_POWER_USE
|
||||
idle_power_usage = 100
|
||||
active_power_usage = 5000
|
||||
power_channel = PW_CHANNEL_EQUIPMENT
|
||||
power_state = IDLE_POWER_USE
|
||||
idle_power_consumption = 100
|
||||
active_power_consumption = 5000
|
||||
anchored = TRUE
|
||||
req_access = list(ACCESS_CREMATORIUM)
|
||||
/// ID of the crematorium to hook into
|
||||
@@ -556,7 +556,7 @@ GLOBAL_LIST_EMPTY(crematoriums)
|
||||
return attack_hand(user)
|
||||
|
||||
/obj/machinery/crema_switch/attack_hand(mob/user)
|
||||
if(!powered(power_channel)) // Do we have power?
|
||||
if(!has_power(power_channel)) // Do we have power?
|
||||
return
|
||||
|
||||
if(!(allowed(usr) || user.can_advanced_admin_interact()))
|
||||
|
||||
@@ -251,7 +251,7 @@
|
||||
icon_state = "shower"
|
||||
density = FALSE
|
||||
anchored = TRUE
|
||||
use_power = NO_POWER_USE
|
||||
power_state = NO_POWER_USE
|
||||
///Is the shower on or off?
|
||||
var/on = FALSE
|
||||
///What temperature the shower reagents are set to.
|
||||
|
||||
@@ -599,8 +599,9 @@
|
||||
D.toggle_polarization()
|
||||
|
||||
/obj/machinery/button/windowtint/power_change()
|
||||
..()
|
||||
if(active && !powered(power_channel))
|
||||
if(!..())
|
||||
return
|
||||
if(active && (stat & NOPOWER))
|
||||
toggle_tint()
|
||||
|
||||
/obj/machinery/button/windowtint/update_icon_state()
|
||||
|
||||
Reference in New Issue
Block a user