Merge pull request #13397 from ArchieBeepBoop/microfans

Micro Powered Fans!
This commit is contained in:
silicons
2020-09-27 00:03:43 -07:00
committed by GitHub
5 changed files with 159 additions and 0 deletions

View File

@@ -0,0 +1,100 @@
/obj/machinery/fan_assembly
name = "fan assembly"
desc = "A basic microfan assembly."
icon = 'icons/obj/poweredfans.dmi'
icon_state = "mfan_assembly"
max_integrity = 150
use_power = NO_POWER_USE
power_channel = ENVIRON
idle_power_usage = 0
active_power_usage = 0
layer = ABOVE_NORMAL_TURF_LAYER
anchored = FALSE
density = FALSE
CanAtmosPass = ATMOS_PASS_YES
stat = 1
var/buildstacktype = /obj/item/stack/sheet/plasteel
var/buildstackamount = 5
/*
1 = Wrenched in place
2 = Welded in place
3 = Wires attached to it, this makes it change to the full thing.
*/
/obj/machinery/fan_assembly/attackby(obj/item/W, mob/living/user, params)
switch(stat)
if(1)
// Stat 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)
stat = 2
update_icon_state()
return
if(2)
// Stat 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>")
stat = 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>")
stat = 1
update_icon_state()
setAnchored(FALSE)
return
return ..()
/obj/machinery/fan_assembly/wrench_act(mob/user, obj/item/I)
if(stat != 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/machinery/fan_assembly/proc/weld(obj/item/weldingtool/W, mob/living/user)
if(!W.tool_start_check(user, amount=0))
return FALSE
switch(stat)
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/machinery/fan_assembly/deconstruct(disassembled = TRUE)
if(!(flags_1 & NODECONSTRUCT_1))
new buildstacktype(loc,buildstackamount)
qdel(src)
/obj/machinery/fan_assembly/examine(mob/user)
. = ..()
switch(stat)
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/machinery/fan_assembly/update_icon_state()
. = ..()
switch(stat)
if(1)
icon_state = "mfan_assembly"
if(2)
icon_state = "mfan_welded"

View File

@@ -0,0 +1,56 @@
/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
power_channel = ENVIRON
idle_power_usage = 5
active_power_usage = 10
max_integrity = 150
layer = ABOVE_NORMAL_TURF_LAYER
anchored = TRUE
density = FALSE
CanAtmosPass = ATMOS_PASS_NO
var/obj/machinery/fan_assembly/assembly
/obj/machinery/poweredfans/deconstruct(disassembled = TRUE)
if(!(flags_1 & NODECONSTRUCT_1))
if(!assembly)
assembly = new()
assembly.forceMove(drop_location())
assembly.stat = 2
assembly.setAnchored(TRUE)
assembly.setDir(dir)
assembly = null
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/machinery/fan_assembly/FA)
. = ..()
if(FA)
assembly = FA
else
assembly = new(src)
assembly.stat = 3
air_update_turf(1)
/obj/machinery/poweredfans/power_change()
..()
if(powered())
icon_state = "mfan_powered"
CanAtmosPass = ATMOS_PASS_NO
air_update_turf(1)
else
icon_state = "mfan_unpowered"
CanAtmosPass = ATMOS_PASS_YES
air_update_turf(1)
update_icon_state()

View File

@@ -179,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/machinery/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), \

BIN
icons/obj/poweredfans.dmi Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

View File

@@ -808,6 +808,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\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"