Files
Paradise/code/game/objects/new_year.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

138 lines
3.7 KiB
Plaintext

/obj/effect/new_year_tree
name = "The fir"
desc = "This is a fir. Real fir on dammit spess station. You smell pine-needles."
icon = '160x160.dmi'
icon_state = "new-year-tree"
anchored = 1
opacity = 1
density = 1
layer = 5
pixel_x = -64
//pixel_y = -64
/obj/effect/new_year_tree/attackby(obj/item/W, mob/user)
if (istype(W, /obj/item/weapon/grab))
return
W.loc = src
if (user.client)
user.client.screen -= W
user.u_equip(W)
var/const/bottom_right_x = 115.0
var/const/bottom_right_y = 150.0
var/const/top_left_x = 15.0
var/const/top_left_y = 15.0
var/const/bottom_med_x = top_left_x+(bottom_right_x-top_left_x)/2
var/x = rand(top_left_x,bottom_med_x) //point in half of circumscribing rectangle
var/y = rand(top_left_y,bottom_right_y)
/*
y1=a*x1+b
y2=a*x2+b b = y2-a*x2
y1=a*x1+ y2-a*x2
a*(x1-x2)+y2-y1=0
a = (y1-y2)/(x1-x2)
*/
var/a = (top_left_y-bottom_right_y)/(top_left_x-bottom_med_x)
var/b = bottom_right_y-a*bottom_med_x
if (a*x+b < y) //if point is above diagonal top_left -> bottom_median
x = bottom_med_x + x - top_left_x
y = bottom_right_y - y + top_left_y
var/image/I = image(W.icon, W, icon_state = W.icon_state)
I.pixel_x = x
I.pixel_y = y
overlays += I
/obj/item/weapon/firbang
desc = "It is set to detonate in 10 seconds."
name = "firbang"
icon = 'grenade.dmi'
icon_state = "flashbang"
var/state = null
var/det_time = 100.0
w_class = 2.0
item_state = "flashbang"
throw_speed = 4
throw_range = 20
flags = FPRINT | TABLEPASS | CONDUCT
slot_flags = SLOT_BELT
/obj/item/weapon/firbang/afterattack(atom/target as mob|obj|turf|area, mob/user as mob)
if (user.get_active_hand() == src)
if ((CLUMSY in usr.mutations) && prob(50))
user << "\red Huh? How does this thing work?!"
src.state = 1
src.icon_state = "flashbang1"
playsound(src.loc, 'armbomb.ogg', 75, 1, -3)
spawn( 5 )
prime()
return
else if (!( src.state ))
user << "\red You prime the [src]! [det_time/10] seconds!"
src.state = 1
src.icon_state = "flashbang1"
playsound(src.loc, 'armbomb.ogg', 75, 1, -3)
spawn( src.det_time )
prime()
return
user.dir = get_dir(user, target)
user.drop_item()
var/t = (isturf(target) ? target : target.loc)
walk_towards(src, t, 3)
src.add_fingerprint(user)
return
/obj/item/weapon/firbang/attack_paw(mob/user as mob)
return src.attack_hand(user)
/obj/item/weapon/firbang/attack_hand()
walk(src, null, null)
..()
return
/obj/item/weapon/firbang/proc/prime()
playsound(src.loc, 'bang.ogg', 25, 1)
var/turf/T = get_turf(src)
if(T)
var/datum/effect/effect/system/harmless_smoke_spread/smoke = new
smoke.set_up(3, 0, src.loc)
smoke.attach(src)
smoke.start()
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(3, 1, src)
s.start()
new /obj/effect/new_year_tree(T)
del(src)
return
/obj/item/weapon/firbang/attack_self(mob/user as mob)
if (!src.state)
if (CLUMSY in user.mutations)
user << "\red Huh? How does this thing work?!"
spawn( 5 )
prime()
return
else
user << "\red You prime the [src]! [det_time/10] seconds!"
src.state = 1
src.icon_state = "flashbang1"
add_fingerprint(user)
spawn( src.det_time )
prime()
return
return
/*
/datum/supply_packs/new_year
name = "New Year Celebration Equipment"
contains = list("/obj/item/weapon/firbang",
"/obj/item/weapon/firbang",
"/obj/item/weapon/firbang",
"/obj/item/weapon/wrapping_paper",
"/obj/item/weapon/wrapping_paper",
"/obj/item/weapon/wrapping_paper")
cost = 20
containertype = "/obj/structure/closet/crate"
containername = "New Year Celebration crate"
*/