BROADCASTER REWORK AHOY (also powernet things)

- Added: /datum/power_connection components, allows machinery to have cable connections without being /obj/machinery/power + more flexibility
- Bugfix: Broadcaster doesn't use area power anymore, requires a direct cable connection to grid.
- Bugfix: Broadcaster can be unwrenched again
- Bugfix: Broadcaster cannot be on while unanchored

NOTE: Didn't fuck around with adding cables to the broadcaster's lair on the maps.  Mappers will need to fix that.

Tested locally, eradicated some related funtimes.
This commit is contained in:
Rob Nelson
2015-08-04 17:48:18 -07:00
parent 7ad99d0bd4
commit e9715e3749
6 changed files with 454 additions and 36 deletions

View File

@@ -12,38 +12,72 @@ var/global/list/power_machines = list()
for(var/i = 1 to power_machines.len)
if(i > power_machines.len)
break
var/obj/machinery/M = power_machines[i]
if(istype(M) && !M.gcDestroyed)
if(istype(power_machines[i], /obj/machinery))
var/obj/machinery/M = power_machines[i]
if(!M.gcDestroyed)
#ifdef PROFILE_MACHINES
var/time_start = world.timeofday
#endif
if(M.check_rebuild()) //Checks to make sure the powernet doesn't need to be rebuilt, rebuilds it if it does
scheck()
if(M.process() == PROCESS_KILL)
M.inMachineList = 0
power_machines.Remove(M)
continue
if(M && M.use_power)
M.auto_use_power()
if(istype(M))
#ifdef PROFILE_MACHINES
var/time_end = world.timeofday
if(!(M.type in power_machinery_profiling))
power_machinery_profiling[M.type] = 0
power_machinery_profiling[M.type] += (time_end - time_start)
#endif
else
if(!power_machines.Remove(M))
power_machines.Cut(i,i+1)
else
if(M)
M.inMachineList = 0
if(!power_machines.Remove(M))
power_machines.Cut(i,i+1)
if(istype(power_machines[i], /datum/power_connection))
var/datum/power_connection/C = power_machines[i]
#ifdef PROFILE_MACHINES
var/time_start = world.timeofday
#endif
if(M.check_rebuild()) //Checks to make sure the powernet doesn't need to be rebuilt, rebuilds it if it does
if(C.check_rebuild()) //Checks to make sure the powernet doesn't need to be rebuilt, rebuilds it if it does
scheck()
if(M.process() == PROCESS_KILL)
M.inMachineList = 0
power_machines.Remove(M)
if(C.process() == PROCESS_KILL)
C.inMachineList = 0
power_machines.Remove(C)
continue
if(M && M.use_power)
M.auto_use_power()
if(istype(M))
//if(C && C.use_power)
// C.auto_use_power()
if(istype(C))
#ifdef PROFILE_MACHINES
var/time_end = world.timeofday
if(!(M.type in power_machinery_profiling))
power_machinery_profiling[M.type] = 0
if(!(C.type in power_machinery_profiling))
power_machinery_profiling[C.type] = 0
power_machinery_profiling[M.type] += (time_end - time_start)
power_machinery_profiling[C.type] += (time_end - time_start)
#endif
else
if(!power_machines.Remove(M))
if(!power_machines.Remove(C))
power_machines.Cut(i,i+1)
else
if(M)
M.inMachineList = 0
if(!power_machines.Remove(M))
power_machines.Cut(i,i+1)
scheck()
scheck()