Prepare Atmospherics Machinery for SSatoms (#4501)

* to_chat() replacement.

* Revert calling target.init_dir() before connecting.

* This change was added in https://github.com/PolarisSS13/Polaris/pull/3775 to counteract `dir` not being set prior to New() for dynamically loaded maps.  The root cause was /atom/New() not calling _preloader.load().  Undoing the change now that /atom/New() is fixed.
* The addition of the init_dir() proc itself however, is useful, because there ARE other times some atmos machinery will want to re-initialize its dir, specifically whenever it is rotated.
* init_dir() must be called in the constructor of all atmospherics machines capable of connecting to another.   Since it has to happen for ALL machines, lets move that call to /obj/machinery/atmospherics/New()

* Rename /obj/machinery/atmospherics initialize() to atmos_init()

* These days `initialize()` is used to handle general object initialization that is moved outside of New().  The node connection discovery of atmos machinery needs to happen after all that, and so needs to be in a separate proc.
* Make sure to actually call atmos_init during system startup.
This commit is contained in:
Leshana
2018-01-06 11:52:56 -05:00
committed by Anewbe
parent e23c002eb5
commit 224fe42e77
28 changed files with 238 additions and 297 deletions

View File

@@ -140,8 +140,7 @@
return
/obj/machinery/atmospherics/valve/initialize()
init_dir()
/obj/machinery/atmospherics/valve/atmos_init()
normalize_dir()
var/node1_dir
@@ -155,13 +154,11 @@
node2_dir = direction
for(var/obj/machinery/atmospherics/target in get_step(src,node1_dir))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/target in get_step(src,node2_dir))
target.init_dir()
if(target.initialize_directions & get_dir(target,src))
if (check_connect_types(target,src))
node2 = target
@@ -239,7 +236,7 @@
if(!powered())
return
if(!src.allowed(user))
user << "<span class='warning'>Access denied.</span>"
to_chat(user, "<span class='warning'>Access denied.</span>")
return
..()
@@ -292,14 +289,14 @@
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (istype(src, /obj/machinery/atmospherics/valve/digital) && !src.allowed(user))
user << "<span class='warning'>Access denied.</span>"
to_chat(user, "<span class='warning'>Access denied.</span>")
return 1
if(!can_unwrench())
to_chat(user, "<span class='warning'>You cannot unwrench \the [src], it is too exerted due to internal pressure.</span>")
add_fingerprint(user)
return 1
playsound(src, W.usesound, 50, 1)
user << "<span class='notice'>You begin to unfasten \the [src]...</span>"
to_chat(user, "<span class='notice'>You begin to unfasten \the [src]...</span>")
if (do_after(user, 40 * W.toolspeed))
user.visible_message( \
"<span class='notice'>\The [user] unfastens \the [src].</span>", \