-Killed the updateDialog lag. I added a check to see if there were any mobs to update, if not it will stop checking until a user uses the machine again. I had to replace all the machine = src and machine = null with procs to help make it manageable. I believe this is one of the culprits causing the server to lag as the round goes on, as more players will interact with machines.

-Atmos delay is now based on active players, to help fight lag for massive player rounds.

-Changed some for(blah in world) loops to use the correct lists.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4958 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
giacomand@gmail.com
2012-10-25 19:15:51 +00:00
parent 2063c3715d
commit 6a2d78bc94
156 changed files with 403 additions and 367 deletions
+4 -4
View File
@@ -263,10 +263,10 @@
/obj/machinery/power/am_control_unit/proc/interact(mob/user)
if((get_dist(src, user) > 1) || (stat & (BROKEN|NOPOWER)))
if(!istype(user, /mob/living/silicon/ai))
user.machine = null
user.unset_machine()
user << browse(null, "window=AMcontrol")
return
user.machine = src
user.set_machine(src)
var/dat = ""
dat += "AntiMatter Control Panel<BR>"
@@ -303,13 +303,13 @@
..()
//Ignore input if we are broken or guy is not touching us, AI can control from a ways away
if(stat & (BROKEN|NOPOWER) || (get_dist(src, usr) > 1 && !istype(usr, /mob/living/silicon/ai)))
usr.machine = null
usr.unset_machine()
usr << browse(null, "window=AMcontrol")
return
if(href_list["close"])
usr << browse(null, "window=AMcontrol")
usr.machine = null
usr.unset_machine()
return
if(href_list["togglestatus"])
+12 -16
View File
@@ -86,11 +86,7 @@
/obj/machinery/power/apc/updateDialog()
if (stat & (BROKEN|MAINT))
return
var/list/nearby = viewers(1, src)
for(var/mob/M in nearby)
if (M.client && M.machine == src)
src.interact(M)
AutoUpdateAI(src)
..()
/obj/machinery/power/apc/New(turf/loc, var/ndir, var/building=0)
..()
@@ -463,7 +459,7 @@
call(/obj/item/clothing/gloves/space_ninja/proc/drain)("APC",src,user:wear_suit)
return
// do APC interaction
user.machine = src
user.set_machine(src)
src.interact(user)
/obj/machinery/power/apc/attack_alien(mob/living/carbon/alien/humanoid/user)
@@ -513,24 +509,24 @@
user << browse(t1, "window=apcwires")
onclose(user, "apcwires")
user.machine = src
user.set_machine(src)
var/t = "<html><head><title>[area.name] APC</title></head><body><TT><B>Area Power Controller</B> ([area.name])<HR>"
//This goes after the wire stuff. They should be able to fix a physical problem when a wire is cut
if ( (get_dist(src, user) > 1 ))
if (!istype(user, /mob/living/silicon))
user.machine = null
user.unset_machine()
user << browse(null, "window=apc")
return
else if (istype(user, /mob/living/silicon) && src.aidisabled && !src.malfhack)
user << "AI control for this APC interface has been disabled."
user.machine = null
user.unset_machine()
user << browse(null, "window=apc")
return
else if (src.malfai)
if ((src.malfai != user && src.malfai != user:parent) && !islinked(user, malfai))
user << "AI control for this APC interface has been disabled."
user.machine = null
user.unset_machine()
user << browse(null, "window=apc")
return
@@ -748,7 +744,7 @@
istype(user, /mob/living/carbon/monkey) /*&& ticker && ticker.mode.name == "monkey"*/) )
user << "\red You don't have the dexterity to use this [src]!"
user << browse(null, "window=apc")
user.machine = null
user.unset_machine()
return 0
if(user.restrained())
user << "\red You must have free hands to use this [src]"
@@ -770,12 +766,12 @@
if(!loud)
user << "\red \The [src] have AI control disabled!"
user << browse(null, "window=apc")
user.machine = null
user.unset_machine()
return 0
else
if ((!in_range(src, user) || !istype(src.loc, /turf)))
user << browse(null, "window=apc")
user.machine = null
user.unset_machine()
return 0
var/mob/living/carbon/human/H = user
@@ -794,7 +790,7 @@
if(!can_use(usr, 1))
return
src.add_fingerprint(usr)
usr.machine = src
usr.set_machine(src)
if (href_list["apcwires"])
var/t1 = text2num(href_list["apcwires"])
if (!( istype(usr.get_active_hand(), /obj/item/weapon/wirecutters) ))
@@ -857,11 +853,11 @@
update()
else if( href_list["close"] )
usr << browse(null, "window=apc")
usr.machine = null
usr.unset_machine()
return
else if (href_list["close2"])
usr << browse(null, "window=apcwires")
usr.machine = null
usr.unset_machine()
return
else if (href_list["overload"])
+3 -3
View File
@@ -123,11 +123,11 @@
/obj/machinery/power/generator/proc/interact(mob/user)
if ( (get_dist(src, user) > 1 ) && (!istype(user, /mob/living/silicon/ai)))
user.machine = null
user.unset_machine()
user << browse(null, "window=teg")
return
user.machine = src
user.set_machine(src)
var/t = "<PRE><B>Thermo-Electric Generator</B><HR>"
@@ -153,7 +153,7 @@
..()
if( href_list["close"] )
usr << browse(null, "window=teg")
usr.machine = null
usr.unset_machine()
return 0
return 1
+3 -3
View File
@@ -100,11 +100,11 @@
/obj/machinery/power/generator_type2/proc/interact(mob/user)
if ( (get_dist(src, user) > 1 ) && (!istype(user, /mob/living/silicon/ai)))
user.machine = null
user.unset_machine()
user << browse(null, "window=teg")
return
user.machine = src
user.set_machine(src)
var/t = "<PRE><B>Thermo-Electric Generator</B><HR>"
@@ -131,7 +131,7 @@
if( href_list["close"] )
usr << browse(null, "window=teg")
usr.machine = null
usr.unset_machine()
return 0
return 1
+2 -2
View File
@@ -71,7 +71,7 @@
return attack_hand(user)
/obj/machinery/computer/gravity_control_computer/attack_hand(mob/user as mob)
user.machine = src
user.set_machine(src)
add_fingerprint(user)
if(stat & (BROKEN|NOPOWER))
@@ -118,7 +118,7 @@
if ( (get_dist(src, usr) > 1 ))
if (!istype(usr, /mob/living/silicon))
usr.machine = null
usr.unset_machine()
usr << browse(null, "window=air_alarm")
return
+3 -3
View File
@@ -239,11 +239,11 @@ display round(lastgen) and plasmatank amount
/obj/machinery/power/port_gen/pacman/proc/interact(mob/user)
if (get_dist(src, user) > 1 )
if (!istype(user, /mob/living/silicon/ai))
user.machine = null
user.unset_machine()
user << browse(null, "window=port_gen")
return
user.machine = src
user.set_machine(src)
var/dat = text("<b>[name]</b><br>")
if (active)
@@ -284,7 +284,7 @@ display round(lastgen) and plasmatank amount
src.updateUsrDialog()
if (href_list["action"] == "close")
usr << browse(null, "window=port_gen")
usr.machine = null
usr.unset_machine()
/obj/machinery/power/port_gen/pacman/super
name = "S.U.P.E.R.P.A.C.M.A.N.-type Portable Generator"
@@ -70,13 +70,13 @@
..()
//Ignore input if we are broken, !silicon guy cant touch us, or nonai controlling from super far away
if(stat & (BROKEN|NOPOWER) || (get_dist(src, usr) > 1 && !istype(usr, /mob/living/silicon)) || (get_dist(src, usr) > 8 && !istype(usr, /mob/living/silicon/ai)))
usr.machine = null
usr.unset_machine()
usr << browse(null, "window=pacontrol")
return
if( href_list["close"] )
usr << browse(null, "window=pacontrol")
usr.machine = null
usr.unset_machine()
return
if(href_list["togglep"])
src.toggle_power()
@@ -205,10 +205,10 @@
/obj/machinery/particle_accelerator/control_box/proc/interact(mob/user)
if((get_dist(src, user) > 1) || (stat & (BROKEN|NOPOWER)))
if(!istype(user, /mob/living/silicon))
user.machine = null
user.unset_machine()
user << browse(null, "window=pacontrol")
return
user.machine = src
user.set_machine(src)
var/dat = ""
dat += "Particle Accelerator Control Panel<BR>"
+4 -4
View File
@@ -180,11 +180,11 @@
/obj/machinery/power/smes/proc/interact(mob/user)
if(get_dist(src, user) > 1 && !istype(user, /mob/living/silicon/ai))
user.machine = null
user.unset_machine()
user << browse(null, "window=smes")
return
user.machine = src
user.set_machine(src)
var/t = "<TT><B>SMES Power Storage Unit</B> [n_tag? "([n_tag])" : null]<HR><PRE>"
@@ -228,7 +228,7 @@
if( href_list["close"] )
usr << browse(null, "window=smes")
usr.machine = null
usr.unset_machine()
return
else if( href_list["cmode"] )
@@ -299,7 +299,7 @@
else
usr << browse(null, "window=smes")
usr.machine = null
usr.unset_machine()
return
+4 -4
View File
@@ -276,12 +276,12 @@
if(stat & (BROKEN | NOPOWER)) return
if ( (get_dist(src, user) > 1 ))
if (!istype(user, /mob/living/silicon/ai))
user.machine = null
user.unset_machine()
user << browse(null, "window=solcon")
return
add_fingerprint(user)
user.machine = src
user.set_machine(src)
var/t = "<TT><B>Solar Generator Control</B><HR><PRE>"
t += "Generated power : [round(lastgen)] W<BR><BR>"
@@ -306,11 +306,11 @@
Topic(href, href_list)
if(..())
usr << browse(null, "window=solcon")
usr.machine = null
usr.unset_machine()
return
if(href_list["close"] )
usr << browse(null, "window=solcon")
usr.machine = null
usr.unset_machine()
return
if(href_list["dir"])