Reversions and fixes (#7889)

Co-authored-by: Selis <selis@xynolabs.com>
This commit is contained in:
Raeschen
2024-03-06 18:20:29 +01:00
committed by GitHub
parent c277710a50
commit e29b9d4d35
37 changed files with 254 additions and 203 deletions

View File

@@ -328,6 +328,7 @@ GLOBAL_LIST_EMPTY(mannequins)
//Hexidecimal numbers
var/global/list/hexNums = list("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F")
/*
// Many global vars aren't GLOB type. This puts them there to be more easily inspected.
GLOBAL_LIST_EMPTY(legacy_globals)
@@ -357,3 +358,4 @@ GLOBAL_LIST_EMPTY(legacy_globals)
GLOB.legacy_globals["cultnet"] = cultnet
GLOB.legacy_globals["item_tf_spawnpoints"] = item_tf_spawnpoints
GLOB.legacy_globals["existing_solargrubs"] = existing_solargrubs
*/

View File

@@ -134,7 +134,8 @@ Proc for attack log creation, because really why not
target.attack_log += text("\[[time_stamp()]\] [span_orange("Attacked by [user_str]: [what_done]")]")
var/datum/db_query/query_insert = SSdbcore.NewQuery("INSERT INTO erro_attacklog (id, time, ckey, mob, message) VALUES (null, NOW(), :t_ckey, :t_mob, :t_content)", list("t_ckey" = target.ckey, "t_mob" = target.real_name, "t_content" = "<font color='orange'>Attacked by [user_str]: [what_done]</font>"))
spawn() //Change this to a spawn so it doesn't hold us up
query_insert.Execute(async=use_async)
if(query_insert)
query_insert.Execute(async=use_async)
qdel(query_insert)
//if(SSdbcore.Connect())
// rustg_sql_query_async(SSdbcore.connection, "INSERT INTO erro_attacklog (id, time, ckey, mob, message) VALUES (null, NOW(), :t_ckey, :t_mob, :t_content)", json_encode(list("t_ckey" = target.ckey, "t_mob" = target.real_name, "t_content" = "<font color='orange'>Attacked by [user_str]: [what_done]</font>")))

View File

@@ -8,7 +8,7 @@
if(toIndex <= 0)
toIndex += L.len + 1
var/datum/sortInstance/SI = GLOB.sortInstance
var/datum/sort_instance/SI = GLOB.sortInstance
if(!SI)
SI = new
@@ -17,5 +17,4 @@
SI.associative = associative
SI.timSort(fromIndex, toIndex)
return L

View File

@@ -9,8 +9,8 @@
#define MIN_GALLOP 7
//This is a global instance to allow much of this code to be reused. The interfaces are kept separately
GLOBAL_DATUM_INIT(sortInstance, /datum/sortInstance, new()) //ChompEDIT
/datum/sortInstance
GLOBAL_DATUM_INIT(sortInstance, /datum/sort_instance, new())
/datum/sort_instance
//The array being sorted.
var/list/L
@@ -20,19 +20,18 @@ GLOBAL_DATUM_INIT(sortInstance, /datum/sortInstance, new()) //ChompEDIT
//whether we are sorting list keys (0: L[i]) or associated values (1: L[L[i]])
var/associative = 0
//This controls when we get *into* galloping mode. It is initialized to MIN_GALLOP.
//This controls when we get *into* galloping mode. It is initialized to MIN_GALLOP.
//The mergeLo and mergeHi methods nudge it higher for random data, and lower for highly structured data.
var/minGallop = MIN_GALLOP
//Stores information regarding runs yet to be merged.
//Run i starts at runBase[i] and extends for runLen[i] elements.
//runBase[i] + runLen[i] == runBase[i+1]
//var/stackSize
var/list/runBases = list()
var/list/runLens = list()
/datum/sortInstance/proc/timSort(start, end)
/datum/sort_instance/proc/timSort(start, end)
runBases.Cut()
runLens.Cut()
@@ -83,21 +82,21 @@ GLOBAL_DATUM_INIT(sortInstance, /datum/sortInstance, new()) //ChompEDIT
return L
/*
Sorts the specified portion of the specified array using a binary
insertion sort. This is the best method for sorting small numbers
of elements. It requires O(n log n) compares, but O(n^2) data
movement (worst case).
/*
Sorts the specified portion of the specified array using a binary
insertion sort. This is the best method for sorting small numbers
of elements. It requires O(n log n) compares, but O(n^2) data
movement (worst case).
If the initial part of the specified range is already sorted,
this method can take advantage of it: the method assumes that the
elements in range [lo,start) are already sorted
If the initial part of the specified range is already sorted,
this method can take advantage of it: the method assumes that the
elements in range [lo,start) are already sorted
lo the index of the first element in the range to be sorted
hi the index after the last element in the range to be sorted
start the index of the first element in the range that is not already known to be sorted
*/
/datum/sortInstance/proc/binarySort(lo, hi, start)
lo the index of the first element in the range to be sorted
hi the index after the last element in the range to be sorted
start the index of the first element in the range that is not already known to be sorted
*/
/datum/sort_instance/proc/binarySort(lo, hi, start)
//ASSERT(lo <= start && start <= hi)
if(start <= lo)
start = lo + 1
@@ -114,34 +113,35 @@ start the index of the first element in the range that is not already known to b
//[lo, left) elements <= pivot < [right, start) elements
//in other words, find where the pivot element should go using bisection search
while(left < right)
var/mid = (left + right) >> 1 //round((left+right)/2)
var/mid = (left + right) >> 1 //round((left+right)/2)
if(call(cmp)(fetchElement(L,mid), pivot) > 0)
right = mid
else
left = mid+1
//ASSERT(left == right)
moveElement(L, start, left) //move pivot element to correct location in the sorted range
moveElement(L, start, left) //move pivot element to correct location in the sorted range
/*
Returns the length of the run beginning at the specified position and reverses the run if it is back-to-front
/*
Returns the length of the run beginning at the specified position and reverses the run if it is back-to-front
A run is the longest ascending sequence with:
a[lo] <= a[lo + 1] <= a[lo + 2] <= ...
or the longest descending sequence with:
a[lo] > a[lo + 1] > a[lo + 2] > ...
A run is the longest ascending sequence with:
a[lo] <= a[lo + 1] <= a[lo + 2] <= ...
or the longest descending sequence with:
a[lo] > a[lo + 1] > a[lo + 2] > ...
For its intended use in a stable mergesort, the strictness of the
definition of "descending" is needed so that the call can safely
reverse a descending sequence without violating stability.
*/
/datum/sortInstance/proc/countRunAndMakeAscending(lo, hi)
For its intended use in a stable mergesort, the strictness of the
definition of "descending" is needed so that the call can safely
reverse a descending sequence without violating stability.
*/
/datum/sort_instance/proc/countRunAndMakeAscending(lo, hi)
//ASSERT(lo < hi)
var/runHi = lo + 1
if(runHi >= hi)
return 1
var/list/L = src.L
var/last = fetchElement(L,lo)
var/current = fetchElement(L,runHi++)
@@ -163,22 +163,22 @@ reverse a descending sequence without violating stability.
return runHi - lo
//Returns the minimum acceptable run length for an array of the specified length.
//Natural runs shorter than this will be extended with binarySort
/datum/sortInstance/proc/minRunLength(n)
//Returns the minimum acceptable run length for an array of the specified length.
//Natural runs shorter than this will be extended with binarySort
/datum/sort_instance/proc/minRunLength(n)
//ASSERT(n >= 0)
var/r = 0 //becomes 1 if any bits are shifted off
var/r = 0 //becomes 1 if any bits are shifted off
while(n >= MIN_MERGE)
r |= (n & 1)
n >>= 1
return n + r
//Examines the stack of runs waiting to be merged and merges adjacent runs until the stack invariants are reestablished:
// runLen[i-3] > runLen[i-2] + runLen[i-1]
// runLen[i-2] > runLen[i-1]
//This method is called each time a new run is pushed onto the stack.
//So the invariants are guaranteed to hold for i<stackSize upon entry to the method
/datum/sortInstance/proc/mergeCollapse()
//Examines the stack of runs waiting to be merged and merges adjacent runs until the stack invariants are reestablished:
// runLen[i-3] > runLen[i-2] + runLen[i-1]
// runLen[i-2] > runLen[i-1]
//This method is called each time a new run is pushed onto the stack.
//So the invariants are guaranteed to hold for i<stackSize upon entry to the method
/datum/sort_instance/proc/mergeCollapse()
while(runBases.len >= 2)
var/n = runBases.len - 1
if(n > 1 && runLens[n-1] <= runLens[n] + runLens[n+1])
@@ -188,12 +188,12 @@ reverse a descending sequence without violating stability.
else if(runLens[n] <= runLens[n+1])
mergeAt(n)
else
break //Invariant is established
break //Invariant is established
//Merges all runs on the stack until only one remains.
//Called only once, to finalise the sort
/datum/sortInstance/proc/mergeForceCollapse()
//Merges all runs on the stack until only one remains.
//Called only once, to finalise the sort
/datum/sort_instance/proc/mergeForceCollapse()
while(runBases.len >= 2)
var/n = runBases.len - 1
if(n > 1 && runLens[n-1] < runLens[n+1])
@@ -201,10 +201,10 @@ reverse a descending sequence without violating stability.
mergeAt(n)
//Merges the two consecutive runs at stack indices i and i+1
//Run i must be the penultimate or antepenultimate run on the stack
//In other words, i must be equal to stackSize-2 or stackSize-3
/datum/sortInstance/proc/mergeAt(i)
//Merges the two consecutive runs at stack indices i and i+1
//Run i must be the penultimate or antepenultimate run on the stack
//In other words, i must be equal to stackSize-2 or stackSize-3
/datum/sort_instance/proc/mergeAt(i)
//ASSERT(runBases.len >= 2)
//ASSERT(i >= 1)
//ASSERT(i == runBases.len - 1 || i == runBases.len - 2)
@@ -223,7 +223,6 @@ reverse a descending sequence without violating stability.
runLens.Cut(i+1, i+2)
runBases.Cut(i+1, i+2)
//Find where the first element of run2 goes in run1.
//Prior elements in run1 can be ignored (because they're already in place)
var/k = gallopRight(fetchElement(L,base2), base1, len1, 0)
@@ -247,20 +246,21 @@ reverse a descending sequence without violating stability.
mergeHi(base1, len1, base2, len2)
/*
Locates the position to insert key within the specified sorted range
If the range contains elements equal to key, this will return the index of the LEFTMOST of those elements
/*
Locates the position to insert key within the specified sorted range
If the range contains elements equal to key, this will return the index of the LEFTMOST of those elements
key the element to be inserted into the sorted range
base the index of the first element of the sorted range
len the length of the sorted range, must be greater than 0
hint the offset from base at which to begin the search, such that 0 <= hint < len; i.e. base <= hint < base+hint
key the element to be inserted into the sorted range
base the index of the first element of the sorted range
len the length of the sorted range, must be greater than 0
hint the offset from base at which to begin the search, such that 0 <= hint < len; i.e. base <= hint < base+hint
Returns the index at which to insert element 'key'
*/
/datum/sortInstance/proc/gallopLeft(key, base, len, hint)
Returns the index at which to insert element 'key'
*/
/datum/sort_instance/proc/gallopLeft(key, base, len, hint)
//ASSERT(len > 0 && hint >= 0 && hint < len)
var/list/L = src.L
var/lastOffset = 0
var/offset = 1
if(call(cmp)(key, fetchElement(L,base+hint)) > 0)
@@ -304,31 +304,30 @@ reverse a descending sequence without violating stability.
//ASSERT(lastOffset == offset)
return offset
/**
* Like gallopLeft, except that if the range contains an element equal to
* key, gallopRight returns the index after the rightmost equal element.
*
* @param key the key whose insertion point to search for
* @param a the array in which to search
* @param base the index of the first element in the range
* @param len the length of the range; must be > 0
* @param hint the index at which to begin the search, 0 <= hint < n.
* The closer hint is to the result, the faster this method will run.
* @param c the comparator used to order the range, and to search
* @return the int k, 0 <= k <= n such that a[b + k - 1] <= key < a[b + k]
*/
/datum/sortInstance/proc/gallopRight(key, base, len, hint)
/**
* Like gallopLeft, except that if the range contains an element equal to
* key, gallopRight returns the index after the rightmost equal element.
*
* @param key the key whose insertion point to search for
* @param a the array in which to search
* @param base the index of the first element in the range
* @param len the length of the range; must be > 0
* @param hint the index at which to begin the search, 0 <= hint < n.
* The closer hint is to the result, the faster this method will run.
* @param c the comparator used to order the range, and to search
* @return the int k, 0 <= k <= n such that `a[b + k - 1] <= key < a[b + k]`
*/
/datum/sort_instance/proc/gallopRight(key, base, len, hint)
//ASSERT(len > 0 && hint >= 0 && hint < len)
var/list/L = src.L
var/offset = 1
var/lastOffset = 0
if(call(cmp)(key, fetchElement(L,base+hint)) < 0) //key <= L[base+hint]
var/maxOffset = hint + 1 //therefore we want to insert somewhere in the range [base,base+hint] = [base+,base+(hint+1))
while(offset < maxOffset && call(cmp)(key, fetchElement(L,base+hint-offset)) < 0) //we are iterating backwards
if(call(cmp)(key, fetchElement(L,base+hint)) < 0) //key <= L[base+hint]
var/maxOffset = hint + 1 //therefore we want to insert somewhere in the range [base,base+hint] = [base+,base+(hint+1))
while(offset < maxOffset && call(cmp)(key, fetchElement(L,base+hint-offset)) < 0) //we are iterating backwards
lastOffset = offset
offset = (offset << 1) + 1 //1 3 7 15
//if(offset <= 0) //int overflow, not an issue here since we are using floats
// offset = maxOffset
offset = (offset << 1) + 1 //1 3 7 15
if(offset > maxOffset)
offset = maxOffset
@@ -337,13 +336,11 @@ reverse a descending sequence without violating stability.
lastOffset = hint - offset
offset = hint - temp
else //key > L[base+hint]
var/maxOffset = len - hint //therefore we want to insert somewhere in the range (base+hint,base+len) = [base+hint+1, base+hint+(len-hint))
else //key > L[base+hint]
var/maxOffset = len - hint //therefore we want to insert somewhere in the range (base+hint,base+len) = [base+hint+1, base+hint+(len-hint))
while(offset < maxOffset && call(cmp)(key, fetchElement(L,base+hint+offset)) >= 0)
lastOffset = offset
offset = (offset << 1) + 1
//if(offset <= 0) //int overflow, not an issue here since we are using floats
// offset = maxOffset
if(offset > maxOffset)
offset = maxOffset
@@ -357,9 +354,9 @@ reverse a descending sequence without violating stability.
while(lastOffset < offset)
var/m = lastOffset + ((offset - lastOffset) >> 1)
if(call(cmp)(key, fetchElement(L,base+m)) < 0) //key <= L[base+m]
if(call(cmp)(key, fetchElement(L,base+m)) < 0) //key <= L[base+m]
offset = m
else //key > L[base+m]
else //key > L[base+m]
lastOffset = m + 1
//ASSERT(lastOffset == offset)
@@ -367,11 +364,12 @@ reverse a descending sequence without violating stability.
return offset
//Merges two adjacent runs in-place in a stable fashion.
//For performance this method should only be called when len1 <= len2!
/datum/sortInstance/proc/mergeLo(base1, len1, base2, len2)
//Merges two adjacent runs in-place in a stable fashion.
//For performance this method should only be called when len1 <= len2!
/datum/sort_instance/proc/mergeLo(base1, len1, base2, len2)
//ASSERT(len1 > 0 && len2 > 0 && base1 + len1 == base2)
var/list/L = src.L
var/cursor1 = base1
var/cursor2 = base2
@@ -391,8 +389,8 @@ reverse a descending sequence without violating stability.
outer:
while(1)
var/count1 = 0 //# of times in a row that first run won
var/count2 = 0 // " " " " " " second run won
var/count1 = 0 //# of times in a row that first run won
var/count2 = 0 // " " " " " " second run won
//do the straightfoward thin until one run starts winning consistently
@@ -471,10 +469,11 @@ reverse a descending sequence without violating stability.
//ASSERT(len1 > 1)
/datum/sortInstance/proc/mergeHi(base1, len1, base2, len2)
/datum/sort_instance/proc/mergeHi(base1, len1, base2, len2)
//ASSERT(len1 > 0 && len2 > 0 && base1 + len1 == base2)
var/cursor1 = base1 + len1 - 1 //start at end of sublists
var/list/L = src.L
var/cursor1 = base1 + len1 - 1 //start at end of sublists
var/cursor2 = base2 + len2 - 1
//degenerate cases
@@ -491,8 +490,8 @@ reverse a descending sequence without violating stability.
outer:
while(1)
var/count1 = 0 //# of times in a row that first run won
var/count2 = 0 // " " " " " " second run won
var/count1 = 0 //# of times in a row that first run won
var/count2 = 0 // " " " " " " second run won
//do the straightfoward thing until one run starts winning consistently
do
@@ -522,11 +521,11 @@ reverse a descending sequence without violating stability.
do
//ASSERT(len1 > 0 && len2 > 1)
count1 = len1 - gallopRight(fetchElement(L,cursor2), base1, len1, len1-1) //should cursor1 be base1?
count1 = len1 - gallopRight(fetchElement(L,cursor2), base1, len1, len1-1) //should cursor1 be base1?
if(count1)
cursor1 -= count1
moveRange(L, cursor1+1, cursor2+1, count1) //cursor1+1 == cursor2 by definition
moveRange(L, cursor1+1, cursor2+1, count1) //cursor1+1 == cursor2 by definition
cursor2 -= count1
len1 -= count1
@@ -558,7 +557,7 @@ reverse a descending sequence without violating stability.
if(minGallop < 0)
minGallop = 0
minGallop += 2 // Penalize for leaving gallop mode
minGallop += 2 // Penalize for leaving gallop mode
if(len2 == 1)
//ASSERT(len1 > 0)
@@ -571,12 +570,11 @@ reverse a descending sequence without violating stability.
//ASSERT(len2 > 0)
/datum/sortInstance/proc/mergeSort(start, end)
/datum/sort_instance/proc/mergeSort(start, end)
var/remaining = end - start
//If array is small, do an insertion sort
if(remaining < MIN_MERGE)
//var/initRunLen = countRunAndMakeAscending(start, end)
binarySort(start, end, start/*+initRunLen*/)
return
@@ -606,7 +604,7 @@ reverse a descending sequence without violating stability.
else if(runLens[n] <= runLens[n+1])
mergeAt2(n)
else
break //Invariant is established
break //Invariant is established
while(runBases.len >= 2)
var/n = runBases.len - 1
@@ -616,7 +614,8 @@ reverse a descending sequence without violating stability.
return L
/datum/sortInstance/proc/mergeAt2(i)
/datum/sort_instance/proc/mergeAt2(i)
var/list/L = src.L
var/cursor1 = runBases[i]
var/cursor2 = runBases[i+1]

View File

@@ -185,9 +185,9 @@
/mob/Destroy()
..()
if(ability_master)
QDEL_NULL(ability_master)
. = ..()
///////////ACTUAL ABILITIES////////////

View File

@@ -35,12 +35,12 @@
if(!owner_rig)
qdel(src)
return
var/obj/item/weapon/cell/rigcell = owner_rig.cell
var/obj/item/weapon/tank/rigtank = owner_rig.air_supply
var/charge_percentage = rigcell ? rigcell.charge / rigcell.maxcharge : 0
var/air_percentage = rigtank ? CLAMP(rigtank.air_contents.total_moles / 17.4693, 0, 1) : 0
var/air_percentage = rigtank?.air_contents ? CLAMP(rigtank.air_contents.total_moles / 17.4693, 0, 1) : 0
var/air_on = owner_rig.wearer?.internal ? 1 : 0
power.icon_state = "pwr[round(charge_percentage / 0.2, 1)]"
@@ -84,7 +84,7 @@
if(!owner_mech)
qdel(src)
return
var/obj/item/weapon/cell/mechcell = owner_mech.cell
var/obj/machinery/portable_atmospherics/canister/mechtank = owner_mech.internal_tank
@@ -97,7 +97,7 @@
air.icon_state = "air[round(air_percentage / 0.2, 1)]"
health.icon_state = "health[round(health_percentage / 0.2, 1)]"
airtoggle.icon_state = "airon[air_on]"
// Screen objects
/obj/screen/rig
icon = 'icons/mob/screen_rigmech.dmi'
@@ -209,7 +209,7 @@
var/list/adding = list()
HUD.adding = adding
var/obj/screen/using
using = new /obj/screen/ghost/jumptomob()
using.screen_loc = ui_ghost_jumptomob
@@ -225,4 +225,4 @@
using.screen_loc = ui_ghost_reenter_corpse
using.hud = src
adding += using
*/
*/

View File

@@ -63,4 +63,4 @@ GLOBAL_REAL(GLOB, /datum/controller/global_vars)
if(end_tick - start_tick)
warning("Global [replacetext("[I]", "InitGlobal", "")] slept during initialization!")
populate_legacy_globals()
//populate_legacy_globals()

View File

@@ -27,18 +27,19 @@ SUBSYSTEM_DEF(ping)
var/client/client = currentrun[currentrun.len]
currentrun.len--
if(!client?.is_preference_enabled(/datum/client_preference/vchat_enable))
winset(client, "output", "on-show=&is-disabled=0&is-visible=1")
winset(client, "browseroutput", "is-disabled=1;is-visible=0")
client.tgui_panel.oldchat = TRUE
if(client)
if(!client.is_preference_enabled(/datum/client_preference/vchat_enable))
winset(client, "output", "on-show=&is-disabled=0&is-visible=1")
winset(client, "browseroutput", "is-disabled=1;is-visible=0")
client.tgui_panel.oldchat = TRUE
if (client?.tgui_panel?.is_ready())
// Send a soft ping
client.tgui_panel.window.send_message("ping/soft", list(
// Slightly less than the subsystem timer (somewhat arbitrary)
// to prevent incoming pings from resetting the afk state
"afk" = client.is_afk(3.5 SECONDS),
))
if (client?.tgui_panel?.is_ready())
// Send a soft ping
client.tgui_panel.window.send_message("ping/soft", list(
// Slightly less than the subsystem timer (somewhat arbitrary)
// to prevent incoming pings from resetting the afk state
"afk" = client.is_afk(3.5 SECONDS),
))
if (MC_TICK_CHECK)
return

View File

@@ -1,3 +1,11 @@
//Images are the ONLY other kind of child of datum that has a loc other than atom
//Datums DO NOT have a loc themselves. Usually, loc based cleanup is handled by atom/, but it doesn't count here
//Image is not a child of loc!
/image/Destroy()
loc = null
. = ..()
/// The image's base transform scale for width.
/image/var/tf_scale_x

View File

@@ -51,8 +51,6 @@ var/list/runechat_image_cache = list()
/// If we are currently processing animation and cleanup at EOL
var/ending_life
/// deletion timer
var/timer_delete
/**
* Constructs a chat message overlay
@@ -75,9 +73,6 @@ var/list/runechat_image_cache = list()
generate_image(text, target, owner, extra_classes, lifespan)
/datum/chatmessage/Destroy()
if(timer_delete)
deltimer(timer_delete)
timer_delete = null
if(istype(owned_by, /client)) // hopefully the PARENT_QDELETING on client should beat this if it's a disconnect
UnregisterSignal(owned_by, COMSIG_PARENT_QDELETING)
if(owned_by.seen_messages)
@@ -228,7 +223,9 @@ var/list/runechat_image_cache = list()
return
ending_life = TRUE
animate(message, alpha = 0, time = fadetime, flags = ANIMATION_PARALLEL)
timer_delete = QDEL_IN_STOPPABLE(src, fadetime) //ChompEDIT - we use QDEL_IN_STOPPABLE, upstream just has QDEL_IN do the same thing
spawn(fadetime)
if(!QDELETED(src))
qdel(src)
/**
* Creates a message overlay at a defined location for a given speaker

View File

@@ -32,12 +32,6 @@ GLOBAL_DATUM_INIT(moved_event, /decl/observ/moved, new)
. = ..()
am.RegisterSignal(src,COMSIG_OBSERVER_MOVED, /atom/movable/proc/recursive_move, override = TRUE)
/atom/movable/Initialize(mapload)
. = ..()
if(istype(loc, /atom/movable)) // on initialise, if i'm inside a thing, preregister this.
var/atom/movable/am = loc
RegisterSignal(am, COMSIG_OBSERVER_MOVED, /atom/movable/proc/recursive_move, override = TRUE)
/atom/movable/Exited(var/atom/movable/am, atom/old_loc)
. = ..()
am.UnregisterSignal(src,COMSIG_OBSERVER_MOVED)

View File

@@ -63,8 +63,7 @@
spawn(5)
if(client)
client.images -= bar
//qdel(bar) //ChompEDIT - try not qdelling progressbars.
bar = null //ChompEDIT - null instead of qdel
QDEL_NULL(bar)
. = ..()
#undef PROGRESSBAR_HEIGHT

View File

@@ -96,6 +96,9 @@ GLOBAL_LIST_EMPTY(bodycamera_screens) // CHOMPEdit
add_overlay("glass")
pinboard = SSvis_overlays.add_vis_overlay(src, icon = icon, iconstate = "pinboard", layer = 0.1, add_appearance_flags = KEEP_TOGETHER, add_vis_flags = VIS_INHERIT_ID|VIS_INHERIT_PLANE, unique = TRUE)
pinboard.add_filter("screen cutter", 1, alpha_mask_filter(icon = mask))
/*
pinboard = new()
pinboard.icon = icon
pinboard.icon_state = "pinboard"
@@ -104,6 +107,7 @@ GLOBAL_LIST_EMPTY(bodycamera_screens) // CHOMPEdit
pinboard.appearance_flags = KEEP_TOGETHER
pinboard.add_filter("screen cutter", 1, alpha_mask_filter(icon = mask))
vis_contents += pinboard
*/
. = ..()
@@ -201,6 +205,10 @@ GLOBAL_LIST_EMPTY(bodycamera_screens) // CHOMPEdit
add_overlay("glass")
bpinboard = SSvis_overlays.add_vis_overlay(src, icon = icon, iconstate = "pinboard", layer = 0.1, add_appearance_flags = KEEP_TOGETHER, add_vis_flags = VIS_INHERIT_ID|VIS_INHERIT_PLANE, unique = TRUE)
bpinboard.add_filter("screen cutter", 1, alpha_mask_filter(icon = mask))
vis_contents += bpinboard
/*
bpinboard = new()
bpinboard.icon = icon
bpinboard.icon_state = "pinboard"
@@ -209,6 +217,7 @@ GLOBAL_LIST_EMPTY(bodycamera_screens) // CHOMPEdit
bpinboard.appearance_flags = KEEP_TOGETHER
bpinboard.add_filter("screen cutter", 1, alpha_mask_filter(icon = mask))
vis_contents += bpinboard
*/
. = ..()

View File

@@ -653,7 +653,7 @@
/obj/machinery/porta_turret/proc/die() //called when the turret dies, ie, health <= 0
health = 0
stat |= BROKEN //enables the BROKEN bit
spark_system.start() //creates some sparks because they look cool
spark_system?.start() //creates some sparks because they look cool
update_icon()
/obj/machinery/porta_turret/process()

View File

@@ -77,7 +77,7 @@
/obj/item/shield_projector/rectangle/mecha/Initialize()
. = ..()
my_mech = loc
RegisterSignal(my_mech, COMSIG_OBSERVER_MOVED, /obj/item/shield_projector/proc/update_shield_positions)
RegisterSignal(my_mech, COMSIG_OBSERVER_MOVED, /obj/item/shield_projector/proc/update_shield_positions, override = TRUE)
update_shift(my_mech)
/obj/item/shield_projector/rectangle/mecha/proc/update_shift(atom/movable/mech)

View File

@@ -1,9 +1,9 @@
/obj/effect/overlay
name = "overlay"
unacidable = TRUE
var/i_attached//Added for possible image attachments to objects. For hallucinations and the like.
var/i_attached //Added for possible image attachments to objects. For hallucinations and the like.
/obj/effect/overlay/beam//Not actually a projectile, just an effect.
/obj/effect/overlay/beam //Not actually a projectile, just an effect.
name="beam"
icon='icons/effects/beam.dmi'
icon_state="b_beam"

View File

@@ -91,9 +91,9 @@ var/list/GPS_list = list()
STOP_PROCESSING(SSobj, src)
is_in_processing_list = FALSE
GPS_list -= src
. = ..()
update_holder()
QDEL_NULL(compass)
. = ..()
/obj/item/device/gps/proc/can_track(var/obj/item/device/gps/other, var/reachable_z_levels)
if(!other.tracking || other.emped || other.hide_signal)

View File

@@ -253,6 +253,7 @@
if(!uses_charge)
amount -= used
if (amount <= 0)
amount = 0 // stop amount going negative ideally
qdel(src) //should be safe to qdel immediately since if someone is still using this stack it will persist for a little while longer
update_icon()
return 1

View File

@@ -20,38 +20,30 @@
var/climbable = FALSE //Adds proc to wall if set to TRUE on its initialization, defined here since not all walls are subtypes of wall
var/icon_edge = 'icons/turf/outdoors_edge.dmi' //VOREStation Addition - Allows for alternative edge icon files
var/wet_cleanup_timer
// This is not great.
/turf/simulated/proc/wet_floor(var/wet_val = 1)
if(wet > 2) //Can't mop up ice
return
/* //ChompEDIT START - huge CPU usage
spawn(0)
wet = wet_val
if(wet_overlay)
cut_overlay(wet_overlay)
wet_overlay = image('icons/effects/water.dmi', icon_state = "wet_floor")
add_overlay(wet_overlay)
sleep(800)
if(wet == 2)
sleep(3200)
wet = 0
if(wet_overlay)
cut_overlay(wet_overlay)
wet_overlay = null
*/ //ChompEDIT CONTINUE
wet = wet_val
if(wet_overlay)
cut_overlay(wet_overlay)
wet_overlay = image('icons/effects/water.dmi', icon_state = "wet_floor")
add_overlay(wet_overlay)
if(wet_cleanup_timer)
deltimer(wet_cleanup_timer)
wet_cleanup_timer = null
if(wet == 2)
addtimer(CALLBACK(src, PROC_REF(wet_floor_finish)), 160 SECONDS)
wet_cleanup_timer = addtimer(CALLBACK(src, PROC_REF(wet_floor_finish)), 160 SECONDS, TIMER_STOPPABLE)
else
addtimer(CALLBACK(src, PROC_REF(wet_floor_finish)), 40 SECONDS)
wet_cleanup_timer = addtimer(CALLBACK(src, PROC_REF(wet_floor_finish)), 40 SECONDS, TIMER_STOPPABLE)
/turf/simulated/proc/wet_floor_finish()
wet = 0
if(wet_cleanup_timer)
deltimer(wet_cleanup_timer)
wet_cleanup_timer = null
if(wet_overlay)
cut_overlay(wet_overlay)
wet_overlay = null

View File

@@ -58,10 +58,16 @@
species_restricted = null
/obj/item/clothing/shoes/none/Initialize()
..()
if(istype(loc, /mob))
. = ..()
if(istype(loc, /mob)) // are we in a mob?
var/mob/m = loc
m.drop_from_inventory(src, get_turf(m))
m.update_inv_shoes()
moveToNullspace()
return INITIALIZE_HINT_QDEL //Fuck them shoes
if(contents.len) // spill out contents (e.g. microholders)
for(var/atom/movable/thing in contents)
thing.loc = get_turf(src)
moveToNullspace() // go to nullspace
spawn(1)
qdel(src) // die
/obj/item/clothing/shoes/none/make_worn_icon(body_type, slot_name, inhands, default_icon, default_layer, icon/clip_mask) // override this to ensure that no worn icon is generated
return

View File

@@ -22,6 +22,7 @@
QDEL_NULL(touching)
// We don't qdel(bloodstr) because it's the same as qdel(reagents)
bloodstr = null
QDEL_NULL_LIST(internal_organs)
QDEL_NULL_LIST(stomach_contents)
return ..()

View File

@@ -58,10 +58,7 @@
/mob/living/carbon/human/Destroy()
human_mob_list -= src
/* //Chomp REMOVE - this is done on mob/living/Destroy
for(var/organ in organs)
qdel(organ)
*/
QDEL_NULL_LIST(organs)
if(nif)
QDEL_NULL(nif) //VOREStation Add
worn_clothing.Cut()

View File

@@ -53,12 +53,8 @@
if(tf_mob_holder)
tf_mob_holder = null
//VOREStation Addition End
if(hud_list) //prune out images in hud_list
for(var/item in hud_list)
if(item)
item = null
if(selected_image)
selected_image = null
QDEL_NULL_LIST(hud_list)
QDEL_NULL(selected_image)
//QDEL_NULL(vorePanel) //VOREStation Add commented and moved to /mob
//QDEL_LIST_NULL(vore_organs) //VOREStation Add commented and moved to /mob
temp_language_sources = null //VOREStation Add

View File

@@ -14,7 +14,10 @@
/mob/living/simple_mob/animal/giant_spider/frost/broodling/death()
new /obj/effect/decal/cleanable/spiderling_remains(src.loc)
qdel(src)
spawn(1)
if(!QDELETED(src))
qdel(src)
/mob/living/simple_mob/animal/giant_spider/electric/broodling
maxHealth = 30
@@ -32,7 +35,10 @@
/mob/living/simple_mob/animal/giant_spider/electric/broodling/death()
new /obj/effect/decal/cleanable/spiderling_remains(src.loc)
qdel(src)
spawn(1)
if(!QDELETED(src))
qdel(src)
/mob/living/simple_mob/animal/giant_spider/hunter/broodling
maxHealth = 40
@@ -47,7 +53,10 @@
/mob/living/simple_mob/animal/giant_spider/hunter/broodling/death()
new /obj/effect/decal/cleanable/spiderling_remains(src.loc)
qdel(src)
spawn(1)
if(!QDELETED(src))
qdel(src)
/mob/living/simple_mob/animal/giant_spider/lurker/broodling
maxHealth = 40
@@ -62,7 +71,10 @@
/mob/living/simple_mob/animal/giant_spider/lurker/broodling/death()
new /obj/effect/decal/cleanable/spiderling_remains(src.loc)
qdel(src)
spawn(1)
if(!QDELETED(src))
qdel(src)
/mob/living/simple_mob/animal/giant_spider/nurse/broodling
maxHealth = 60
@@ -78,7 +90,10 @@
/mob/living/simple_mob/animal/giant_spider/nurse/broodling/death()
new /obj/effect/decal/cleanable/spiderling_remains(src.loc)
qdel(src)
spawn(1)
if(!QDELETED(src))
qdel(src)
/mob/living/simple_mob/animal/giant_spider/pepper/broodling
maxHealth = 40
@@ -93,7 +108,10 @@
/mob/living/simple_mob/animal/giant_spider/pepper/broodling/death()
new /obj/effect/decal/cleanable/spiderling_remains(src.loc)
qdel(src)
spawn(1)
if(!QDELETED(src))
qdel(src)
/mob/living/simple_mob/animal/giant_spider/thermic/broodling
maxHealth = 40
@@ -111,7 +129,10 @@
/mob/living/simple_mob/animal/giant_spider/thermic/broodling/death()
new /obj/effect/decal/cleanable/spiderling_remains(src.loc)
qdel(src)
spawn(1)
if(!QDELETED(src))
qdel(src)
/mob/living/simple_mob/animal/giant_spider/tunneler/broodling
maxHealth = 40
@@ -126,7 +147,10 @@
/mob/living/simple_mob/animal/giant_spider/tunneler/broodling/death()
new /obj/effect/decal/cleanable/spiderling_remains(src.loc)
qdel(src)
spawn(1)
if(!QDELETED(src))
qdel(src)
/mob/living/simple_mob/animal/giant_spider/webslinger/broodling
maxHealth = 30
@@ -143,7 +167,10 @@
/mob/living/simple_mob/animal/giant_spider/webslinger/broodling/death()
new /obj/effect/decal/cleanable/spiderling_remains(src.loc)
qdel(src)
spawn(1)
if(!QDELETED(src))
qdel(src)
/mob/living/simple_mob/animal/giant_spider/broodling
maxHealth = 60
@@ -161,4 +188,7 @@
/mob/living/simple_mob/animal/giant_spider/broodling/death()
new /obj/effect/decal/cleanable/spiderling_remains(src.loc)
qdel(src)
spawn(1)
if(!QDELETED(src))
qdel(src)

View File

@@ -94,7 +94,7 @@
/mob/living/simple_mob/mechanical/mecha/bullet_act()
. = ..()
sparks.start()
sparks?.start()
/mob/living/simple_mob/mechanical/mecha/speech_bubble_appearance()
return pilot_type ? "" : ..()

View File

@@ -4,20 +4,19 @@
living_mob_list -= src
player_list -= src
unset_machine()
QDEL_NULL(hud_used)
clear_fullscreen()
if(client)
for(var/obj/screen/movable/spell_master/spell_master in spell_masters)
qdel(spell_master)
remove_screen_obj_references()
client.screen.Cut()
client.screen = list()
if(mind && mind.current == src)
spellremove(src)
if(!istype(src,/mob/observer)) //CHOMPEdit
ghostize() //CHOMPEdit
//ChompEDIT start - fix hard qdels
QDEL_NULL(plane_holder)
QDEL_NULL(hud_used)
if(pulling)
stop_pulling() //TG does this on atom/movable but our stop_pulling proc is here so whatever

View File

@@ -87,7 +87,7 @@
output += "<p><a href='byond://?src=\ref[src];showpoll=1'>Show Player Polls</A><br><i>No Changes</i></p>" //ChompEDIT - fixed height
*/
if(client.check_for_new_server_news())
if(client?.check_for_new_server_news())
output += "<p><b><a href='byond://?src=\ref[src];shownews=1'>Show Server News</A><br>(NEW!)</b></p>" //ChompEDIT 'Game updates' --> 'Server news'
else
output += "<p><a href='byond://?src=\ref[src];shownews=1'>Show Server News</A><br><i>No Changes</i></p>" //ChompEDIT 'Game updates' --> 'Server news'

View File

@@ -99,6 +99,5 @@
if(movement_range <= 0)
qdel(src)
else
//sleep(lag) //ChompEDIT
//move(lag) //ChompEDIT
addtimer(CALLBACK(src, PROC_REF(move), lag), lag) //ChompEDIT
spawn(lag)
move(lag)

View File

@@ -23,6 +23,10 @@
BB = new projectile_type(src)
randpixel_xy()
/obj/item/ammo_casing/Destroy()
QDEL_NULL(BB)
return ..()
//removes the projectile from the ammo casing
/obj/item/ammo_casing/proc/expend()
. = BB

View File

@@ -469,15 +469,13 @@
impacted_mobs.Cut()
impacted_mobs = null
trajectory = null
beam_index = null
beam_components = null
qdel(trajectory)
cleanup_beam_segments()
if(my_case)
if(my_case.BB == src)
my_case.BB = null
my_case = null
my_case = null
return ..()
@@ -743,6 +741,12 @@
/obj/item/projectile/proc/launch_projectile(atom/target, target_zone, mob/user, params, angle_override, forced_spread = 0)
if(!get_turf(user) && !get_turf(src)) // if both the user of the projectile AND the projectile itself are in nullspace, don't fire, just remove ourselves
spawn(1)
qdel(src)
return //fire returns nothing, so neither do we need to
original = target
def_zone = check_zone(target_zone)
firer = user

View File

@@ -243,7 +243,10 @@
if(!target || !istype(target))
return
amount = max(0, min(amount, total_volume, target.get_free_space() / multiplier))
if(multiplier)
amount = max(0, min(amount, total_volume, target.get_free_space() / multiplier))
else
amount = max(0, min(amount, total_volume))
if(!amount)
return

View File

@@ -443,7 +443,7 @@
if(B.item_digest_mode == IM_HOLD)
return
var/obj/item/I = O
var/spent_amt = I.digest_act(I.loc, 1, amount / (meltdose / 3))
var/spent_amt = I.digest_act(B, 1, amount / (meltdose / 3))
remove_self(spent_amt) //10u stomacid per w_class, less if stronger acid.
if(B.owner)
B.owner_adjust_nutrition((B.nutrition_percent / 100) * 5 * spent_amt)

View File

@@ -642,7 +642,6 @@
src.destinationTag = T.sortTag
// CHOMPEdit End
// start the movement process
// argument is the disposal unit the holder started in
/obj/structure/disposalholder/proc/start(var/obj/machinery/disposal/D)
@@ -873,6 +872,10 @@
if(!istype(H))
return
if(!isturf(T)) // try very hard to ensure we have a valid turf target
var/turf/GT = get_turf(T)
T = (GT ? GT : get_turf(src))
// Empty the holder if it is expelled into a dense turf.
// Leaving it intact and sitting in a wall is stupid.
if(T.density)

View File

@@ -103,6 +103,11 @@
if(always_on)
create_shields()
RegisterSignal(src, COMSIG_OBSERVER_MOVED, PROC_REF(moved_event))
if(istype(loc, /atom/movable)) // on initialise, if i'm inside a thing, preregister this.
var/atom/movable/am = loc
RegisterSignal(am, COMSIG_OBSERVER_MOVED, /atom/movable/proc/recursive_move, override = TRUE)
return ..()
/obj/item/shield_projector/Destroy()

View File

@@ -8,6 +8,8 @@
if(!override) //Did the person push the verb? Ignore the pref
if(!reciever.client.is_preference_enabled(/datum/client_preference/vore_health_bars))
return
if(!istype(src.loc, /obj/belly)) // not in a belly? don't bother
return
var/ourpercent = 0
if(ishuman(src)) //humans don't die or become unconcious at 0%, it's actually like -50% or something, so, let's pretend they have 50 more health than they do

View File

@@ -1166,7 +1166,7 @@
// but can easily make the message vary based on how many people are inside, etc.
// Returns a string which shoul be appended to the Examine output.
/obj/belly/proc/get_examine_msg()
if(!(contents.len) || !(examine_messages.len))
if(!(contents.len) || !(examine_messages?.len))
return ""
var/formatted_message

View File

@@ -137,7 +137,7 @@
//these are all external sound triggers now, so it's ok.
if(emote_active)
var/list/EL = emote_lists[digest_mode]
var/list/EL = emote_lists?[digest_mode]
if((LAZYLEN(EL) || LAZYLEN(emote_lists[DM_HOLD_ABSORBED]) || (digest_mode == DM_DIGEST && LAZYLEN(emote_lists[DM_HOLD])) || (digest_mode == DM_SELECT && (LAZYLEN(emote_lists[DM_HOLD])||LAZYLEN(emote_lists[DM_DIGEST])||LAZYLEN(emote_lists[DM_ABSORB])) )) && next_emote <= world.time)
var/living_count = 0
var/absorbed_count = 0