[MIRROR] Fixes a few runtimes with armor, spatial grids, and notes [MDB IGNORE] (#11126)

* Fixes a few runtimes with armor, spatial grids, and notes (#64514)

* Atoms  (mostly new players caused by logout) can get deleted before spatial grid initializes.

* Fixes images when viewing your notes before SSassets initializes.

* Fixes abandoned crate runtime.

* Fixes armor runtimes on eating clothes (this really needs alternative solution)

* Fixes a few runtimes with armor, spatial grids, and notes

Co-authored-by: AnturK <AnturK@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-01-30 05:06:14 +01:00
committed by GitHub
parent bca5c1945c
commit 5ed2dfe5f3
4 changed files with 22 additions and 14 deletions
@@ -377,6 +377,8 @@ SUBSYSTEM_DEF(spatial_grid)
* * exclusive_type - either null or a valid contents channel. if you just want to remove a single type from the grid cell then use this
*/
/datum/controller/subsystem/spatial_grid/proc/exit_cell(atom/movable/old_target, turf/target_turf, exclusive_type)
if(!initialized)
return
if(!target_turf || !old_target?.important_recursive_contents)
CRASH("/datum/controller/subsystem/spatial_grid/proc/exit_cell() was given null arguments or a new_target without important_recursive_contents!")
+15 -12
View File
@@ -1,9 +1,9 @@
#define ARMORID "armor-[melee]-[bullet]-[laser]-[energy]-[bomb]-[bio]-[fire]-[acid]-[wound]"
#define ARMORID "armor-[melee]-[bullet]-[laser]-[energy]-[bomb]-[bio]-[fire]-[acid]-[wound]-[consume]"
/proc/getArmor(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, fire = 0, acid = 0, wound = 0)
/proc/getArmor(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, fire = 0, acid = 0, wound = 0, consume = 0)
. = locate(ARMORID)
if (!.)
. = new /datum/armor(melee, bullet, laser, energy, bomb, bio, fire, acid, wound)
. = new /datum/armor(melee, bullet, laser, energy, bomb, bio, fire, acid, wound, consume)
/datum/armor
datum_flags = DF_USE_TAG
@@ -16,8 +16,9 @@
var/fire
var/acid
var/wound
var/consume
/datum/armor/New(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, fire = 0, acid = 0, wound = 0)
/datum/armor/New(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, fire = 0, acid = 0, wound = 0, consume = 0)
src.melee = melee
src.bullet = bullet
src.laser = laser
@@ -27,15 +28,16 @@
src.fire = fire
src.acid = acid
src.wound = wound
src.consume = consume
tag = ARMORID
/datum/armor/proc/modifyRating(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, fire = 0, acid = 0, wound = 0)
return getArmor(src.melee+melee, src.bullet+bullet, src.laser+laser, src.energy+energy, src.bomb+bomb, src.bio+bio, src.fire+fire, src.acid+acid, src.wound+wound)
/datum/armor/proc/modifyRating(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, fire = 0, acid = 0, wound = 0, consume = 0)
return getArmor(src.melee+melee, src.bullet+bullet, src.laser+laser, src.energy+energy, src.bomb+bomb, src.bio+bio, src.fire+fire, src.acid+acid, src.wound+wound, src.consume+consume)
/datum/armor/proc/modifyAllRatings(modifier = 0)
return getArmor(melee+modifier, bullet+modifier, laser+modifier, energy+modifier, bomb+modifier, bio+modifier, fire+modifier, acid+modifier, wound+modifier)
return getArmor(melee+modifier, bullet+modifier, laser+modifier, energy+modifier, bomb+modifier, bio+modifier, fire+modifier, acid+modifier, wound+modifier, consume+modifier)
/datum/armor/proc/setRating(melee, bullet, laser, energy, bomb, bio, fire, acid, wound)
/datum/armor/proc/setRating(melee, bullet, laser, energy, bomb, bio, fire, acid, wound, consume)
return getArmor((isnull(melee) ? src.melee : melee),\
(isnull(bullet) ? src.bullet : bullet),\
(isnull(laser) ? src.laser : laser),\
@@ -44,19 +46,20 @@
(isnull(bio) ? src.bio : bio),\
(isnull(fire) ? src.fire : fire),\
(isnull(acid) ? src.acid : acid),\
(isnull(wound) ? src.wound : wound))
(isnull(wound) ? src.wound : wound),\
(isnull(consume) ? src.consume : consume))
/datum/armor/proc/getRating(rating)
return vars[rating]
/datum/armor/proc/getList()
return list(MELEE = melee, BULLET = bullet, LASER = laser, ENERGY = energy, BOMB = bomb, BIO = bio, FIRE = fire, ACID = acid, WOUND = wound)
return list(MELEE = melee, BULLET = bullet, LASER = laser, ENERGY = energy, BOMB = bomb, BIO = bio, FIRE = fire, ACID = acid, WOUND = wound, CONSUME = consume)
/datum/armor/proc/attachArmor(datum/armor/AA)
return getArmor(melee+AA.melee, bullet+AA.bullet, laser+AA.laser, energy+AA.energy, bomb+AA.bomb, bio+AA.bio, fire+AA.fire, acid+AA.acid, wound+AA.wound)
return getArmor(melee+AA.melee, bullet+AA.bullet, laser+AA.laser, energy+AA.energy, bomb+AA.bomb, bio+AA.bio, fire+AA.fire, acid+AA.acid, wound+AA.wound, consume+AA.consume)
/datum/armor/proc/detachArmor(datum/armor/AA)
return getArmor(melee-AA.melee, bullet-AA.bullet, laser-AA.laser, energy-AA.energy, bomb-AA.bomb, bio-AA.bio, fire-AA.fire, acid-AA.acid, wound-AA.wound)
return getArmor(melee-AA.melee, bullet-AA.bullet, laser-AA.laser, energy-AA.energy, bomb-AA.bomb, bio-AA.bio, fire-AA.fire, acid-AA.acid, wound-AA.wound, consume-AA.consume)
/datum/armor/vv_edit_var(var_name, var_value)
if (var_name == NAMEOF(src, tag))
+4 -1
View File
@@ -372,6 +372,10 @@
if(!SSdbcore.Connect())
to_chat(usr, span_danger("Failed to establish database connection."), confidential = TRUE)
return
//Needs to be requested before url retrieval since you can view your notes before SSassets finishes initialization
var/datum/asset/notes_assets = get_asset_datum(/datum/asset/simple/notes)
var/list/output = list()
var/ruler = "<hr style='background:#000000; border:0; height:3px'>"
var/list/navbar = list("<a href='?_src_=holder;[HrefToken()];nonalpha=1'>All</a><a href='?_src_=holder;[HrefToken()];nonalpha=2'>#</a>")
@@ -624,7 +628,6 @@
output += "<center><a href='?_src_=holder;[HrefToken()];addmessageempty=1'>Add message</a><a href='?_src_=holder;[HrefToken()];addwatchempty=1'>Add watchlist entry</a><a href='?_src_=holder;[HrefToken()];addnoteempty=1'>Add note</a></center>"
output += ruler
var/datum/browser/browser = new(usr, "Note panel", "Manage player notes", 1000, 500)
var/datum/asset/notes_assets = get_asset_datum(/datum/asset/simple/notes)
notes_assets.send(usr.client)
browser.set_content(jointext(output, ""))
browser.open()
+1 -1
View File
@@ -47,7 +47,7 @@
if(!spawned_loot)
spawn_loot()
tamperproof = 0 // set explosion chance to zero, so we dont accidently hit it with a multitool and instantly die
togglelock()
togglelock(user)
else if(!input || !sanitycheck || length(sanitised) != codelen)
to_chat(user, span_notice("You leave the crate alone."))
else