mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-08-30 16:47:34 +01:00
Revert "SSmachines instancing PR (#9080)"
This reverts commit 4889b33cea.
This commit is contained in:
@@ -171,9 +171,9 @@ var/global/list/engineering_networks = list(
|
||||
var/list/my_area = by_area[A.name]
|
||||
my_area += src
|
||||
var/number = my_area.len
|
||||
|
||||
|
||||
c_tag = "[A.name] #[number]"
|
||||
|
||||
|
||||
/obj/machinery/camera/autoname/Destroy()
|
||||
var/area/A = get_area(src)
|
||||
if(!A || !by_area || !by_area[A.name])
|
||||
@@ -215,7 +215,7 @@ var/global/list/engineering_networks = list(
|
||||
return //nooooo
|
||||
assembly.upgrades.Add(new /obj/item/assembly/prox_sensor(assembly))
|
||||
setPowerUsage()
|
||||
begin_processing()
|
||||
START_MACHINE_PROCESSING(src)
|
||||
sense_proximity(callback = /atom/proc/HasProximity)
|
||||
update_coverage()
|
||||
|
||||
|
||||
@@ -643,7 +643,7 @@ About the new airlock wires panel:
|
||||
backup_power_lost_until = world.time + SecondsToTicks(10)
|
||||
|
||||
if(main_power_lost_until > 0 || backup_power_lost_until > 0)
|
||||
begin_processing()
|
||||
START_MACHINE_PROCESSING(src)
|
||||
|
||||
// Disable electricity if required
|
||||
if(electrified_until && isAllPowerLoss())
|
||||
@@ -655,7 +655,7 @@ About the new airlock wires panel:
|
||||
backup_power_lost_until = backupPowerCablesCut() ? -1 : world.time + SecondsToTicks(60)
|
||||
|
||||
if(backup_power_lost_until > 0)
|
||||
begin_processing()
|
||||
START_MACHINE_PROCESSING(src)
|
||||
|
||||
// Disable electricity if required
|
||||
if(electrified_until && isAllPowerLoss())
|
||||
@@ -700,7 +700,7 @@ About the new airlock wires panel:
|
||||
src.electrified_until = duration == -1 ? -1 : world.time + SecondsToTicks(duration)
|
||||
|
||||
if(electrified_until > 0)
|
||||
begin_processing()
|
||||
START_MACHINE_PROCESSING(src)
|
||||
|
||||
if(feedback && message)
|
||||
to_chat(usr,message)
|
||||
|
||||
@@ -113,56 +113,32 @@ Class Procs:
|
||||
var/obj/item/circuitboard/circuit = null
|
||||
var/list/materials = list() //Exclusively used for machines that take materials - lathes, fabricators etc. Honestly overdue for a whole lathe/fab refactor at some point.
|
||||
|
||||
// Use the fastprocess subsystem instead of SSMachines?
|
||||
var/speed_process = FALSE
|
||||
// The subsystem we will be using
|
||||
var/subsystem_type = /datum/controller/subsystem/machines
|
||||
var/speed_process = FALSE //If false, SSmachines. If true, SSfastprocess.
|
||||
|
||||
required_dexterity = MOB_DEXTERITY_TOUCHSCREENS
|
||||
|
||||
/// Helper proc for telling a machine to start processing with the subsystem type that is located in its `subsystem_type` var.
|
||||
/obj/machinery/proc/begin_processing()
|
||||
START_PROCESSING_MACHINERY(src, SSMACHINES_MACHINERY_LIST)
|
||||
|
||||
/// Helper proc for telling a machine to stop processing with the subsystem type that is located in its `subsystem_type` var.
|
||||
/obj/machinery/proc/end_processing()
|
||||
STOP_PROCESSING_MACHINERY(src, SSMACHINES_MACHINERY_LIST)
|
||||
|
||||
/// Helper proc for telling a machine to start processing with the subsystem type that is located in its `subsystem_type` var.
|
||||
/obj/machinery/proc/begin_speed_processing()
|
||||
end_processing()
|
||||
START_SPEED_PROCESSING(src)
|
||||
|
||||
/// Helper proc for telling a machine to stop processing with the subsystem type that is located in its `subsystem_type` var.
|
||||
/obj/machinery/proc/end_speed_processing()
|
||||
STOP_SPEED_PROCESSING(src)
|
||||
begin_processing()
|
||||
|
||||
|
||||
|
||||
/obj/machinery/Initialize(var/ml, direction=0)
|
||||
/obj/machinery/Initialize(var/ml, d=0)
|
||||
. = ..()
|
||||
|
||||
if(direction)
|
||||
set_dir(direction)
|
||||
|
||||
if(d)
|
||||
set_dir(d)
|
||||
if(ispath(circuit))
|
||||
circuit = new circuit(src)
|
||||
global.machines += src
|
||||
if(ispath(circuit))
|
||||
circuit = new circuit(src)
|
||||
if(!speed_process)
|
||||
START_PROCESSING_MACHINERY(src, SSMACHINES_MACHINERY_LIST)
|
||||
START_MACHINE_PROCESSING(src)
|
||||
else
|
||||
begin_speed_processing()
|
||||
START_PROCESSING(SSfastprocess, src)
|
||||
if(!ml)
|
||||
power_change()
|
||||
|
||||
/obj/machinery/Destroy()
|
||||
if(!speed_process)
|
||||
STOP_PROCESSING_MACHINERY(src, SSMACHINES_MACHINERY_LIST)
|
||||
STOP_MACHINE_PROCESSING(src)
|
||||
else
|
||||
end_speed_processing()
|
||||
STOP_PROCESSING(SSfastprocess, src)
|
||||
global.machines -= src
|
||||
if(component_parts)
|
||||
for(var/atom/A in component_parts)
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
singulo.target = src
|
||||
icon_state = "[icontype]1"
|
||||
active = 1
|
||||
begin_processing()
|
||||
START_MACHINE_PROCESSING(src)
|
||||
if(user)
|
||||
to_chat(user, "<span class='notice'>You activate the beacon.</span>")
|
||||
|
||||
|
||||
@@ -19,12 +19,14 @@
|
||||
var/power_drained = 0 // Amount of power drained.
|
||||
var/max_power = 1e9 // Detonation point.
|
||||
var/mode = 0 // 0 = off, 1=clamped (off), 2=operating
|
||||
var/drained_this_tick = 0 // This is unfortunately necessary to ensure we process powersinks BEFORE other machinery such as APCs.
|
||||
|
||||
var/datum/powernet/PN // Our powernet
|
||||
var/obj/structure/cable/attached // the attached cable
|
||||
|
||||
|
||||
/obj/item/powersink/Destroy()
|
||||
STOP_PROCESSING_MACHINERY(src, SSMACHINES_POWEROBJS_LIST)
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
STOP_PROCESSING_POWER_OBJECT(src)
|
||||
..()
|
||||
|
||||
/obj/item/powersink/attackby(var/obj/item/I, var/mob/user)
|
||||
@@ -47,7 +49,8 @@
|
||||
return
|
||||
else
|
||||
if (mode == 2)
|
||||
START_PROCESSING_MACHINERY(src, SSMACHINES_POWEROBJS_LIST)
|
||||
STOP_PROCESSING(SSobj, src) // Now the power sink actually stops draining the station's power if you unhook it. --NeoFite
|
||||
STOP_PROCESSING_POWER_OBJECT(src)
|
||||
anchored = 0
|
||||
mode = 0
|
||||
src.visible_message("<span class='notice'>[user] detaches [src] from the cable!</span>")
|
||||
@@ -70,31 +73,38 @@
|
||||
src.visible_message("<span class='notice'>[user] activates [src]!</span>")
|
||||
mode = 2
|
||||
icon_state = "powersink1"
|
||||
START_PROCESSING_MACHINERY(src, SSMACHINES_POWEROBJS_LIST)
|
||||
START_PROCESSING(SSobj, src)
|
||||
datum_flags &= ~DF_ISPROCESSING // Have to reset this flag so that PROCESSING_POWER_OBJECT can re-add it. It fails if the flag is already present. - Ater
|
||||
START_PROCESSING_POWER_OBJECT(src)
|
||||
if(2) //This switch option wasn't originally included. It exists now. --NeoFite
|
||||
src.visible_message("<span class='notice'>[user] deactivates [src]!</span>")
|
||||
mode = 1
|
||||
set_light(0)
|
||||
icon_state = "powersink0"
|
||||
STOP_PROCESSING_MACHINERY(src, SSMACHINES_POWEROBJS_LIST)
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
STOP_PROCESSING_POWER_OBJECT(src)
|
||||
|
||||
/obj/item/powersink/pwr_drain()
|
||||
if(!attached)
|
||||
return 0
|
||||
|
||||
if(drained_this_tick)
|
||||
return 1
|
||||
drained_this_tick = 1
|
||||
|
||||
var/drained = 0
|
||||
|
||||
if(!attached.powernet)
|
||||
if(!PN)
|
||||
return 1
|
||||
|
||||
set_light(12)
|
||||
attached.powernet.trigger_warning()
|
||||
PN.trigger_warning()
|
||||
// found a powernet, so drain up to max power from it
|
||||
drained = attached.powernet.draw_power(drain_rate)
|
||||
drained = PN.draw_power(drain_rate)
|
||||
// if tried to drain more than available on powernet
|
||||
// now look for APCs and drain their cells
|
||||
if(drained < drain_rate)
|
||||
for(var/obj/machinery/power/terminal/T in attached.powernet.nodes)
|
||||
for(var/obj/machinery/power/terminal/T in PN.nodes)
|
||||
// Enough power drained this tick, no need to torture more APCs
|
||||
if(drained >= drain_rate)
|
||||
break
|
||||
@@ -110,6 +120,7 @@
|
||||
|
||||
|
||||
/obj/item/powersink/process()
|
||||
drained_this_tick = 0
|
||||
power_drained -= min(dissipation_rate, power_drained)
|
||||
if(power_drained > max_power * 0.95)
|
||||
playsound(src, 'sound/effects/screech.ogg', 100, 1, 1)
|
||||
@@ -117,3 +128,7 @@
|
||||
explosion(src.loc, 3,6,9,12)
|
||||
qdel(src)
|
||||
return
|
||||
if(attached && attached.powernet)
|
||||
PN = attached.powernet
|
||||
else
|
||||
PN = null
|
||||
|
||||
Reference in New Issue
Block a user