forked from OpenDreamProject/OpenDream
-
Notifications
You must be signed in to change notification settings - Fork 0
/
code.dm
288 lines (239 loc) · 7.28 KB
/
code.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
#ifndef OPENDREAM
/world/proc/ODHotReloadInterface()
world.log << "OpenDream-specific procs don't exist in BYOND."
return
/world/proc/ODHotReloadResource()
world.log << "OpenDream-specific procs don't exist in BYOND."
return
#endif
#define TURF_PLANE -10
/obj/plane_master
appearance_flags = PLANE_MASTER
/obj/plane_master/turf
screen_loc = "1,1"
plane = TURF_PLANE
New()
src.filters = filter(type="displace", size=100, icon=icon('icons/displace.dmi',"lense"))
/mob/verb/examine(atom/thing as obj|mob in world)
set category = null
usr << "This is [thing]. [thing.desc]"
/mob/verb/possess_key(mob/someone as mob in world)
set category = null
someone.ckey = usr.key
/turf
icon = 'icons/turf.dmi'
icon_state = "turf"
layer = TURF_LAYER
plane = TURF_PLANE
/turf/blue
icon_state = "turf_blue"
/area/withicon
icon = 'icons/objects.dmi'
icon_state = "overlay"
New()
toggleBlink()
proc/toggleBlink()
if (icon == 'icons/objects.dmi')
icon = null
else
icon = 'icons/objects.dmi'
spawn(20)
toggleBlink()
/mob
icon = 'icons/mob.dmi'
icon_state = "mob"
layer = MOB_LAYER
plane = 5
blend_mode = BLEND_OVERLAY
name = "Square Man"
desc = "Such a beautiful smile."
gender = MALE
see_invisible = 101
New()
..()
loc = locate(5, 5, 1)
Login()
world.log << "login ran"
src.client.screen += new /obj/order_test_item/plane_master //used for render tests
verb/winget_test()
usr << "windows: [json_encode(winget(usr, null, "windows"))]"
usr << "panes: [json_encode(winget(usr, null, "panes"))]"
usr << "menus: [json_encode(winget(usr, null, "menus"))]"
usr << "macros: [json_encode(winget(usr, null, "macros"))]"
verb/browse_rsc_test()
usr << browse_rsc('icons/mob.dmi', "mobicon.png")
usr << browse_rsc('icons/mob.dmi', "mobicon.png")
usr << browse("<p><img src=mobicon.png></p>Oh look, it's you!","window=honk")
verb/rotate()
for(var/i in 1 to 8)
src.transform = src.transform.Turn(45)
sleep(2)
verb/shake()
animate(src, pixel_x = -4, time = 2)
sleep(2)
for (var/i in 1 to 3)
animate(src, pixel_x = 4, time = 4)
sleep(4)
animate(src, pixel_x = -4, time = 4)
sleep(4)
animate(src, pixel_x = 0, time = 2)
verb/tell_location()
set name = "Tell Location"
usr << "You are at ([x], [y], [z])"
verb/say(message as text)
var/list/viewers = viewers()
for (var/mob/viewer in viewers)
viewer << "[ckey] says: \"[message]\""
verb/say_loud()
var/msg = input("Please put the message you want to say loudly.", "Say Loud", "Hello!")
world << "[ckey] says loudly: \"[msg]\""
verb/show_ohearers()
var/list/ohearers = ohearers()
usr << "All hearers: "
for (var/mob/hearer in ohearers)
usr << hearer
verb/start_walk()
set name = "Walk North"
usr << "Walking north. Use the 'Walk Stop' verb to cease."
walk(src, NORTH)
verb/start_walk_rand()
set name = "Walk Randomly"
usr << "Walking randomly. Use the 'Walk Stop' verb to cease."
walk_rand(src)
verb/stop_walk()
set name = "Walk Stop"
usr << "Walking stopped."
walk(src, 0)
verb/move_up()
step(src, UP)
verb/move_down()
step(src, DOWN)
verb/roll_dice(dice as text)
var/result = roll(dice)
usr << "The total shown on the dice is: [result]"
verb/test_alert()
set category = "Test"
alert(usr, "Prepare to die.")
usr << "prompt done"
verb/input_num()
var/v = input("A") as num
usr << "you entered [v]"
verb/test_browse()
set category = "Test"
usr << browse({"
<!DOCTYPE html>
<html>
<head>
<title>Foo</title>
<style>
body {
background: red;
}
</style>
<script>
function foo(v) {
document.getElementById("mark").innerHTML = v;
}
</script>
</head>
<body>
<marquee id="mark">Honk</marquee>
<a href="?honk=1">click me</a>
</body>
</html>"},"window=honk")
verb/test_output()
set category = "Test"
usr << output("help sec griffing me", "honk.browser:foo")
verb/demo_filters()
set category = "Test"
if(length(src.filters))
src.filters = null
usr << "Filters cleared"
else
var/selected = input("Pick a filter", "Choose a filter to apply (with demo settings)", null) as null|anything in list("alpha", "alpha-swap", "alpha-inverse", "alpha-both", "color", "displace", "outline", "greyscale", "blur", "outline/grey", "grey/outline", "drop_shadow")
if(isnull(selected))
src.filters = null
usr << "No filter selected, filters cleared"
switch(selected)
if("alpha")
src.filters = filter(type="alpha", icon=icon('icons/objects.dmi',"checker"))
if("alpha-swap")
src.filters = filter(type="alpha", icon=icon('icons/objects.dmi',"checker"), flags=MASK_SWAP)
if("alpha-inverse")
src.filters = filter(type="alpha", icon=icon('icons/objects.dmi',"checker"), flags=MASK_INVERSE)
if("alpha-both")
src.filters = filter(type="alpha", icon=icon('icons/objects.dmi',"checker"), flags=MASK_INVERSE|MASK_SWAP)
if("outline")
src.filters = filter(type="outline", size=1, color=rgb(255,0,0))
if("greyscale")
src.filters = filter(type="greyscale")
if("blur")
src.filters = filter(type="blur", size=2)
if("outline/grey")
src.filters = list(filter(type="outline", size=1, color=rgb(255,0,0)), filter(type="greyscale"))
if("grey/outline")
src.filters = list(filter(type="greyscale"), filter(type="outline", size=1, color=rgb(255,0,0)))
if("color")
src.filters = filter(type="color", color=list("#de0000","#000000","#00ad00"))
if("drop_shadow")
src.filters = filter(type="drop_shadow", size=2)
if("displace")
src.client.screen += new /obj/plane_master/turf
usr << "Applied [selected] filter"
verb/toggle_see_invisibility()
if(src.see_invisible == 0)
src.see_invisible = 101
usr << "now seeing invisible things"
else
src.see_invisible = 0
usr << "now blind to invisible things"
verb/add_client_image()
var/image/i = image(icon = 'icons/hanoi.dmi', icon_state="8")
i.loc = src
i.override = 1
src.client.images += i
usr << "override added"
for(var/turf/T in range(src, 2))
var/image/turf_image = image(icon = 'icons/hanoi.dmi', loc=T, icon_state="1")
src.client.images += turf_image
spawn(25)
src << "changing image"
i.icon_state = "5"
spawn(50)
src.client.images.Cut()
verb/test_hide_main_window()
src << "hiding main window"
winset(src,"mainwindow","is-visible=false")
spawn(20)
src << "showing main window"
winset(src,"mainwindow","is-visible=true")
verb/winget_text_verb(var/rawtext as command_text)
set name = "wingettextverb"
world << "recieved: [rawtext]"
verb/test_hot_reload_interface()
set category = "Test"
src << "trying hot reload of interface..."
world.ODHotReloadInterface()
src << "done hot reload of interface!"
verb/test_hot_reload_icon()
set category = "Test"
src << "trying hot reload of icon..."
world.ODHotReloadResource("icons/turf.dmi")
src << "done hot reload of icon!"
verb/manipulate_world_size()
var/x = input("New World X?", "World Size", 0) as num|null
var/y = input("New World Y?", "World Size", 0) as num|null
if(!x || !y)
return
world.maxx = x
world.maxy = y
verb/toggle_show_popups()
client.show_popup_menus = !client.show_popup_menus
src << "Popups are now [client.show_popup_menus ? "enabled" : "disabled"]"
/mob/Stat()
if (statpanel("Status"))
stat("tick_usage", world.tick_usage)
stat("time", world.time)
/world/New()
..()
world.log << "World loaded!"