Files
Bubberstation/code/game/objects/items/candle.dm
coiax 6449b65d30 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
2016-07-06 10:16:47 +12:00

99 lines
1.9 KiB
Plaintext

#define CANDLE_LUMINOSITY 2
/obj/item/candle
name = "red candle"
desc = "In Greek myth, Prometheus stole fire from the Gods and gave it to \
humankind. The jewelry he kept for himself."
icon = 'icons/obj/candle.dmi'
icon_state = "candle1"
item_state = "candle1"
w_class = 1
var/wax = 200
var/lit = FALSE
var/infinite = FALSE
var/start_lit = FALSE
heat = 1000
/obj/item/candle/New()
..()
if(start_lit)
// No visible message
light(show_message = FALSE)
/obj/item/candle/update_icon()
var/i
if(wax>150)
i = 1
else if(wax>80)
i = 2
else i = 3
icon_state = "candle[i][lit ? "_lit" : ""]"
/obj/item/candle/attackby(obj/item/weapon/W, mob/user, params)
..()
var/msg = W.ignition_effect(src, user)
if(msg)
light(msg)
/obj/item/candle/fire_act()
if(!src.lit)
light() //honk
/obj/item/candle/proc/light(show_message)
if(!src.lit)
src.lit = TRUE
//src.damtype = "fire"
if(show_message)
usr.visible_message(show_message)
SetLuminosity(CANDLE_LUMINOSITY)
START_PROCESSING(SSobj, src)
update_icon()
/obj/item/candle/process()
if(!lit)
return
if(!infinite)
wax--
if(!wax)
new/obj/item/trash/candle(src.loc)
if(istype(src.loc, /mob))
var/mob/M = src.loc
M.unEquip(src, 1) //src is being deleted anyway
qdel(src)
update_icon()
open_flame()
/obj/item/candle/attack_self(mob/user)
if(lit)
user.visible_message(
"<span class='notice'>[user] snuffs [src].</span>")
lit = FALSE
update_icon()
SetLuminosity(0)
user.AddLuminosity(-CANDLE_LUMINOSITY)
/obj/item/candle/pickup(mob/user)
..()
if(lit)
SetLuminosity(0)
user.AddLuminosity(CANDLE_LUMINOSITY)
/obj/item/candle/dropped(mob/user)
..()
if(lit)
user.AddLuminosity(-CANDLE_LUMINOSITY)
SetLuminosity(CANDLE_LUMINOSITY)
/obj/item/candle/is_hot()
return lit * heat
/obj/item/candle/infinite
infinite = TRUE
start_lit = TRUE
#undef CANDLE_LUMINOSITY