mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-15 17:13:46 +01:00
APC Area update initial commit.
Conflicts: code/modules/mob/mob.dm code/modules/power/power.dm
This commit is contained in:
@@ -78,6 +78,7 @@
|
||||
powernet = 0 // set so that APCs aren't found as powernet nodes //Hackish, Horrible, was like this before I changed it :(
|
||||
var/malfhack = 0 //New var for my changes to AI malf. --NeoFite
|
||||
var/mob/living/silicon/ai/malfai = null //See above --NeoFite
|
||||
var/debug= 0
|
||||
// luminosity = 1
|
||||
var/has_electronics = 0 // 0 - none, 1 - plugged in, 2 - secured by screwdriver
|
||||
var/overload = 1 //used for the Blackout malf module
|
||||
@@ -1049,7 +1050,8 @@
|
||||
lastused_light = area.usage(LIGHT)
|
||||
lastused_equip = area.usage(EQUIP)
|
||||
lastused_environ = area.usage(ENVIRON)
|
||||
area.clear_usage()
|
||||
if(area.powerupdate)
|
||||
area.clear_usage()
|
||||
|
||||
lastused_total = lastused_light + lastused_equip + lastused_environ
|
||||
|
||||
@@ -1072,8 +1074,8 @@
|
||||
if(terminal && terminal.powernet)
|
||||
perapc = terminal.powernet.perapc
|
||||
|
||||
//if(debug)
|
||||
// world.log << "Status: [main_status] - Excess: [excess] - Last Equip: [lastused_equip] - Last Light: [lastused_light] - Longterm: [longtermpower]"
|
||||
if(debug)
|
||||
world << "Status: [main_status] - Excess: [excess] - Last Equip: [lastused_equip] - Last Light: [lastused_light]"
|
||||
|
||||
if(cell && !shorted)
|
||||
|
||||
@@ -1318,4 +1320,4 @@ obj/machinery/power/apc/proc/autoset(var/val, var/on)
|
||||
else
|
||||
return 0
|
||||
|
||||
#undef APC_UPDATE_ICON_COOLDOWN
|
||||
#undef APC_UPDATE_ICON_COOLDOWN
|
||||
|
||||
@@ -602,9 +602,11 @@
|
||||
|
||||
#define LIGHTING_POWER_FACTOR 20 //20W per unit luminosity
|
||||
|
||||
/*
|
||||
/obj/machinery/light/process()//TODO: remove/add this from machines to save on processing as needed ~Carn PRIORITY
|
||||
if(on)
|
||||
use_power(luminosity * LIGHTING_POWER_FACTOR, LIGHT)
|
||||
*/
|
||||
|
||||
// called when area power state changes
|
||||
/obj/machinery/light/power_change()
|
||||
|
||||
@@ -54,13 +54,17 @@
|
||||
|
||||
// increment the power usage stats for an area
|
||||
|
||||
/obj/machinery/proc/use_power(var/amount, var/chan = -1) // defaults to power_channel
|
||||
var/area/A = get_area(src) // make sure it's in an area
|
||||
/obj/machinery/proc/use_power(var/amount, var/chan = -1, var/autocalled = 0) // defaults to power_channel
|
||||
var/area/A = src.loc.loc // make sure it's in an area
|
||||
if(!A || !isarea(A) || !A.master)
|
||||
return
|
||||
if(chan == -1)
|
||||
chan = power_channel
|
||||
A.master.use_power(amount, chan)
|
||||
if(!autocalled)
|
||||
if(A.master.debug)
|
||||
world << "Yeah we're setting this to 2 source: [src] / [src.type]"
|
||||
A.master.powerupdate = 2 // Decremented by 2 each GC tick, since it's not auto power change we're going to update power twice.
|
||||
|
||||
/obj/machinery/proc/power_change() // called whenever the power settings of the containing area change
|
||||
// by default, check equipment channel & set flag
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
var/flush_every_ticks = 30 //Every 30 ticks it will look whether it is ready to flush
|
||||
var/flush_count = 0 //this var adds 1 once per tick. When it reaches flush_every_ticks it resets and tries to flush.
|
||||
var/last_sound = 0
|
||||
active_power_usage = 600
|
||||
idle_power_usage = 100
|
||||
|
||||
// create a new disposal
|
||||
// find the attached trunk (if present) and init gas resvr.
|
||||
@@ -340,6 +342,7 @@
|
||||
// timed process
|
||||
// charge the gas reservoir and perform flush if ready
|
||||
process()
|
||||
use_power = 0
|
||||
if(stat & BROKEN) // nothing can happen if broken
|
||||
return
|
||||
|
||||
@@ -363,13 +366,13 @@
|
||||
if(stat & NOPOWER) // won't charge if no power
|
||||
return
|
||||
|
||||
use_power(100) // base power usage
|
||||
|
||||
use_power = 1
|
||||
|
||||
if(mode != 1) // if off or ready, no need to charge
|
||||
return
|
||||
|
||||
// otherwise charge
|
||||
use_power(500) // charging power usage
|
||||
use_power = 2
|
||||
|
||||
var/atom/L = loc // recharging from loc turf
|
||||
|
||||
|
||||
Reference in New Issue
Block a user