forked from tgstation/tgstation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
new_year.dm
138 lines (128 loc) · 3.79 KB
/
new_year.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/obj/effect/new_year_tree
name = "The fir"
desc = "This is a fir. Real fir on dammit spess station. You smell pine-needles."
icon = 'icons/effects/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 = 'icons/obj/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, 'sound/weapons/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, 'sound/weapons/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, 'sound/effects/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"
*/