LINDA Performance Fixup

This commit is contained in:
Fox-McCloud
2015-10-16 00:52:57 -04:00
parent d6cb0f9075
commit 905a3e190d
9 changed files with 162 additions and 304 deletions
+1 -2
View File
@@ -20,7 +20,6 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
use_power = 1
idle_power_usage = 25
machinetype = 5
delay = 7
circuitboard = "/obj/item/weapon/circuitboard/telecomms/broadcaster"
/obj/machinery/telecomms/broadcaster/receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from)
@@ -530,7 +529,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
var/obj/item/device/radio/headset/radio = new
var/part_b = "</span><b> \icon[radio]\[[freq_text]\][part_b_extra]</b> <span class='message'>" // Tweaked for security headsets -- TLE
var/part_blackbox_b = "</span><b> \[[freq_text]\]</b> <span class='message'>"
var/part_blackbox_b = "</span><b> \[[freq_text]\]</b> <span class='message'>"
var/part_c = "</span></span>"
var/blackbox_msg = "[part_a][source][part_blackbox_b]\"[text]\"[part_c]"
@@ -20,18 +20,6 @@
attack_hand(user)
// REPAIRING: Use Nanopaste to repair 10-20 integrity points.
if(istype(P, /obj/item/stack/nanopaste))
var/obj/item/stack/nanopaste/T = P
if (integrity < 100) //Damaged, let's repair!
integrity = between(0, integrity + rand(10,20), 100)
T.use(1)
usr << "You apply the Nanopaste to [src], repairing some of the damage."
else
usr << "This machine is already in perfect condition."
return
switch(construct_op)
if(0)
if(istype(P, /obj/item/weapon/screwdriver))
+9 -10
View File
@@ -23,7 +23,7 @@
hide = 1
toggled = 0
autolinkers = list("r_relay")
/obj/machinery/telecomms/relay/preset/engioutpost
id = "Engineering Outpost"
hide = 1
@@ -37,7 +37,6 @@
//anchored = 1
use_power = 0
//idle_power_usage = 0
heatgen = 0
autolinkers = list("c_relay")
//HUB
@@ -48,7 +47,7 @@
autolinkers = list("hub", "relay", "c_relay", "s_relay", "m_relay", "r_relay", "e_relay", "science", "medical",
"supply", "service", "common", "command", "engineering", "security",
"receiverA", "receiverB", "broadcasterA", "broadcasterB")
/obj/machinery/telecomms/hub/preset_cent
id = "CentComm Hub"
network = "tcommsat"
@@ -73,14 +72,14 @@
id = "Receiver B"
network = "tcommsat"
autolinkers = list("receiverB") // link to relay
freq_listening = list(AI_FREQ, COMM_FREQ, ENG_FREQ, SEC_FREQ)
freq_listening = list(AI_FREQ, COMM_FREQ, ENG_FREQ, SEC_FREQ)
//Common and other radio frequencies for people to freely use
New()
for(var/i = PUBLIC_LOW_FREQ, i < PUBLIC_HIGH_FREQ, i += 2)
freq_listening |= i
..()
/obj/machinery/telecomms/receiver/preset_cent
id = "CentComm Receiver"
network = "tcommsat"
@@ -118,7 +117,7 @@
for(var/i = PUBLIC_LOW_FREQ, i < PUBLIC_HIGH_FREQ, i += 2)
freq_listening |= i
..()
/obj/machinery/telecomms/bus/preset_cent
id = "CentComm Bus"
network = "tcommsat"
@@ -147,7 +146,7 @@
id = "Processor 4"
network = "tcommsat"
autolinkers = list("processor4")
/obj/machinery/telecomms/processor/preset_cent
id = "CentComm Processor"
network = "tcommsat"
@@ -178,8 +177,8 @@
/obj/machinery/telecomms/server/presets/service
id = "Service Server"
freq_listening = list(SRV_FREQ)
autolinkers = list("service")
autolinkers = list("service")
/obj/machinery/telecomms/server/presets/common
id = "Common Server"
freq_listening = list(PUB_FREQ, AI_FREQ)
@@ -210,7 +209,7 @@
id = "CentComm Server"
freq_listening = list(ERT_FREQ, DTH_FREQ)
use_power = 0
autolinkers = list("centcomm")
autolinkers = list("centcomm")
//Broadcasters
@@ -28,10 +28,6 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
var/machinetype = 0 // just a hacky way of preventing alike machines from pairing
var/toggled = 1 // Is it toggled on
var/on = 1
var/integrity = 100 // basically HP, loses integrity by heat
var/heatgen = 20 // how much heat to transfer to the environment
var/delay = 10 // how many process() ticks to delay per heat
var/heating_power = 40000
var/long_range_link = 0 // Can you link it across Z levels or on the otherside of the map? (Relay & Hub)
var/circuitboard = null // string pointing to a circuitboard type
var/hide = 0 // Is it a hidden machine?
@@ -46,7 +42,6 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
//world << "[src] ([src.id]) - [signal.debug_print()]"
var/send_count = 0
signal.data["slow"] += rand(0, round((100-integrity))) // apply some lag based on integrity
// Apply some lag based on traffic rates
var/netlag = round(traffic / 50)
@@ -183,7 +178,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
/obj/machinery/telecomms/proc/update_power()
if(toggled)
if(stat & (BROKEN|NOPOWER|EMPED) || integrity <= 0) // if powered, on. if not powered, off. if too damaged, off
if(stat & (BROKEN|NOPOWER|EMPED)) // if powered, on. if not powered, off. if too damaged, off
on = 0
else
on = 1
@@ -193,9 +188,6 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
/obj/machinery/telecomms/process()
update_power()
// Check heat and generate some
checkheat()
// Update the icon
update_icon()
@@ -211,53 +203,6 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
stat &= ~EMPED
..()
/obj/machinery/telecomms/proc/checkheat()
// Checks heat from the environment and applies any integrity damage
var/datum/gas_mixture/environment = loc.return_air()
var/damage_chance = 0 // Percent based chance of applying 1 integrity damage this tick
switch(environment.temperature)
if((T0C + 40) to (T0C + 70)) // 40C-70C, minor overheat, 10% chance of taking damage
damage_chance = 10
if((T0C + 70) to (T0C + 130)) // 70C-130C, major overheat, 25% chance of taking damage
damage_chance = 25
if((T0C + 130) to (T0C + 200)) // 130C-200C, dangerous overheat, 50% chance of taking damage
damage_chance = 50
if((T0C + 200) to INFINITY) // More than 200C, INFERNO. Takes damage every tick.
damage_chance = 100
if (damage_chance && prob(damage_chance))
integrity = between(0, integrity - 1, 100)
if(delay)
delay--
else
// If the machine is on, ready to produce heat, and has positive traffic, genn some heat
if(on && traffic > 0)
produce_heat(heatgen)
delay = initial(delay)
/obj/machinery/telecomms/proc/produce_heat(heat_amt)
if(heatgen == 0)
return
if(!(stat & (NOPOWER|BROKEN))) //Blatently stolen from space heater.
var/turf/simulated/L = loc
if(istype(L))
var/datum/gas_mixture/env = L.return_air()
if(env.temperature < (heat_amt+T0C))
var/transfer_moles = 0.25 * env.total_moles()
var/datum/gas_mixture/removed = env.remove(transfer_moles)
if(removed)
var/heat_capacity = removed.heat_capacity()
if(heat_capacity == 0 || heat_capacity == null)
heat_capacity = 1
removed.temperature = min((removed.temperature*heat_capacity + heating_power)/heat_capacity, 1000)
env.merge(removed)
/*
The receiver idles and receives messages from subspace-compatible radio equipment;
primarily headsets. They then just relay this information to all linked devices,
@@ -276,7 +221,6 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
use_power = 1
idle_power_usage = 30
machinetype = 1
heatgen = 0
circuitboard = "/obj/item/weapon/circuitboard/telecomms/receiver"
/obj/machinery/telecomms/receiver/receive_signal(datum/signal/signal)
@@ -333,7 +277,6 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
use_power = 1
idle_power_usage = 80
machinetype = 7
heatgen = 40
circuitboard = "/obj/item/weapon/circuitboard/telecomms/hub"
long_range_link = 1
netspeed = 40
@@ -368,7 +311,6 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
use_power = 1
idle_power_usage = 30
machinetype = 8
heatgen = 0
circuitboard = "/obj/item/weapon/circuitboard/telecomms/relay"
netspeed = 5
long_range_link = 1
@@ -420,7 +362,6 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
use_power = 1
idle_power_usage = 50
machinetype = 2
heatgen = 20
circuitboard = "/obj/item/weapon/circuitboard/telecomms/bus"
netspeed = 40
var/change_frequency = 0
@@ -473,8 +414,6 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
use_power = 1
idle_power_usage = 30
machinetype = 3
heatgen = 100
delay = 5
circuitboard = "/obj/item/weapon/circuitboard/telecomms/processor"
var/process_mode = 1 // 1 = Uncompress Signals, 0 = Compress Signals
@@ -512,7 +451,6 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
use_power = 1
idle_power_usage = 15
machinetype = 4
heatgen = 50
circuitboard = "/obj/item/weapon/circuitboard/telecomms/server"
var/list/log_entries = list()
var/list/stored_names = list()