Makes obj_integrity only updated through procs (#59474)

Having things updating integrity directly is just going to cause more problems down the line as more elements and components depend on being notified of integrity changes. It's an easy mistake to make so making it private should deal with the problem.

get_integrity() might be useful in the future but is mainly a side effect of making obj_integrity private as that also disallows reads.
This commit is contained in:
Emmett Gaines
2021-06-04 10:48:05 -04:00
committed by GitHub
parent cf937160de
commit 43c5dc8bfa
49 changed files with 133 additions and 97 deletions
+4 -1
View File
@@ -334,7 +334,10 @@
/obj/structure/grille/broken // Pre-broken grilles for map placement
icon_state = "brokengrille"
density = FALSE
obj_integrity = 20
broken = TRUE
rods_amount = 1
rods_broken = FALSE
/obj/structure/grille/broken/Initialize(mapload)
. = ..()
take_damage(max_integrity * 0.6)
@@ -53,7 +53,7 @@
unwrenched_plaque.desc = desc
unwrenched_plaque.engraved = engraved
unwrenched_plaque.icon_state = icon_state
unwrenched_plaque.obj_integrity = obj_integrity
unwrenched_plaque.update_integrity(get_integrity())
unwrenched_plaque.setDir(dir)
qdel(src) //The plaque structure on the wall goes poof and only the plaque item from unwrenching remains.
return TRUE
@@ -183,6 +183,6 @@
placed_plaque.desc = desc
placed_plaque.engraved = engraved
placed_plaque.icon_state = icon_state
placed_plaque.obj_integrity = obj_integrity
placed_plaque.update_integrity(get_integrity())
placed_plaque.setDir(dir)
qdel(src)
+2 -2
View File
@@ -88,7 +88,7 @@
unwrenched_sign.sign_path = type
unwrenched_sign.set_custom_materials(custom_materials) //This is here so picture frames and wooden things don't get messed up.
unwrenched_sign.is_editable = is_editable
unwrenched_sign.obj_integrity = obj_integrity //Transfer how damaged it is.
unwrenched_sign.update_integrity(get_integrity()) //Transfer how damaged it is.
unwrenched_sign.setDir(dir)
qdel(src) //The sign structure on the wall goes poof and only the sign item from unwrenching remains.
return TRUE
@@ -206,7 +206,7 @@
user.visible_message("<span class='notice'>[user] fastens [src] to [target_turf].</span>", \
"<span class='notice'>You attach the sign to [target_turf].</span>")
playsound(target_turf, 'sound/items/deconstruct.ogg', 50, TRUE)
placed_sign.obj_integrity = obj_integrity
placed_sign.update_integrity(get_integrity())
placed_sign.setDir(dir)
qdel(src)