Fixes requested

This commit is contained in:
Dip
2020-09-19 13:02:08 -03:00
parent fa516fc517
commit a3bf4ac580
2 changed files with 28 additions and 46 deletions

View File

@@ -8,12 +8,11 @@
power_channel = ENVIRON power_channel = ENVIRON
idle_power_usage = 0 idle_power_usage = 0
active_power_usage = 0 active_power_usage = 0
max_integrity = 150
layer = ABOVE_NORMAL_TURF_LAYER layer = ABOVE_NORMAL_TURF_LAYER
anchored = FALSE anchored = FALSE
density = FALSE density = FALSE
CanAtmosPass = ATMOS_PASS_YES CanAtmosPass = ATMOS_PASS_YES
var/state = 1 stat = 1
var/buildstacktype = /obj/item/stack/sheet/plasteel var/buildstacktype = /obj/item/stack/sheet/plasteel
var/buildstackamount = 5 var/buildstackamount = 5
/* /*
@@ -22,27 +21,19 @@
3 = Wires attached to it, this makes it change to the full thing. 3 = Wires attached to it, this makes it change to the full thing.
*/ */
/obj/machinery/fan_assembly/Initialize(mapload, ndir, building)
. = ..()
if(building)
setDir(ndir)
/obj/machinery/fan_assembly/Destroy()
return ..()
/obj/machinery/fan_assembly/attackby(obj/item/W, mob/living/user, params) /obj/machinery/fan_assembly/attackby(obj/item/W, mob/living/user, params)
switch(state) switch(stat)
if(1) if(1)
// State 1 // Stat 1
if(istype(W, /obj/item/weldingtool)) if(istype(W, /obj/item/weldingtool))
if(weld(W, user)) if(weld(W, user))
to_chat(user, "<span class='notice'>You weld the fan assembly securely into place.</span>") to_chat(user, "<span class='notice'>You weld the fan assembly securely into place.</span>")
setAnchored(TRUE) setAnchored(TRUE)
state = 2 stat = 2
update_icon() update_icon_state()
return return
if(2) if(2)
// State 2 // Stat 2
if(istype(W, /obj/item/stack/cable_coil)) if(istype(W, /obj/item/stack/cable_coil))
if(!W.tool_start_check(user, amount=2)) if(!W.tool_start_check(user, amount=2))
to_chat(user, "<span class='warning'>You need two lengths of cable to wire the fan assembly!</span>") to_chat(user, "<span class='warning'>You need two lengths of cable to wire the fan assembly!</span>")
@@ -50,7 +41,7 @@
to_chat(user, "<span class='notice'>You start to add wires to the assembly...</span>") to_chat(user, "<span class='notice'>You start to add wires to the assembly...</span>")
if(W.use_tool(src, user, 30, volume=50, amount=2)) if(W.use_tool(src, user, 30, volume=50, amount=2))
to_chat(user, "<span class='notice'>You add wires to the fan assembly.</span>") to_chat(user, "<span class='notice'>You add wires to the fan assembly.</span>")
state = 3 stat = 3
var/obj/machinery/poweredfans/F = new(loc, src) var/obj/machinery/poweredfans/F = new(loc, src)
forceMove(F) forceMove(F)
F.setDir(src.dir) F.setDir(src.dir)
@@ -58,14 +49,14 @@
else if(istype(W, /obj/item/weldingtool)) else if(istype(W, /obj/item/weldingtool))
if(weld(W, user)) if(weld(W, user))
to_chat(user, "<span class='notice'>You unweld the fan assembly from its place.</span>") to_chat(user, "<span class='notice'>You unweld the fan assembly from its place.</span>")
state = 1 stat = 1
update_icon() update_icon_state()
setAnchored(FALSE) setAnchored(FALSE)
return return
return ..() return ..()
/obj/machinery/fan_assembly/wrench_act(mob/user, obj/item/I) /obj/machinery/fan_assembly/wrench_act(mob/user, obj/item/I)
if(state != 1) if(stat != 1)
return FALSE return FALSE
user.visible_message("<span class='warning'>[user] disassembles [src].</span>", user.visible_message("<span class='warning'>[user] disassembles [src].</span>",
"<span class='notice'>You start to disassemble [src]...</span>", "You hear wrenching noises.") "<span class='notice'>You start to disassemble [src]...</span>", "You hear wrenching noises.")
@@ -76,7 +67,7 @@
/obj/machinery/fan_assembly/proc/weld(obj/item/weldingtool/W, mob/living/user) /obj/machinery/fan_assembly/proc/weld(obj/item/weldingtool/W, mob/living/user)
if(!W.tool_start_check(user, amount=0)) if(!W.tool_start_check(user, amount=0))
return FALSE return FALSE
switch(state) switch(stat)
if(1) if(1)
to_chat(user, "<span class='notice'>You start to weld \the [src]...</span>") to_chat(user, "<span class='notice'>You start to weld \the [src]...</span>")
if(2) if(2)
@@ -91,11 +82,8 @@
qdel(src) qdel(src)
/obj/machinery/fan_assembly/examine(mob/user) /obj/machinery/fan_assembly/examine(mob/user)
..() . = ..()
deconstruction_hints(user) switch(stat)
/obj/machinery/fan_assembly/proc/deconstruction_hints(mob/user)
switch(state)
if(1) if(1)
to_chat(user, "<span class='notice'>The fan assembly seems to be <b>unwelded</b> and loose.</span>") to_chat(user, "<span class='notice'>The fan assembly seems to be <b>unwelded</b> and loose.</span>")
if(2) if(2)
@@ -103,8 +91,9 @@
if(3) if(3)
to_chat(user, "<span class='notice'>The outer plating is <b>wired</b> firmly in place.</span>") to_chat(user, "<span class='notice'>The outer plating is <b>wired</b> firmly in place.</span>")
/obj/machinery/fan_assembly/update_icon() /obj/machinery/fan_assembly/update_icon_state()
switch(state) . = ..()
switch(stat)
if(1) if(1)
icon_state = "mfan_assembly" icon_state = "mfan_assembly"
if(2) if(2)

View File

@@ -12,21 +12,18 @@
anchored = TRUE anchored = TRUE
density = FALSE density = FALSE
CanAtmosPass = ATMOS_PASS_NO CanAtmosPass = ATMOS_PASS_NO
var/obj/machinery/fan_assembly/assembly = null var/obj/machinery/fan_assembly/assembly
/obj/machinery/poweredfans/deconstruct(disassembled = TRUE) /obj/machinery/poweredfans/deconstruct(disassembled = TRUE)
if(!(flags_1 & NODECONSTRUCT_1)) if(!(flags_1 & NODECONSTRUCT_1))
if(disassembled) if(!assembly)
if(!assembly) assembly = new()
assembly = new() assembly.forceMove(drop_location())
assembly.forceMove(drop_location()) assembly.stat = 2
assembly.state = 2 assembly.setAnchored(TRUE)
assembly.setAnchored(TRUE) assembly.setDir(dir)
assembly.setDir(dir) assembly = null
assembly = null new /obj/item/stack/cable_coil(loc, 2)
new /obj/item/stack/cable_coil(loc, 2)
else
new /obj/item/stack/cable_coil(loc, 2)
qdel(src) qdel(src)
/obj/machinery/poweredfans/wirecutter_act(mob/living/user, obj/item/I) /obj/machinery/poweredfans/wirecutter_act(mob/living/user, obj/item/I)
@@ -42,22 +39,18 @@
assembly = FA assembly = FA
else else
assembly = new(src) assembly = new(src)
assembly.state = 3 assembly.stat = 3
air_update_turf(1) air_update_turf(1)
/obj/machinery/poweredfans/power_change() /obj/machinery/poweredfans/power_change()
..() ..()
update_icon()
/obj/machinery/poweredfans/update_icon()
//if(state & NOPOWER)
if(powered()) if(powered())
icon_state = "mfan_powered" icon_state = "mfan_powered"
CanAtmosPass = ATMOS_PASS_NO CanAtmosPass = ATMOS_PASS_NO
air_update_turf(1) air_update_turf(1)
return
else else
icon_state = "mfan_unpowered" icon_state = "mfan_unpowered"
CanAtmosPass = ATMOS_PASS_YES CanAtmosPass = ATMOS_PASS_YES
air_update_turf(1) air_update_turf(1)
return update_icon_state()