[MIRROR] Makes obj_integrity private and only updated through procs (#6125)

* 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.

* Makes obj_integrity private and only updated through procs

* Mirror!

Co-authored-by: Emmett Gaines <ninjanomnom@gmail.com>
Co-authored-by: Funce <funce.973@gmail.com>
This commit is contained in:
SkyratBot
2021-06-05 06:35:09 +02:00
committed by GitHub
parent dc57646706
commit fbb78302cf
54 changed files with 141 additions and 106 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)