[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 16:35:09 +12:00
committed by GitHub
co-authored by Emmett Gaines Funce
parent dc57646706
commit fbb78302cf
54 changed files with 141 additions and 106 deletions
+2 -2
View File
@@ -56,7 +56,7 @@
else if(isobj(parent))
var/obj/O = parent
integrity = O.obj_integrity
integrity = O.get_integrity()
rewind_type = .proc/rewind_obj
addtimer(CALLBACK(src, rewind_type), rewind_interval)
@@ -107,5 +107,5 @@
/datum/component/dejavu/proc/rewind_obj()
var/obj/master = parent
master.obj_integrity = integrity
master.update_integrity(integrity)
rewind()
+3 -2
View File
@@ -72,10 +72,11 @@
return process_machine(master, airs)
/datum/component/gas_leaker/proc/process_leak(obj/master, list/airs)
if(master.obj_integrity > master.max_integrity * integrity_leak_percent)
var/current_integrity = master.get_integrity()
if(current_integrity > master.max_integrity * integrity_leak_percent)
return PROCESS_KILL
var/turf/location = get_turf(master)
var/true_rate = (1 - (master.obj_integrity / master.max_integrity)) * leak_rate
var/true_rate = (1 - (current_integrity / master.max_integrity)) * leak_rate
for(var/datum/gas_mixture/mix as anything in airs)
var/pressure = mix.return_pressure()
if(mix.release_gas_to(location.return_air(), pressure, true_rate))