Files
Paradise/code/game/objects/items/candle.dm
elly1989@rocketmail.com 48088b79d9 ugh...this was horrible. I'm really sorry if I fucked anything up, I was literally going braindead towards the end.
Replaced every l_hand = and r_hand = and all that if(hand) crap to use standardised procs. This means we can use procs like Dropped() reliably as they will always be called when things are dropped.

Thorough documentation to come. But generally, if you want a mob's icons to update after deleting something in the inventory...use drop_from_inventory(the_thing_you_wanna_drop) just before deleting it. If you wanna put something in a mob's hands use put_in_hands() (or one of the variants). It'll try putting it in active hand first, then inactive, then the floor. They handle layers, overlays, screenlocs calling various procs such as dropped() etc for you. Easy

mob.equipped() is now mob.get_active_hand() because there was another totally unrelated proc named equipped() and stuff was confusing.

Weakening was made instantaneous.

Minor optimisations for human/handle_regular_status_updates(). I'll port these changes over to the other mobs next. Basically it should stop it constantly incrementing every status effect even after death.

umm... bunch of overlays related fixes... I think that's everything. :/

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3900 316c924e-a436-60f5-8080-3fe189b3f50e
2012-06-23 21:24:45 +00:00

127 lines
2.9 KiB
Plaintext

//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32
#define CANDLE_LUM 3
/obj/item/candle
name = "red candle"
desc = "a candle"
icon = 'candle.dmi'
icon_state = "candle1"
item_state = "candle1"
var/wax = 200
var/lit = 0
proc
light(var/flavor_text = "\red [usr] lights the [name].")
update_icon()
var/i
if(wax>150)
i = 1
else if(wax>80)
i = 2
else i = 3
icon_state = "candle[i][lit ? "_lit" : ""]"
attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
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("\red [user] casually lights the [name] with [W], what a badass.")
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()
light(var/flavor_text = "\red [usr] lights the [name].")
if(!src.lit)
src.lit = 1
//src.damtype = "fire"
for(var/mob/O in viewers(usr, null))
O.show_message(flavor_text, 1)
sd_SetLuminosity(CANDLE_LUM)
processing_objects.Add(src)
process()
if(!lit)
return
wax--
if(!wax)
new/obj/item/trash/candle(src.loc)
if(istype(src.loc, /mob))
src.dropped()
del(src)
update_icon()
if(istype(loc, /turf)) //start a fire if possible
var/turf/T = loc
T.hotspot_expose(700, 5)
attack_self(mob/user as mob)
if(lit)
lit = 0
update_icon()
sd_SetLuminosity(0)
user.total_luminosity -= CANDLE_LUM
pickup(mob/user)
if(lit)
src.sd_SetLuminosity(0)
user.total_luminosity += CANDLE_LUM
dropped(mob/user)
if(lit)
user.total_luminosity -= CANDLE_LUM
src.sd_SetLuminosity(CANDLE_LUM)
///////////////
//CANDLE PACK//
///////////////
/obj/item/weapon/candlepack
name = "Candle pack"
//desc = "The most popular brand of Space Cigarettes, sponsors of the Space Olympics."
icon = 'candle.dmi'
icon_state = "pack5"
item_state = "pack5"
w_class = 1
throwforce = 2
var/candlecount = 5
flags = TABLEPASS
slot_flags = SLOT_BELT
/obj/item/weapon/candlepack/update_icon()
src.icon_state = text("pack[]", src.candlecount)
src.desc = text("There are [] candles left!", src.candlecount)
return
/obj/item/weapon/candlepack/attack_hand(mob/user as mob)
if(user.r_hand == src || user.l_hand == src)
if(src.candlecount == 0)
//user << "\red You're out of cigs, shit! How you gonna get through the rest of the day..."
return
else
src.candlecount--
user.put_in_hands(new /obj/item/candle(user))
else
return ..()
src.update_icon()
return