Microfan Rework

This commit is contained in:
Dip
2020-09-16 19:28:59 -03:00
parent 394d383746
commit 7e00d81758
6 changed files with 178 additions and 61 deletions

View File

@@ -1,59 +0,0 @@
/obj/machinery/poweredfans
icon = 'icons/obj/poweredfans.dmi'
icon_state = "mfan_powered"
name = "placeholder big fan"
desc = "A large machine releasing a constant gust of air."
anchored = TRUE
density = TRUE
var/buildstacktype = /obj/item/stack/sheet/metal
var/buildstackamount = 5
CanAtmosPass = ATMOS_PASS_NO
/obj/machinery/poweredfans/mpfan
name = "micro powered fan"
desc = "A handmade fan, releasing a thin gust of air."
layer = ABOVE_NORMAL_TURF_LAYER
density = FALSE
icon_state = "mfan_powered"
buildstackamount = 2
use_power = ACTIVE_POWER_USE
idle_power_usage = 1
active_power_usage = 3
CanAtmosPass = ATMOS_PASS_NO
/obj/machinery/poweredfans/deconstruct()
if(!(flags_1 & NODECONSTRUCT_1))
if(buildstacktype)
new buildstacktype(loc,buildstackamount)
qdel(src)
/obj/machinery/poweredfans/wrench_act(mob/living/user, obj/item/I)
if(flags_1 & NODECONSTRUCT_1)
return TRUE
user.visible_message("<span class='warning'>[user] disassembles [src].</span>",
"<span class='notice'>You start to disassemble [src]...</span>", "You hear clanking and banging noises.")
if(I.use_tool(src, user, 20, volume=50))
deconstruct()
return TRUE
/obj/machinery/poweredfans/Initialize(mapload)
. = ..()
air_update_turf(1)
/obj/machinery/poweredfans/power_change()
..()
update_icon()
/obj/machinery/poweredfans/update_icon()
//if(state & NOPOWER)
if(powered())
icon_state = "mfan_powered"
CanAtmosPass = ATMOS_PASS_NO
air_update_turf(1)
return
else
icon_state = "mfan_unpowered"
CanAtmosPass = ATMOS_PASS_YES
air_update_turf(1)
return

View File

@@ -0,0 +1,113 @@
/obj/structure/fan_assembly
name = "fan assembly"
desc = "A basic microfan assembly."
icon = 'icons/obj/poweredfans.dmi'
icon_state = "mfan_assembly"
max_integrity = 150
var/state = 1
var/buildstacktype = /obj/item/stack/sheet/plasteel
var/buildstackamount = 5
/*
1 = Wrenched in place
2 = Welded in place
3 = Wires attached to it
*/
/obj/structure/fan_assembly/Initialize(mapload, ndir, building)
. = ..()
if(building)
setDir(ndir)
/obj/structure/fan_assembly/Destroy()
return ..()
/obj/structure/fan_assembly/attackby(obj/item/W, mob/living/user, params)
switch(state)
if(1)
// State 1
if(istype(W, /obj/item/weldingtool))
if(weld(W, user))
to_chat(user, "<span class='notice'>You weld the fan assembly securely into place.</span>")
setAnchored(TRUE)
state = 2
update_icon()
return
if(2)
// State 2
if(istype(W, /obj/item/stack/cable_coil))
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>")
return
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))
to_chat(user, "<span class='notice'>You add wires to the fan assembly.</span>")
state = 3
var/obj/machinery/poweredfans/F = new(loc, src)
forceMove(F)
F.setDir(src.dir)
return
else if(istype(W, /obj/item/weldingtool))
if(weld(W, user))
to_chat(user, "<span class='notice'>You unweld the fan assembly from its place.</span>")
state = 1
update_icon()
setAnchored(FALSE)
return
return ..()
/obj/structure/fan_assembly/wirecutter_act(mob/user, obj/item/I)
if(state != 3)
return FALSE
new /obj/item/stack/cable_coil(drop_location(), 2)
I.play_tool_sound(src)
to_chat(user, "<span class='notice'>You cut the wires from the circuits.</span>")
state = 2
update_icon()
return TRUE
/obj/structure/fan_assembly/wrench_act(mob/user, obj/item/I)
if(state != 1)
return FALSE
user.visible_message("<span class='warning'>[user] disassembles [src].</span>",
"<span class='notice'>You start to disassemble [src]...</span>", "You hear wrenching noises.")
if(I.use_tool(src, user, 30, volume=50))
deconstruct()
return TRUE
/obj/structure/fan_assembly/proc/weld(obj/item/weldingtool/W, mob/living/user)
if(!W.tool_start_check(user, amount=0))
return FALSE
switch(state)
if(1)
to_chat(user, "<span class='notice'>You start to weld \the [src]...</span>")
if(2)
to_chat(user, "<span class='notice'>You start to unweld \the [src]...</span>")
if(W.use_tool(src, user, 30, volume=50))
return TRUE
return FALSE
/obj/structure/fan_assembly/deconstruct(disassembled = TRUE)
if(!(flags_1 & NODECONSTRUCT_1))
new buildstacktype(loc,buildstackamount)
qdel(src)
/obj/structure/fan_assembly/examine(mob/user)
..()
deconstruction_hints(user)
/obj/structure/fan_assembly/proc/deconstruction_hints(mob/user)
switch(state)
if(1)
to_chat(user, "<span class='notice'>The fan assembly seems to be <b>unwelded</b> and loose.</span>")
if(2)
to_chat(user, "<span class='notice'>The fan assembly seems to be welded, but missing <b>wires</b>.</span>")
if(3)
to_chat(user, "<span class='notice'>The outer plating is <b>wired</b> firmly in place.</span>")
/obj/structure/fan_assembly/update_icon()
switch(state)
if(1)
icon_state = "mfan_assembly"
if(2)
icon_state = "mfan_welded"

View File

@@ -0,0 +1,62 @@
/obj/machinery/poweredfans
icon = 'icons/obj/poweredfans.dmi'
icon_state = "mfan_powered"
name = "micro powered fan"
desc = "A handmade fan, releasing a thin gust of air."
use_power = ACTIVE_POWER_USE
idle_power_usage = 5
active_power_usage = 10
layer = ABOVE_NORMAL_TURF_LAYER
anchored = TRUE
density = FALSE
CanAtmosPass = ATMOS_PASS_NO
var/obj/structure/fan_assembly/assembly = null
/obj/machinery/poweredfans/deconstruct(disassembled = TRUE)
if(!(flags_1 & NODECONSTRUCT_1))
if(disassembled)
if(!assembly)
assembly = new()
assembly.forceMove(drop_location())
assembly.state = 2
assembly.setAnchored(TRUE)
assembly.setDir(dir)
assembly = null
new /obj/item/stack/cable_coil(loc, 2)
else
new /obj/structure/fan_assembly (loc)
new /obj/item/stack/cable_coil(loc, 2)
qdel(src)
/obj/machinery/poweredfans/wirecutter_act(mob/living/user, obj/item/I)
user.visible_message("<span class='warning'>[user] removes the wires from the [src].</span>",
"<span class='notice'>You start to remove the wires from the [src]...</span>", "You hear clanking and banging noises.")
if(I.use_tool(src, user, 30, volume=50))
deconstruct()
return TRUE
/obj/machinery/poweredfans/Initialize(mapload, obj/structure/fan_assembly/FA)
. = ..()
if(FA)
assembly = FA
else
assembly = new(src)
assembly.state = 3
air_update_turf(1)
/obj/machinery/poweredfans/power_change()
..()
update_icon()
/obj/machinery/poweredfans/update_icon()
//if(state & NOPOWER)
if(powered())
icon_state = "mfan_powered"
CanAtmosPass = ATMOS_PASS_NO
air_update_turf(1)
return
else
icon_state = "mfan_unpowered"
CanAtmosPass = ATMOS_PASS_YES
air_update_turf(1)
return

View File

@@ -121,7 +121,6 @@ GLOBAL_LIST_INIT(metal_recipes, list ( \
new/datum/stack_recipe("iron door", /obj/structure/mineral_door/iron, 20, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("pestle", /obj/item/pestle, 1, time = 50), \
new/datum/stack_recipe("floodlight frame", /obj/structure/floodlight_frame, 5, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("micro powered fan", /obj/machinery/poweredfans/mpfan, 2, time = 35, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("iron ingot", /obj/item/ingot/iron, 6, time = 100), \
))
@@ -180,6 +179,7 @@ GLOBAL_LIST_INIT(metal_recipes, list ( \
GLOBAL_LIST_INIT(plasteel_recipes, list ( \
new/datum/stack_recipe("AI core", /obj/structure/AIcore, 4, time = 50, one_per_turf = TRUE), \
new/datum/stack_recipe("bomb assembly", /obj/machinery/syndicatebomb/empty, 10, time = 50), \
new/datum/stack_recipe("micro powered fan assembly", /obj/structure/fan_assembly, 5, time = 50, one_per_turf = TRUE, on_floor = TRUE), \
new /datum/stack_recipe_list("crates", list( \
new /datum/stack_recipe("gray crate", /obj/structure/closet/crate, 5, time = 50, one_per_turf = 1, on_floor = 1), \
new /datum/stack_recipe("internals crate", /obj/structure/closet/crate/internals, 5, time = 50, one_per_turf = 1, on_floor = 1), \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 479 B

After

Width:  |  Height:  |  Size: 575 B

View File

@@ -806,7 +806,8 @@
#include "code\game\machinery\mass_driver.dm"
#include "code\game\machinery\navbeacon.dm"
#include "code\game\machinery\PDApainter.dm"
#include "code\game\machinery\poweredfans.dm"
#include "code\game\machinery\poweredfans\fan_assembly.dm"
#include "code\game\machinery\poweredfans\poweredfans.dm"
#include "code\game\machinery\quantum_pad.dm"
#include "code\game\machinery\recharger.dm"
#include "code\game\machinery\rechargestation.dm"