mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-21 20:13:45 +01:00
Too remove potential excessive garbage collection per tick. We will be reusing lists for overlays instead of deleting and creating them.
the .Cut() proc on a list will empty a list by default. This also will set the len to 0. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5465 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -216,7 +216,7 @@
|
||||
C.monkeyizing = 1
|
||||
C.canmove = 0
|
||||
C.icon = null
|
||||
C.overlays = null
|
||||
C.overlays.Cut()
|
||||
C.invisibility = 101
|
||||
|
||||
var/atom/movable/overlay/animation = new /atom/movable/overlay( C.loc )
|
||||
@@ -290,7 +290,7 @@
|
||||
C.monkeyizing = 1
|
||||
C.canmove = 0
|
||||
C.icon = null
|
||||
C.overlays = null
|
||||
C.overlays.Cut()
|
||||
C.invisibility = 101
|
||||
var/atom/movable/overlay/animation = new /atom/movable/overlay( C.loc )
|
||||
animation.icon_state = "blank"
|
||||
|
||||
@@ -540,7 +540,7 @@ ________________________________________________________________________________
|
||||
playsound(P.loc, 'sound/machines/twobeep.ogg', 50, 1)
|
||||
for (var/mob/O in hearers(3, P.loc))
|
||||
O.show_message(text("\icon[P] *[P.ttone]*"))
|
||||
P.overlays = null
|
||||
P.overlays.Cut()
|
||||
P.overlays += image('icons/obj/pda.dmi', "pda-r")
|
||||
|
||||
if("Inject")
|
||||
|
||||
@@ -510,7 +510,7 @@
|
||||
return
|
||||
|
||||
mode = 1
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
|
||||
load.loc = src.loc
|
||||
load.pixel_y -= 9
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
|
||||
if(chargelevel != newlevel)
|
||||
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
overlays += "ccharger-o[newlevel]"
|
||||
|
||||
chargelevel = newlevel
|
||||
else
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
examine()
|
||||
set src in oview(5)
|
||||
..()
|
||||
|
||||
@@ -249,7 +249,7 @@ That prevents a few funky behaviors.
|
||||
A.loc = T.loc//To replace the terminal.
|
||||
C.icon_state = "aicard"
|
||||
C.name = "inteliCard"
|
||||
C.overlays = null
|
||||
C.overlays.Cut()
|
||||
A.cancel_camera()
|
||||
A << "You have been uploaded to a stationary terminal. Remote device connection restored."
|
||||
U << "\blue <b>Transfer successful</b>: \black [A.name] ([rand(1000,9999)].exe) installed and executed succesfully. Local copy has been removed."
|
||||
@@ -276,7 +276,7 @@ That prevents a few funky behaviors.
|
||||
else for(var/mob/living/silicon/ai/A in C)
|
||||
C.icon_state = "aicard"
|
||||
C.name = "inteliCard"
|
||||
C.overlays = null
|
||||
C.overlays.Cut()
|
||||
A.loc = T
|
||||
T.occupant = A
|
||||
A.control_disabled = 1
|
||||
@@ -372,7 +372,7 @@ That prevents a few funky behaviors.
|
||||
A_T.loc = T//Throw them into suit.
|
||||
C.icon_state = "aicard"
|
||||
C.name = "inteliCard"
|
||||
C.overlays = null
|
||||
C.overlays.Cut()
|
||||
T.AI = A_T
|
||||
A_T.cancel_camera()
|
||||
A_T << "You have been uploaded to a mobile storage device."
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
..()
|
||||
// Broken / Unpowered
|
||||
if((stat & BROKEN) || (stat & NOPOWER))
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
|
||||
// Working / Powered
|
||||
else
|
||||
|
||||
@@ -452,7 +452,7 @@
|
||||
var/mob/living/carbon/human/H = customrecepient.loc
|
||||
H << "\icon[customrecepient] <b>Message from [customsender] ([customjob]), </b>\"[custommessage]\" (<a href='byond://?src=\ref[src];choice=Message;skiprefresh=1;target=\ref[src]'>Reply</a>)"
|
||||
log_pda("[usr] (PDA: [customsender]) sent \"[custommessage]\" to [customrecepient.owner]")
|
||||
customrecepient.overlays = null
|
||||
customrecepient.overlays.Cut()
|
||||
customrecepient.overlays += image('icons/obj/pda.dmi', "pda-r")
|
||||
//Sender is faking as someone who exists
|
||||
else
|
||||
@@ -466,7 +466,7 @@
|
||||
var/mob/living/carbon/human/H = customrecepient.loc
|
||||
H << "\icon[customrecepient] <b>Message from [PDARec.owner] ([customjob]), </b>\"[custommessage]\" (<a href='byond://?src=\ref[customrecepient];choice=Message;skiprefresh=1;target=\ref[PDARec]'>Reply</a>)"
|
||||
log_pda("[usr] (PDA: [PDARec.owner]) sent \"[custommessage]\" to [customrecepient.owner]")
|
||||
customrecepient.overlays = null
|
||||
customrecepient.overlays.Cut()
|
||||
customrecepient.overlays += image('icons/obj/pda.dmi', "pda-r")
|
||||
//Finally..
|
||||
ResetMessage()
|
||||
|
||||
@@ -641,7 +641,7 @@ About the new airlock wires panel:
|
||||
source.thermal_conductivity = initial(source.thermal_conductivity)
|
||||
|
||||
/obj/machinery/door/airlock/update_icon()
|
||||
if(overlays) overlays = null
|
||||
if(overlays) overlays.Cut()
|
||||
if(density)
|
||||
if(locked && lights)
|
||||
icon_state = "door_locked"
|
||||
@@ -661,14 +661,14 @@ About the new airlock wires panel:
|
||||
/obj/machinery/door/airlock/animate(animation)
|
||||
switch(animation)
|
||||
if("opening")
|
||||
if(overlays) overlays = null
|
||||
if(overlays) overlays.Cut()
|
||||
if(p_open)
|
||||
spawn(2) // The only work around that works. Downside is that the door will be gone for a millisecond.
|
||||
flick("o_door_opening", src) //can not use flick due to BYOND bug updating overlays right before flicking
|
||||
else
|
||||
flick("door_opening", src)
|
||||
if("closing")
|
||||
if(overlays) overlays = null
|
||||
if(overlays) overlays.Cut()
|
||||
if(p_open)
|
||||
flick("o_door_closing", src)
|
||||
else
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
// Adds an icon in case the screen is broken/off, stolen from status_display.dm
|
||||
proc/set_picture(var/state)
|
||||
picture_state = state
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
overlays += image('icons/obj/status_display.dmi', icon_state=picture_state)
|
||||
|
||||
|
||||
@@ -227,10 +227,10 @@
|
||||
// Stolen from status_display
|
||||
proc/update_display(var/line1, var/line2)
|
||||
if(line2 == null) // single line display
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
overlays += texticon(line1, 23, -13)
|
||||
else // dual line display
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
overlays += texticon(line1, 23, -9)
|
||||
overlays += texticon(line2, 23, -17)
|
||||
// return an icon of a time text string (tn)
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
|
||||
update_icon()
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
if(density)
|
||||
icon_state = "door_closed"
|
||||
if(blocked)
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
|
||||
if (!src.anchored)
|
||||
user.show_message(text("\red [src] can now be moved."))
|
||||
src.overlays = null
|
||||
src.overlays.Cut()
|
||||
|
||||
else if (src.anchored)
|
||||
user.show_message(text("\red [src] is now secured."))
|
||||
|
||||
@@ -151,7 +151,7 @@ obj/machinery/hydroponics/process()
|
||||
|
||||
obj/machinery/hydroponics/proc/updateicon()
|
||||
//Refreshes the icon and sets the luminosity
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
if(planted)
|
||||
if(dead)
|
||||
overlays += image('icons/obj/hydroponics.dmi', icon_state="[myseed.species]-dead")
|
||||
@@ -1017,7 +1017,7 @@ obj/machinery/hydroponics/attackby(var/obj/item/O as obj, var/mob/user as mob)
|
||||
use_power = 0
|
||||
|
||||
updateicon() // Same as normal but with the overlays removed - Cheridan.
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
if(planted)
|
||||
if(dead)
|
||||
overlays += image('icons/obj/hydroponics.dmi', icon_state="[myseed.species]-dead")
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
src.overlays += image('icons/obj/kitchen.dmi', "grjam")
|
||||
|
||||
/obj/machinery/gibber/update_icon()
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
if (dirty)
|
||||
src.overlays += image('icons/obj/kitchen.dmi', "grbloody")
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
|
||||
@@ -114,11 +114,11 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co
|
||||
if(!ispowered || isbroken)
|
||||
icon_state = "newscaster_off"
|
||||
if(isbroken) //If the thing is smashed, add crack overlay on top of the unpowered sprite.
|
||||
src.overlays = null
|
||||
src.overlays.Cut()
|
||||
src.overlays += image(src.icon, "crack3")
|
||||
return
|
||||
|
||||
src.overlays = null //reset overlays
|
||||
src.overlays.Cut() //reset overlays
|
||||
|
||||
if(news_network.wanted_issue) //wanted icon state, there can be no overlays on it as it's a priority message
|
||||
icon_state = "newscaster_wanted"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
return
|
||||
|
||||
update_icon()
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
icon_state = "sheater[on]"
|
||||
if(open)
|
||||
overlays += "sheater-open"
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
process()
|
||||
if(stat & NOPOWER)
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
return
|
||||
|
||||
update()
|
||||
@@ -68,7 +68,7 @@
|
||||
return
|
||||
|
||||
if(mode==0)
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
return
|
||||
|
||||
if(mode==3) // alert picture, no change
|
||||
@@ -89,7 +89,7 @@
|
||||
update_display(displayloc, displaytime)
|
||||
return
|
||||
else
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
return
|
||||
|
||||
if(mode==4) // supply shuttle timer
|
||||
@@ -160,7 +160,7 @@
|
||||
|
||||
proc/set_picture(var/state)
|
||||
picture_state = state
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
overlays += image('icons/obj/status_display.dmi', icon_state=picture_state)
|
||||
|
||||
proc/update_display(var/line1, var/line2)
|
||||
@@ -172,11 +172,11 @@
|
||||
lastdisplayline2 = line2
|
||||
|
||||
if(line2 == null) // single line display
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
overlays += texticon(line1, 23, -13)
|
||||
else // dual line display
|
||||
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
overlays += texticon(line1, 23, -9)
|
||||
overlays += texticon(line2, 23, -17)
|
||||
|
||||
@@ -272,7 +272,7 @@
|
||||
|
||||
process()
|
||||
if(stat & NOPOWER)
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
return
|
||||
|
||||
update()
|
||||
@@ -287,7 +287,7 @@
|
||||
proc/update()
|
||||
|
||||
if(mode==0) //Blank
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
return
|
||||
|
||||
if(mode==1) // AI emoticon
|
||||
@@ -328,5 +328,5 @@
|
||||
|
||||
proc/set_picture(var/state)
|
||||
picture_state = state
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
overlays += image('icons/obj/status_display.dmi', icon_state=picture_state)
|
||||
|
||||
@@ -143,7 +143,7 @@
|
||||
else if(istype(W, /obj/item/weapon/screwdriver))
|
||||
src.panel_open = !src.panel_open
|
||||
user << "You [src.panel_open ? "open" : "close"] the maintenance panel."
|
||||
src.overlays = null
|
||||
src.overlays.Cut()
|
||||
if(src.panel_open)
|
||||
src.overlays += image(src.icon, "[initial(icon_state)]-panel")
|
||||
src.updateUsrDialog()
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
else if(istype(W, /obj/item/weapon/wirecutters))
|
||||
user << "You cut the tag off the bodybag"
|
||||
src.name = "body bag"
|
||||
src.overlays = null
|
||||
src.overlays.Cut()
|
||||
return
|
||||
|
||||
|
||||
|
||||
@@ -682,7 +682,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
//EXTRA FUNCTIONS===================================
|
||||
|
||||
if (mode == 2||mode == 21)//To clear message overlays.
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
|
||||
if ((honkamt > 0) && (prob(60)))//For clown virus.
|
||||
honkamt--
|
||||
@@ -781,7 +781,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
L << "\icon[P] <b>Message from [src.owner] ([ownjob]), </b>\"[t]\" (<a href='byond://?src=\ref[P];choice=Message;skiprefresh=1;target=\ref[src]'>Reply</a>)"
|
||||
|
||||
log_pda("[usr] (PDA: [src.name]) sent \"[t]\" to [P.name]")
|
||||
P.overlays = null
|
||||
P.overlays.Cut()
|
||||
P.overlays += image('icons/obj/pda.dmi', "pda-r")
|
||||
else
|
||||
U << "<span class='notice'>ERROR: Server isn't responding.</span>"
|
||||
|
||||
@@ -110,12 +110,12 @@
|
||||
|
||||
/obj/item/device/paicard/proc/removePersonality()
|
||||
src.pai = null
|
||||
src.overlays = null
|
||||
src.overlays.Cut()
|
||||
src.overlays += "pai-off"
|
||||
|
||||
/obj/item/device/paicard/proc/setEmotion(var/emotion)
|
||||
if(pai)
|
||||
src.overlays = null
|
||||
src.overlays.Cut()
|
||||
switch(emotion)
|
||||
if(1) src.overlays += "pai-happy"
|
||||
if(2) src.overlays += "pai-cat"
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
toggle = 1
|
||||
|
||||
/obj/item/device/transfer_valve/update_icon()
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
underlays = null
|
||||
|
||||
if(!tank_one && !tank_two && !attached_device)
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
src.updateicon()
|
||||
|
||||
/obj/item/robot_parts/robot_suit/proc/updateicon()
|
||||
src.overlays = null
|
||||
src.overlays.Cut()
|
||||
if(src.l_arm)
|
||||
src.overlays += "l_arm+o"
|
||||
if(src.r_arm)
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
if (istype(W, /obj/item/weapon/weldingtool))
|
||||
var/obj/item/weapon/weldingtool/WT = W
|
||||
if(WT.remove_fuel(0, user))
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
usr << "You slice off [src]'s uneven chunks of aluminum and scorch marks."
|
||||
return
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
|
||||
|
||||
update_icon()
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
if(focus && focus.icon && focus.icon_state)
|
||||
overlays += icon(focus.icon,focus.icon_state)
|
||||
return
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
|
||||
/obj/item/weapon/flamethrower/update_icon()
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
if(igniter)
|
||||
overlays += "+igniter[status]"
|
||||
if(ptank)
|
||||
|
||||
@@ -222,7 +222,7 @@
|
||||
/obj/item/weapon/tray/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
|
||||
|
||||
// Drop all the things. All of them.
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
for(var/obj/item/I in carrying)
|
||||
I.loc = M.loc
|
||||
carrying.Remove(I)
|
||||
@@ -391,7 +391,7 @@
|
||||
foundtable = 1
|
||||
break
|
||||
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
|
||||
for(var/obj/item/I in carrying)
|
||||
I.loc = loc
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
emagged = 1
|
||||
src.overlays += image('icons/obj/storage.dmi', icon_sparking)
|
||||
sleep(6)
|
||||
src.overlays = null
|
||||
src.overlays.Cut()
|
||||
overlays += image('icons/obj/storage.dmi', icon_locking)
|
||||
locked = 0
|
||||
if(istype(W, /obj/item/weapon/melee/energy/blade))
|
||||
@@ -225,7 +225,7 @@
|
||||
src.l_set = 1
|
||||
else if ((src.code == src.l_code) && (src.emagged == 0) && (src.l_set == 1))
|
||||
src.locked = 0
|
||||
src.overlays = null
|
||||
src.overlays.Cut()
|
||||
overlays += image('icons/obj/storage.dmi', icon_opened)
|
||||
src.code = null
|
||||
else
|
||||
@@ -233,7 +233,7 @@
|
||||
else
|
||||
if ((href_list["type"] == "R") && (src.emagged == 0) && (!src.l_setshort))
|
||||
src.locked = 1
|
||||
src.overlays = null
|
||||
src.overlays.Cut()
|
||||
src.code = null
|
||||
src.close(usr)
|
||||
else
|
||||
|
||||
@@ -275,7 +275,7 @@
|
||||
usr << "<span class='warning'>This mob type can't use this verb.</span>"
|
||||
|
||||
/obj/structure/closet/update_icon()//Putting the welded stuff in updateicon() so it's easy to overwrite for special cases (Fridges, cabinets, and whatnot)
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
if(!opened)
|
||||
icon_state = icon_closed
|
||||
if(welded)
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
usr << "<span class='warning'>This mob type can't use this verb.</span>"
|
||||
|
||||
/obj/structure/closet/secure_closet/update_icon()//Putting the welded stuff in updateicon() so it's easy to overwrite for special cases (Fridges, cabinets, and whatnot)
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
if(!opened)
|
||||
if(locked)
|
||||
icon_state = icon_locked
|
||||
|
||||
@@ -211,10 +211,10 @@
|
||||
/obj/structure/closet/crate/secure/New()
|
||||
..()
|
||||
if(locked)
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
overlays += redlight
|
||||
else
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
overlays += greenlight
|
||||
|
||||
/obj/structure/closet/crate/rcd/New()
|
||||
@@ -287,7 +287,7 @@
|
||||
if (allowed(user))
|
||||
user << "<span class='notice'>You unlock [src].</span>"
|
||||
src.locked = 0
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
overlays += greenlight
|
||||
return
|
||||
else
|
||||
@@ -300,11 +300,11 @@
|
||||
if(istype(W, /obj/item/weapon/card) && src.allowed(user) && !locked && !opened && !broken)
|
||||
user << "<span class='notice'>You lock \the [src].</span>"
|
||||
src.locked = 1
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
overlays += redlight
|
||||
return
|
||||
else if ( (istype(W, /obj/item/weapon/card/emag)||istype(W, /obj/item/weapon/melee/energy/blade)) && locked &&!broken)
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
overlays += emag
|
||||
overlays += sparks
|
||||
spawn(6) overlays -= sparks //Tried lots of stuff but nothing works right. so i have to use this *sadface*
|
||||
@@ -357,10 +357,10 @@
|
||||
if(!broken && !opened && prob(50/severity))
|
||||
if(!locked)
|
||||
src.locked = 1
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
overlays += redlight
|
||||
else
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
overlays += emag
|
||||
overlays += sparks
|
||||
spawn(6) overlays -= sparks //Tried lots of stuff but nothing works right. so i have to use this *sadface*
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
/obj/structure/stool/bed/chair/e_chair/rotate()
|
||||
..()
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
overlays += image('icons/obj/objects.dmi', src, "echair_over", MOB_LAYER + 1, dir) //there's probably a better way of handling this, but eh. -Pete
|
||||
return
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
|
||||
/obj/structure/dispenser/update_icon()
|
||||
overlays = null
|
||||
overlays.Cut()
|
||||
switch(oxygentanks)
|
||||
if(1 to 3) overlays += "oxygen-[oxygentanks]"
|
||||
if(4 to INFINITY) overlays += "oxygen-4"
|
||||
|
||||
@@ -165,7 +165,7 @@
|
||||
user.visible_message("<span class='notice'>[user] adjusts the shower with the [I].</span>", "<span class='notice'>You adjust the shower with the [I].</span>")
|
||||
|
||||
/obj/machinery/shower/update_icon() //this is terribly unreadable, but basically it makes the shower mist up
|
||||
overlays = null //once it's been on for a while, in addition to handling the water overlay.
|
||||
overlays.Cut() //once it's been on for a while, in addition to handling the water overlay.
|
||||
if(mymist)
|
||||
del(mymist)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user