Adds fireplaces, eswords are hot, cardboard is flammable (#19118)

Makes needed improvements to proposed fireplaces

- Fireplaces now use world.timer
- Fireplaces no longer prompt input() for inserting logs, it just
takes as many logs as possible
- Paper and paper bins can be thrown on the fire, thirty paper is worth
one log of burn time.
- One log gives 15 seconds of burn time, the fireplace can hold up to 5
minutes of fuel.
- Ignitable items now use a /obj level proc to generate their messages,
currently using this are cigarettes, candles, fireplaces
- The fireplace can be put out with an extinguisher
- Cardboard cutouts are now flammable
- The fireplace is only "warm and cozy" when lit
- Paperbins qdel their stored papers when destroyed (probably did that
already, but no harm in making sure)
- Also removed some returns hanging around

* Added new proc for lighting stuff

- Adds ignition_effect(atom/A, mob/user) to obj/item, which is called
when you're attempting to light things with that object. By default it
does nothing and prevents ignition, but if the object is hot, it returns
a message. May do other things for different stuff.

- Eswords now ignite flammable gasses in their area.

* Fireplace is no longer on fire when not on fire
This commit is contained in:
coiax
2016-07-05 23:16:47 +01:00
committed by oranges
parent 051e532337
commit 6449b65d30
19 changed files with 311 additions and 114 deletions

View File

@@ -567,11 +567,24 @@ obj/item/proc/item_action_slot_check(slot, mob/user)
else
. = pick('sound/misc/desceration-01.ogg', 'sound/misc/desceration-02.ogg', 'sound/misc/desceration-03.ogg')
/obj/item/proc/open_flame()
/obj/item/proc/open_flame(flame_heat=700)
var/turf/location = loc
if(ismob(location))
var/mob/M = location
if(M.l_hand == src || M.r_hand == src)
var/success = FALSE
if(src == M.get_item_by_slot(slot_l_hand))
success = TRUE
else if(src == M.get_item_by_slot(slot_r_hand))
success = TRUE
else if(src == M.get_item_by_slot(slot_wear_mask))
success = TRUE
if(success)
location = get_turf(M)
if(isturf(location))
location.hotspot_expose(700, 5)
location.hotspot_expose(flame_heat, 5)
/obj/item/proc/ignition_effect(atom/A, mob/user)
if(is_hot())
. = "<span class='notice'>[user] lights [A] with [src].</span>"
else
. = ""

View File

@@ -31,39 +31,20 @@
/obj/item/candle/attackby(obj/item/weapon/W, mob/user, params)
..()
if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
if(WT.isOn()) //Badasses dont get blinded by lighting their candle with a welding tool
light("<span class='danger'>[user] casually lights the [name] with [W], what a badass.</span>")
else if(istype(W, /obj/item/weapon/lighter))
var/obj/item/weapon/lighter/L = W
if(L.lit)
light()
else if(istype(W, /obj/item/weapon/match))
var/obj/item/weapon/match/M = W
if(M.lit)
light()
else if(istype(W, /obj/item/candle))
var/obj/item/candle/C = W
if(C.lit)
light()
else if(istype(W, /obj/item/clothing/mask/cigarette))
var/obj/item/clothing/mask/cigarette/M = W
if(M.lit)
light()
var/msg = W.ignition_effect(src, user)
if(msg)
light(msg)
/obj/item/candle/fire_act()
if(!src.lit)
light() //honk
return
/obj/item/candle/proc/light(show_message)
if(!src.lit)
src.lit = TRUE
//src.damtype = "fire"
if(show_message)
usr.visible_message(
"<span class='danger'>[usr] lights the [name].</span>")
usr.visible_message(show_message)
SetLuminosity(CANDLE_LUMINOSITY)
START_PROCESSING(SSobj, src)
update_icon()

View File

@@ -5,6 +5,7 @@
icon = 'icons/obj/cardboard_cutout.dmi'
icon_state = "cutout_basic"
w_class = 4
burn_state = FLAMMABLE
var/list/possible_appearances = list("Assistant", "Clown", "Mime", "Traitor", "Nuke Op", "Cultist", "Clockwork Cultist", "Revolutionary", "Wizard", "Shadowling", "Xenomorph", "Swarmer", \
"Ash Walker", "Deathsquad Officer", "Ian") //Possible restyles for the cutout; add an entry in change_appearance() if you add to here
var/pushed_over = FALSE //If the cutout is pushed over and has to be righted

View File

@@ -199,9 +199,7 @@ obj/item/device/flashlight/lamp/bananalamp
..()
/obj/item/device/flashlight/flare/process()
var/turf/pos = get_turf(src)
if(pos)
pos.hotspot_expose(produce_heat, 5)
open_flame(heat)
fuel = max(fuel - 1, 0)
if(!fuel || !on)
turn_off()
@@ -209,6 +207,13 @@ obj/item/device/flashlight/lamp/bananalamp
icon_state = "[initial(icon_state)]-empty"
STOP_PROCESSING(SSobj, src)
/obj/item/device/flashlight/flare/ignition_effect(atom/A, mob/user)
if(fuel && on)
. = "<span class='notice'>[user] lights [A] with [src] like a real \
badass.</span>"
else
. = ""
/obj/item/device/flashlight/flare/proc/turn_off()
on = 0
force = initial(src.force)

View File

@@ -27,14 +27,11 @@ CIGARETTE PACKETS ARE IN FANCY.DM
heat = 1000
/obj/item/weapon/match/process()
var/turf/location = get_turf(src)
smoketime--
if(smoketime < 1)
matchburnout()
return
if(location)
location.hotspot_expose(700, 5)
return
else
open_flame(heat)
/obj/item/weapon/match/fire_act()
matchignite()
@@ -134,8 +131,8 @@ CIGARETTE PACKETS ARE IN FANCY.DM
. = ..()
/obj/item/clothing/mask/cigarette/attackby(obj/item/weapon/W, mob/user, params)
if(!lit && smoketime > 0 && W.is_hot())
var/lighting_text = is_lighter(W,user)
if(!lit && smoketime > 0)
var/lighting_text = W.ignition_effect(src, user)
if(lighting_text)
light(lighting_text)
else
@@ -154,29 +151,6 @@ CIGARETTE PACKETS ARE IN FANCY.DM
else
user << "<span class='notice'>[src] is full.</span>"
/obj/item/clothing/mask/cigarette/proc/is_lighter(obj/item/O, mob/user)
var/lighting_text = null
if(istype(O, /obj/item/weapon/weldingtool))
lighting_text = "<span class='notice'>[user] casually lights the [name] with [O], what a badass.</span>"
else if(istype(O, /obj/item/weapon/lighter/greyscale)) // we have to check for this first -- zippo lighters are default
lighting_text = "<span class='notice'>After some fiddling, [user] manages to light their [name] with [O].</span>"
else if(istype(O, /obj/item/weapon/lighter))
lighting_text = "<span class='rose'>With a single flick of their wrist, [user] smoothly lights their [name] with [O]. Damn they're cool.</span>"
else if(istype(O, /obj/item/weapon/melee/energy))
var/in_mouth = ""
if(iscarbon(user))
var/mob/living/carbon/C = user
if(C.wear_mask == src)
in_mouth = ", barely missing their nose"
lighting_text = "<span class='warning'>[user] swings their \
[O][in_mouth]. They light their [name] in the process.</span>"
else if(istype(O, /obj/item/device/assembly/igniter))
lighting_text = "<span class='notice'>[user] fiddles with [O], and manages to light their [name].</span>"
else if(istype(O, /obj/item/device/flashlight/flare))
lighting_text = "<span class='notice'>[user] lights their [name] with [O] like a real badass.</span>"
else if(O.is_hot())
lighting_text = "<span class='notice'>[user] lights their [name] with [O].</span>"
return lighting_text
/obj/item/clothing/mask/cigarette/proc/light(flavor_text = null)
if(lit)
@@ -407,7 +381,6 @@ CIGARETTE PACKETS ARE IN FANCY.DM
open_flame()
if(reagents && reagents.total_volume) // check if it has any reagents at all
handle_reagents()
return
/obj/item/clothing/mask/cigarette/pipe/attackby(obj/item/O, mob/user, params)
@@ -427,7 +400,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
else
user << "<span class='warning'>It is already packed!</span>"
else
var/lighting_text = is_lighter(O,user)
var/lighting_text = O.ignition_effect(src,user)
if(lighting_text)
if(smoketime > 0)
light(lighting_text)
@@ -489,6 +462,14 @@ CIGARETTE PACKETS ARE IN FANCY.DM
I.color = color2hex(randomColor(1))
add_overlay(I)
/obj/item/weapon/lighter/greyscale/ignition_effect(atom/A, mob/user)
. = "<span class='notice'>After some fiddling, [user] manages to \
light [A] with [src].</span>"
/obj/item/weapon/lighter/ignition_effect(atom/A, mob/user)
. = "<span class='rose'>With a single flick of their wrist, [user] \
smoothly lights [A] with [src]. Damn they're cool.</span>"
/obj/item/weapon/lighter/update_icon()
icon_state = lit ? "[icon_state]_on" : "[initial(icon_state)]"
@@ -548,18 +529,13 @@ CIGARETTE PACKETS ARE IN FANCY.DM
..()
/obj/item/weapon/lighter/process()
var/turf/location = get_turf(src)
if(location)
location.hotspot_expose(700, 5)
return
open_flame()
/obj/item/weapon/lighter/pickup(mob/user)
..()
if(lit)
SetLuminosity(0)
user.AddLuminosity(1)
return
/obj/item/weapon/lighter/dropped(mob/user)
..()
@@ -567,7 +543,6 @@ CIGARETTE PACKETS ARE IN FANCY.DM
if(user)
user.AddLuminosity(-1)
SetLuminosity(1)
return
/obj/item/weapon/lighter/is_hot()
return lit * heat

View File

@@ -177,4 +177,3 @@
theturf.MakeSlippery(min_wet_time = 10, wet_time_to_add = 5)
user.visible_message("[user] empties out \the [src] onto the floor using the release valve.", "<span class='info'>You quietly empty out \the [src] using its release valve.</span>")
return

View File

@@ -63,6 +63,16 @@
if(item_color == null)
item_color = pick("red", "blue", "green", "purple")
/obj/item/weapon/melee/energy/sword/Destroy()
STOP_PROCESSING(SSobj, src)
. = ..()
/obj/item/weapon/melee/energy/sword/process()
if(active)
open_flame()
else
STOP_PROCESSING(SSobj, src)
/obj/item/weapon/melee/energy/sword/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance)
if(active)
return ..()
@@ -87,6 +97,7 @@
w_class = w_class_on
playsound(user, 'sound/weapons/saberon.ogg', 35, 1) //changed it from 50% volume to 35% because deafness
user << "<span class='notice'>[src] is now active.</span>"
START_PROCESSING(SSobj, src)
else
force = initial(force)
throwforce = initial(throwforce)
@@ -98,11 +109,26 @@
w_class = initial(w_class)
playsound(user, 'sound/weapons/saberoff.ogg', 35, 1) //changed it from 50% volume to 35% because deafness
user << "<span class='notice'>[src] can now be concealed.</span>"
STOP_PROCESSING(SSobj, src)
add_fingerprint(user)
/obj/item/weapon/melee/energy/is_hot()
return active * heat
/obj/item/weapon/melee/energy/ignition_effect(atom/A, mob/user)
if(!active)
return ""
var/in_mouth = ""
if(iscarbon(user))
var/mob/living/carbon/C = user
if(C.wear_mask == src)
in_mouth = ", barely missing their nose"
. = "<span class='warning'>[user] swings their \
[src][in_mouth]. They light [A] in the process.</span>"
playsound(loc, hitsound, get_clamped_volume(), 1, -1)
add_fingerprint(user)
/obj/item/weapon/melee/energy/sword/cyborg
var/hitcost = 50

View File

@@ -342,11 +342,11 @@
check_fuel()
if(M)
M.flash_eyes(light_intensity)
return 1
return TRUE
else
if(M)
M << "<span class='warning'>You need more welding fuel to complete this task!</span>"
return 0
return FALSE
//Returns whether or not the welding tool is currently on.
@@ -424,7 +424,13 @@
user.put_in_hands(F)
else
user << "<span class='warning'>You need one rod to start building a flamethrower!</span>"
return
/obj/item/weapon/weldingtool/ignition_effect(atom/A, mob/user)
if(welding && remove_fuel(1, user))
. = "<span class='notice'>[user] casually lights [A] with [src], \
what a badass.</span>"
else
. = ""
/obj/item/weapon/weldingtool/largetank
name = "industrial welding tool"

View File

@@ -211,15 +211,19 @@
var/hacked = 0
/obj/item/weapon/twohanded/dualsaber/New()
..()
item_color = pick("red", "blue", "green", "purple")
/obj/item/weapon/twohanded/dualsaber/Destroy()
STOP_PROCESSING(SSobj, src)
. = ..()
/obj/item/weapon/twohanded/dualsaber/update_icon()
if(wielded)
icon_state = "dualsaber[item_color][wielded]"
else
icon_state = "dualsaber0"
clean_blood()//blood overlays get weird otherwise, because the sprite changes.
return
/obj/item/weapon/twohanded/dualsaber/attack(mob/target, mob/living/carbon/human/user)
if(user.has_dna())
@@ -232,7 +236,9 @@
impale(user)
return
if((wielded) && prob(50))
spawn(0)
addtimer(src, "jedi_spin", 0, TRUE, user)
/obj/item/weapon/twohanded/dualsaber/proc/jedi_spin(mob/living/user)
for(var/i in list(1,2,4,8,4,2,1,2,4,8,4,2))
user.setDir(i)
if(i == 8)
@@ -265,17 +271,41 @@
w_class = w_class_on
..()
hitsound = 'sound/weapons/blade1.ogg'
START_PROCESSING(SSobj, src)
/obj/item/weapon/twohanded/dualsaber/unwield() //Specific unwield () to switch hitsounds.
sharpness = initial(sharpness)
w_class = initial(w_class)
..()
hitsound = "swing_hit"
STOP_PROCESSING(SSobj, src)
/obj/item/weapon/twohanded/dualsaber/process()
if(wielded)
open_flame()
else
STOP_PROCESSING(SSobj, src)
/obj/item/weapon/twohanded/dualsaber/IsReflect()
if(wielded)
return 1
/obj/item/weapon/twohanded/dualsaber/ignition_effect(atom/A, mob/user)
// same as /obj/item/weapon/melee/energy, mostly
if(!wielded)
return ""
var/in_mouth = ""
if(iscarbon(user))
var/mob/living/carbon/C = user
if(C.wear_mask == src)
in_mouth = ", barely missing their nose"
. = "<span class='warning'>[user] swings their \
[src][in_mouth]. They light [A] in the process.</span>"
playsound(loc, hitsound, get_clamped_volume(), 1, -1)
add_fingerprint(user)
// Light your candles while spinning around the room
addtimer(src, "jedi_spin", 0, TRUE, user)
/obj/item/weapon/twohanded/dualsaber/green/New()
item_color = "green"

View File

@@ -219,5 +219,3 @@
/obj/proc/CanAStarPass()
. = !density

View File

@@ -0,0 +1,153 @@
#define LOG_BURN_TIMER 150
#define PAPER_BURN_TIMER 5
#define MAXIMUM_BURN_TIMER 3000
/obj/structure/fireplace
name = "fireplace"
desc = "A large stone brick fireplace."
icon = 'icons/obj/fireplace.dmi'
icon_state = "fireplace"
density = FALSE
anchored = TRUE
pixel_x = -16
burn_state = FIRE_PROOF
var/lit = FALSE
var/fuel_added = 0
var/flame_expiry_timer
/obj/structure/fireplace/New()
..()
START_PROCESSING(SSobj, src)
/obj/structure/fireplace/Destroy()
STOP_PROCESSING(SSobj, src)
. = ..()
/obj/structure/fireplace/proc/try_light(obj/item/O, mob/user)
if(lit)
user << "<span class='warning'>It's already lit!</span>"
return FALSE
if(!fuel_added)
user << "<span class='warning'>[src] needs some fuel to burn!</span>"
return FALSE
var/msg = O.ignition_effect(src, user)
if(msg)
visible_message(msg)
ignite()
return TRUE
/obj/structure/fireplace/attackby(obj/item/T, mob/user)
if(istype(T,/obj/item/stack/sheet/mineral/wood))
var/obj/item/stack/sheet/mineral/wood/wood = T
var/space_remaining = MAXIMUM_BURN_TIMER - burn_time_remaining()
var/space_for_logs = round(space_remaining / LOG_BURN_TIMER)
if(space_for_logs < 1)
user << "<span class='warning'>You can't fit any more of [T] in \
[src]!</span>"
return
var/logs_used = min(space_for_logs, wood.amount)
wood.use(logs_used)
adjust_fuel_timer(LOG_BURN_TIMER * logs_used)
user.visible_message("<span class='notice'>[user] tosses some \
wood into [src].</span>", "<span class='notice'>You add \
some fuel to [src].</span>")
else if(istype(T, /obj/item/weapon/paper_bin))
var/obj/item/weapon/paper_bin/paper_bin = T
user.visible_message("<span class='notice'>[user] throws [T] into \
[src].</span>", "<span class='notice'>You add [T] to [src].\
</span>")
adjust_fuel_timer(PAPER_BURN_TIMER * paper_bin.amount)
qdel(paper_bin)
else if(istype(T, /obj/item/weapon/paper))
user.visible_message("<span class='notice'>[user] throws [T] into \
[src].</span>", "<span class='notice'>You throw [T] into [src].\
</span>")
adjust_fuel_timer(PAPER_BURN_TIMER)
qdel(T)
else if(try_light(T,user))
return
else
. = ..()
/obj/structure/fireplace/update_icon()
cut_overlays()
if(lit)
switch(burn_time_remaining())
if(0 to 500)
add_overlay("fireplace_fire0")
if(500 to 1000)
add_overlay("fireplace_fire1")
if(1000 to 1500)
add_overlay("fireplace_fire2")
if(1500 to 2000)
add_overlay("fireplace_fire3")
if(2000 to MAXIMUM_BURN_TIMER)
add_overlay("fireplace_fire4")
add_overlay("fireplace_glow")
/obj/structure/fireplace/proc/adjust_light()
if(!lit)
SetLuminosity(0)
return
switch(burn_time_remaining())
if(0 to 500)
SetLuminosity(1)
if(500 to 1000)
SetLuminosity(2)
if(1000 to 1500)
SetLuminosity(3)
if(1500 to 2000)
SetLuminosity(4)
if(2000 to MAXIMUM_BURN_TIMER)
SetLuminosity(6)
/obj/structure/fireplace/process()
if(!lit)
return
if(world.time > flame_expiry_timer)
put_out()
return
playsound(src, 'sound/effects/comfyfire.ogg',50,0, 0, 1)
var/turf/T = get_turf(src)
T.hotspot_expose(700, 5)
update_icon()
adjust_light()
/obj/structure/fireplace/extinguish()
if(lit)
var/fuel = burn_time_remaining()
flame_expiry_timer = 0
put_out()
adjust_fuel_timer(fuel)
. = ..()
/obj/structure/fireplace/proc/adjust_fuel_timer(amount)
if(lit)
flame_expiry_timer += amount
if(burn_time_remaining() < MAXIMUM_BURN_TIMER)
flame_expiry_timer = world.time + MAXIMUM_BURN_TIMER
else
fuel_added = Clamp(fuel_added + amount, 0, MAXIMUM_BURN_TIMER)
/obj/structure/fireplace/proc/burn_time_remaining()
if(lit)
return max(0, flame_expiry_timer - world.time)
else
return max(0, fuel_added)
/obj/structure/fireplace/proc/ignite()
lit = TRUE
desc = "A large stone brick fireplace, warm and cozy."
flame_expiry_timer = world.time + fuel_added
fuel_added = 0
update_icon()
adjust_light()
/obj/structure/fireplace/proc/put_out()
lit = FALSE
update_icon()
adjust_light()
desc = initial(desc)

View File

@@ -15,8 +15,7 @@
/obj/item/device/assembly/igniter/Destroy()
qdel(sparks)
sparks = null
return ..()
. = ..()
/obj/item/device/assembly/igniter/activate()
if(!..())
@@ -27,8 +26,12 @@
sparks.start()
return 1
/obj/item/device/assembly/igniter/attack_self(mob/user)
activate()
add_fingerprint(user)
return
/obj/item/device/assembly/igniter/ignition_effect(atom/A, mob/user)
. = "<span class='notice'>[user] fiddles with [src], and manages to \
light [A].</span>"
activate()
add_fingerprint(user)

View File

@@ -17,58 +17,59 @@
name = "Lumbermill"
icon_state = "away3"
/*Cabin code*/
/obj/structure/fireplace
name = "fireplace"
/obj/structure/firepit
name = "firepit"
desc = "warm and toasty"
icon = 'icons/obj/stationobjs.dmi'
icon_state = "fireplace-active"
icon = 'icons/obj/fireplace.dmi'
icon_state = "firepit-active"
density = 0
var/active = 1
/obj/structure/fireplace/initialize()
/obj/structure/firepit/initialize()
..()
toggleFireplace()
toggleFirepit()
/obj/structure/fireplace/attack_hand(mob/living/user)
/obj/structure/firepit/attack_hand(mob/living/user)
if(active)
active = 0
toggleFireplace()
toggleFirepit()
else
..()
/obj/structure/fireplace/attackby(obj/item/W,mob/living/user,params)
/obj/structure/firepit/attackby(obj/item/W,mob/living/user,params)
if(!active)
if(W.is_hot())
active = 1
toggleFireplace()
var/msg = W.ignition_effect(src, user)
if(msg)
active = TRUE
visible_message(msg)
toggleFirepit()
else
return ..()
else
W.fire_act()
/obj/structure/fireplace/proc/toggleFireplace()
/obj/structure/firepit/proc/toggleFirepit()
if(active)
SetLuminosity(8)
icon_state = "fireplace-active"
icon_state = "firepit-active"
else
SetLuminosity(0)
icon_state = "fireplace"
icon_state = "firepit"
/obj/structure/fireplace/extinguish()
/obj/structure/firepit/extinguish()
if(active)
active = 0
toggleFireplace()
active = FALSE
toggleFirepit()
/obj/structure/fireplace/fire_act()
/obj/structure/firepit/fire_act()
if(!active)
active = 1
toggleFireplace()
active = TRUE
toggleFirepit()
//other Cabin Stuff//
/obj/machinery/recycler/lumbermill
name = "lumbermill saw"

View File

@@ -11,18 +11,24 @@
pressure_resistance = 8
burn_state = FLAMMABLE
var/amount = 30 //How much paper is in the bin.
var/list/papers = new/list() //List of papers put in the bin for reference.
var/list/papers = list() //List of papers put in the bin for reference.
/obj/item/weapon/paper_bin/fire_act()
if(!amount)
return
..()
/obj/item/weapon/paper_bin/Destroy()
if(papers)
for(var/i in papers)
qdel(i)
papers = null
. = ..()
/obj/item/weapon/paper_bin/burn()
amount = 0
extinguish()
update_icon()
return
/obj/item/weapon/paper_bin/MouseDrop(atom/over_object)
var/mob/living/M = usr

View File

@@ -125,7 +125,6 @@
G.temperature = max(min(G.temperature-(CT*1000),G.temperature/CT),0)
G.react()
qdel(hotspot)
return
/*
* Water reaction to an object

BIN
icons/obj/fireplace.dmi Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

BIN
sound/effects/comfyfire.ogg Normal file

Binary file not shown.

View File

@@ -740,6 +740,7 @@
#include "code\game\objects\structures\extinguisher.dm"
#include "code\game\objects\structures\false_walls.dm"
#include "code\game\objects\structures\fireaxe.dm"
#include "code\game\objects\structures\fireplace.dm"
#include "code\game\objects\structures\flora.dm"
#include "code\game\objects\structures\fluff.dm"
#include "code\game\objects\structures\ghost_role_spawners.dm"