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
|
Pos Lua >> Moon
2 1:[ local util = require("util") ] >> 2:[ util = require "util" ]
24 2:[ local broadphase = require("broadphase") ] >> 3:[ broadphase = require "broadphase" ]
58 3:[ local main = require("main") ] >> 4:[ main = require "main" ]
80 4:[ local constrain = require("constrain") ] >> 5:[ constrain = require "constrain" ]
112 5:[ local color = require("color") ] >> 6:[ color = require "color" ]
136 6:[ local room = require("room") ] >> 7:[ room = require "room" ]
179 8:[ LobbyRoom = room.LobbyRoom ] >> 8:[ import LobbyRoom from room ]
185 9:[ local ability_reg = require("ability_reg") ] >> 9:[ ability_reg = require "ability_reg" ]
223 10:[ local mod = ... ] >> 12:[ mod = ... ]
233 11:[ mod.characters = { } ] >> 13:[ mod.characters = {} ]
253 12:[ mod.classes = { } ] >> 14:[ mod.classes = {} ]
270 13:[ require("char_tank") ] >> 15:[ require "char_tank" ]
290 14:[ require("char_mage") ] >> 16:[ require "char_mage" ]
310 15:[ require("char_theif") ] >> 17:[ require "char_theif" ]
331 16:[ require("char_fool") ] >> 18:[ require "char_fool" ]
351 17:[ require("char_jugg") ] >> 19:[ require "char_jugg" ]
371 18:[ mod.class_order = { ] >> 20:[ mod.class_order = { ]
392 19:[ "Tumbler", ] >> 21:[ "Tumbler", ]
404 20:[ "Fire Breather", ] >> 22:[ "Fire Breather", ]
422 21:[ "Juggler", ] >> 23:[ "Juggler", ]
434 22:[ "Troubador", ] >> 24:[ "Troubador", ]
448 23:[ "Juggernaut" ] >> 25:[ "Juggernaut" ]
371 24:[ } ] >> 20:[ mod.class_order = { ]
463 25:[ mod.class_order_rev = { } ] >> 27:[ mod.class_order_rev = {} ]
498 26:[ for k, v in ipairs(mod.class_order) do ] >> 28:[ for k,v in ipairs(mod.class_order) ]
524 27:[ mod.class_order_rev[v] = k ] >> 29:[ mod.class_order_rev[v] = k ]
488 28:[ end ] >> 28:[ for k,v in ipairs(mod.class_order) ]
551 29:[ print("After requireing characters, mod.classes was", mod.classes) ] >> 30:[ print("After requireing characters, mod.classes was",mod.classes) ]
617 30:[ mod.enemies = { } ] >> 31:[ mod.enemies = {} ]
652 31:[ require("e_bethany") ] >> 33:[ require "e_bethany" ]
672 32:[ require("e_ruminating_randy") ] >> 34:[ require "e_ruminating_randy" ]
701 33:[ require("e_mopey_marvin") ] >> 35:[ require "e_mopey_marvin" ]
726 34:[ require("e_sullen_salley") ] >> 36:[ require "e_sullen_salley" ]
752 35:[ require("e_child") ] >> 37:[ require "e_child" ]
770 36:[ print("After requireing rat, mod.enemies was", mod.enemies) ] >> 38:[ print("After requireing rat, mod.enemies was",mod.enemies) ]
928 45:[ key = "<input>" ] >> 42:[ new:(key = "<input>") => ]
945 47:[ self.time = 0 ] >> 43:[ @time = 0 ]
957 48:[ self.key = key ] >> 44:[ @key = key ]
970 49:[ self.value = false ] >> 45:[ @value = false ]
1049 71:[ self.anim = anim ] >> 51:[ @anim = anim ]
1064 72:[ self.interupt = interupt ] >> 52:[ @interupt = interupt ]
1087 73:[ self.mode = mode ] >> 53:[ @mode = mode ]
1133 96:[ action = "<input>" ] >> 56:[ new:(action = "<input>") => ]
1150 98:[ self.time = 0 ] >> 57:[ @time = 0 ]
1162 99:[ self.action = action ] >> 58:[ @action = action ]
1180 114:[ mod.sprite_direction_co = function(self) ] >> 60:[ mod.sprite_direction_co = () => ]
1213 115:[ return function() ] >> 61:[ return () -> ]
1233 116:[ while true do ] >> 62:[ while true ]
1242 117:[ self:stop_anim(self.sprites.right) ] >> 63:[ @stop_anim(@sprites.right) ]
1272 118:[ self:stop_anim(self.sprites.left) ] >> 64:[ @stop_anim(@sprites.left) ]
1301 119:[ self:stop_anim(self.sprites.stop_right) ] >> 65:[ @stop_anim(@sprites.stop_right) ]
1336 120:[ self:stop_anim(self.sprites.stop_left) ] >> 66:[ @stop_anim(@sprites.stop_left) ]
1370 121:[ self:stop_anim(self.sprites.falling_left) ] >> 67:[ @stop_anim(@sprites.falling_left) ]
1407 122:[ self:stop_anim(self.sprites.falling_right) ] >> 68:[ @stop_anim(@sprites.falling_right) ]
1459 123:[ local _list_0 = self.inputs ] >> 69:[ for input in *@inputs ]
1473 126:[ if self.velocity.x > 0.01 then ] >> 70:[ if @velocity.x > 0.01 ]
1498 127:[ self:set_anim(self.sprites.right, 1, "loop") ] >> 71:[ @set_anim(@sprites.right,1,"loop") ]
1554 129:[ elseif self.velocity.x < -0.01 then ] >> 73:[ elseif @velocity.x < -0.01 ]
1580 130:[ self:set_anim(self.sprites.left, 1, "loop") ] >> 74:[ @set_anim(@sprites.left,1,"loop") ]
1628 134:[ coroutine.yield() ] >> 76:[ coroutine.yield! ]
1228 135:[ end ] >> 62:[ while true ]
1213 136:[ end ] >> 61:[ return () -> ]
1180 137:[ end ] >> 60:[ mod.sprite_direction_co = () => ]
1646 138:[ mod.can_die_co = function(self) ] >> 78:[ mod.can_die_co = () => ]
1670 139:[ return function() ] >> 79:[ return () -> ]
1690 140:[ while not self.dead do ] >> 80:[ while not @dead ]
1704 141:[ coroutine.yield() ] >> 81:[ coroutine.yield! ]
1685 142:[ end ] >> 80:[ while not @dead ]
1734 143:[ for k, v in pairs(self.sprites) do ] >> 83:[ for k,v in pairs @sprites ]
1755 144:[ if k ~= "idle" then ] >> 84:[ if k ~= "idle" ]
1772 145:[ self:stop_anim(v) ] >> 85:[ @stop_anim(v) ]
1753 146:[ end ] >> 84:[ if k ~= "idle" ]
1724 147:[ end ] >> 83:[ for k,v in pairs @sprites ]
1790 148:[ if self.sprites.die then ] >> 86:[ if @sprites.die ]
1807 149:[ self:set_anim(self.sprites.die, 5) ] >> 87:[ @set_anim(@sprites.die,5) ]
1788 150:[ end ] >> 86:[ if @sprites.die ]
1835 151:[ return coroutine.yield(true) ] >> 88:[ coroutine.yield(true) ]
1670 152:[ end ] >> 79:[ return () -> ]
1646 153:[ end ] >> 78:[ mod.can_die_co = () => ]
1858 154:[ mod.make_animate = function(c) ] >> 90:[ mod.make_animate = (c) -> ]
1885 155:[ assertf(c.sprites ~= nil, "Tried to animate something that had no .sprites: %q", c.__class.__name) ] >> 91:[ assertf(c.sprites ~= nil, "Tried to animate something that had no .sprites: %q", c.__class.__name) ]
1985 156:[ assertf(c.sprites.idle ~= nil and #c.sprites.idle > 0, "Tried to animate something without a .idle animation: %q", c.__class.__name) ] >> 92:[ assertf(c.sprites.idle ~= nil and #c.sprites.idle > 0, "Tried to animate something without a .idle animation: %q", c.__class.__name) ]
2119 157:[ c.anim_stack = { ] >> 93:[ c.anim_stack = {AnimFrame(c.sprites.idle,0,"loop")} ]
2135 158:[ AnimFrame(c.sprites.idle, 0, "loop") ] >> 93:[ c.anim_stack = {AnimFrame(c.sprites.idle,0,"loop")} ]
2119 159:[ } ] >> 93:[ c.anim_stack = {AnimFrame(c.sprites.idle,0,"loop")} ]
2172 160:[ c.anim = c.sprites.idle ] >> 94:[ c.anim = c.sprites.idle ]
2197 161:[ c.keyframe = 0 ] >> 95:[ c.keyframe = 0 ]
2213 162:[ c.animrate = c.animrate or 1 ] >> 96:[ c.animrate = c.animrate or 1 ]
2243 163:[ c.anim_interupt = 0 ] >> 97:[ c.anim_interupt = 0 ]
2264 164:[ c.set_anim = function(self, tbl, interupt, mode) ] >> 98:[ c.set_anim = (self,tbl,interupt,mode) -> ]
2309 165:[ if type(tbl) ~= "table" then ] >> 99:[ if type(tbl) ~= "table" ]
2334 166:[ error("Tried to set anim to something that was not a table!", 2) ] >> 100:[ error("Tried to set anim to something that was not a table!",2) ]
2307 167:[ end ] >> 99:[ if type(tbl) ~= "table" ]
2402 168:[ if #tbl == 0 then ] >> 101:[ if #tbl == 0 ]
2416 169:[ error("Tried to set anim to an empty table", 2) ] >> 102:[ error("Tried to set anim to an empty table",2) ]
2400 170:[ end ] >> 101:[ if #tbl == 0 ]
2467 171:[ if interupt > self.anim_interupt then ] >> 103:[ if interupt > @anim_interupt ]
2497 172:[ table.insert(self.anim_stack, AnimFrame(tbl, interupt, mode)) ] >> 104:[ table.insert(@anim_stack,AnimFrame(tbl,interupt,mode)) ]
2555 173:[ self.anim = self.anim_stack[#self.anim_stack].anim ] >> 105:[ @anim = @anim_stack[#@anim_stack].anim ]
2597 174:[ self.anim_interupt = interupt ] >> 106:[ @anim_interupt = interupt ]
2465 175:[ end ] >> 103:[ if interupt > @anim_interupt ]
2264 176:[ end ] >> 98:[ c.set_anim = (self,tbl,interupt,mode) -> ]
2625 177:[ c.stop_anim = function(self, tbl, err_if_unable) ] >> 108:[ c.stop_anim = (self,tbl,err_if_unable=false) -> ]
2663 179:[ err_if_unable = false ] >> 108:[ c.stop_anim = (self,tbl,err_if_unable=false) -> ]
2675 181:[ local anim_found = false ] >> 109:[ anim_found = false ]
2706 182:[ for k, v in pairs(self.anim_stack) do ] >> 110:[ for k,v in pairs @anim_stack ]
2730 183:[ if v.anim == tbl then ] >> 111:[ if v.anim == tbl ]
2785 184:[ anim_found = true ] >> 113:[ anim_found = true ]
2807 185:[ table.remove(self.anim_stack, k) ] >> 114:[ table.remove(@anim_stack,k) ]
2728 187:[ end ] >> 111:[ if v.anim == tbl ]
2696 188:[ end ] >> 110:[ for k,v in pairs @anim_stack ]
2849 189:[ if err_if_unable then ] >> 116:[ if err_if_unable ]
2867 190:[ assertf(anim_found, "Could not find animation to remove") ] >> 117:[ assertf(anim_found, "Could not find animation to remove") ]
2847 191:[ end ] >> 116:[ if err_if_unable ]
2927 192:[ self.anim = self.anim_stack[#self.anim_stack].anim ] >> 118:[ @anim = @anim_stack[#@anim_stack].anim ]
2968 193:[ self.anim_interupt = self.anim_stack[#self.anim_stack].interupt ] >> 119:[ @anim_interupt = @anim_stack[#@anim_stack].interupt ]
2625 194:[ end ] >> 108:[ c.stop_anim = (self,tbl,err_if_unable=false) -> ]
3022 195:[ return c.node:action(coroutine.create(function() ] >> 121:[ c.node\action(coroutine.create(() -> ]
3066 196:[ while not c.dead do ] >> 122:[ while not c.dead ]
3081 197:[ c.keyframe = math.floor(am.current_time() * c.animrate) % #c.anim ] >> 123:[ c.keyframe = math.floor(am.current_time()*c.animrate) % #c.anim ]
3148 198:[ local spritename = c.anim[c.keyframe + 1] ] >> 124:[ spritename = c.anim[c.keyframe + 1] ]
3187 199:[ assert(spritename, "Failed to find an appropriate image to draw.") ] >> 125:[ assert(spritename, "Failed to find an appropriate image to draw.") ]
3291 200:[ c.node("sprite").source = spritename ] >> 127:[ c.node("sprite").source = spritename ]
3331 201:[ coroutine.yield() ] >> 128:[ coroutine.yield! ]
3061 202:[ end ] >> 122:[ while not c.dead ]
3366 203:[ local keyframe_0 = am.current_time() ] >> 130:[ keyframe_0 = am.current_time() ]
3404 204:[ while c.keyframe < #c.anim - 1 do ] >> 131:[ while c.keyframe < #c.anim - 1 ]
3433 205:[ c.keyframe = math.floor((am.current_time() - keyframe_0) * c.animrate) ] >> 132:[ c.keyframe = math.floor((am.current_time! - keyframe_0)*c.animrate) ]
3504 206:[ assert(c.anim[c.keyframe + 1], "Failed to find an appropriate image to draw.") ] >> 133:[ assert(c.anim[c.keyframe + 1], "Failed to find an appropriate image to draw.") ]
3586 207:[ c.node("sprite").source = c.anim[c.keyframe + 1] ] >> 134:[ c.node("sprite").source = c.anim[c.keyframe + 1] ]
3638 208:[ coroutine.yield() ] >> 135:[ coroutine.yield! ]
3399 209:[ end ] >> 131:[ while c.keyframe < #c.anim - 1 ]
3657 210:[ c:remove() ] >> 136:[ c\remove() ]
3670 211:[ return coroutine.yield(true) ] >> 137:[ coroutine.yield(true) ]
3022 212:[ end)) ] >> 121:[ c.node\action(coroutine.create(() -> ]
1858 213:[ end ] >> 90:[ mod.make_animate = (c) -> ]
3697 214:[ mod.inherited = { } ] >> 140:[ mod.inherited = {} ]
3716 215:[ local hp_bar_width = 20 ] >> 141:[ hp_bar_width = 20 ]
5899 221:[ return string.format("<%s, %s> at (%d)", self.__class.__name, (self.class and self.class.name or "no class"), (self.data and self.data.position or -1)) ] >> 187:[ return string.format( ]
6264 224:[ for k, v in pairs(self.class) do ] >> 201:[ for k,v in pairs(@class) ]
6284 225:[ if k:match("^default") then ] >> 202:[ if k\match("^default") ]
6309 226:[ local field = k:match("^default_(.*)") ] >> 203:[ field = k\match("^default_(.*)") ]
6348 227:[ if type(v) == "function" then ] >> 204:[ if type(v) == "function" ]
6376 228:[ self.data[field] = v() ] >> 205:[ @data[field] = v! ]
6408 230:[ self.data[field] = v ] >> 207:[ @data[field] = v ]
6282 232:[ end ] >> 202:[ if k\match("^default") ]
6254 233:[ end ] >> 201:[ for k,v in pairs(@class) ]
6457 236:[ assert(self.data[name], "Field must exist to be set") ] >> 210:[ assert(@data[name], "Field must exist to be set") ]
6509 237:[ self.data[name] = value ] >> 211:[ @data[name] = value ]
6531 238:[ print("my data table is:", self.data) ] >> 212:[ print("my data table is:",@data) ]
6568 239:[ if name == "hp" then ] >> 213:[ if name == "hp" ]
6585 240:[ local perc = (self.data.hp / self.data.maxhp) * 20 ] >> 214:[ perc = (@data.hp / @data.maxhp) * 20 ]
6625 241:[ self.node("hp_fill_scale").x = perc ] >> 215:[ @.node("hp_fill_scale").x = perc ]
6566 242:[ end ] >> 213:[ if name == "hp" ]
6679 245:[ print("Serializing char:", self) ] >> 218:[ print("Serializing char:",@) ]
6710 246:[ print("Name:", self.__class.__name) ] >> 219:[ print("Name:", @@__name) ]
6737 247:[ print("uname:", self.uname) ] >> 220:[ print("uname:",@uname) ]
6762 248:[ print("data:", self.data) ] >> 221:[ print("data:",@data) ]
6785 249:[ local data_abilities = { } ] >> 222:[ data_abilities = {} ]
6823 250:[ for i, ability in pairs(self.data.abilities) do ] >> 223:[ for i,ability in pairs(@data.abilities) ]
6850 251:[ data_abilities[i] = ability.__name ] >> 224:[ data_abilities[i] = ability.__name ]
6807 252:[ end ] >> 223:[ for i,ability in pairs(@data.abilities) ]
6887 253:[ local data_copy = table.shallow_copy(self.data) ] >> 225:[ data_copy = table.shallow_copy(@data) ]
6927 254:[ data_copy.abilities = data_abilities ] >> 226:[ data_copy.abilities = data_abilities ]
6966 255:[ print("class.name:", self.class.name) ] >> 227:[ print("class.name:",@class.name) ]
7001 256:[ local ret = am.to_json({ ] >> 228:[ ret = am.to_json({name:@@__name, uname:@uname, data:data_copy, class:@class.name}) ]
7024 257:[ name = self.__class.__name, ] >> 228:[ ret = am.to_json({name:@@__name, uname:@uname, data:data_copy, class:@class.name}) ]
7040 258:[ uname = self.uname, ] >> 228:[ ret = am.to_json({name:@@__name, uname:@uname, data:data_copy, class:@class.name}) ]
7053 259:[ data = data_copy, ] >> 228:[ ret = am.to_json({name:@@__name, uname:@uname, data:data_copy, class:@class.name}) ]
7070 260:[ class = self.class.name ] >> 228:[ ret = am.to_json({name:@@__name, uname:@uname, data:data_copy, class:@class.name}) ]
7001 261:[ }) ] >> 228:[ ret = am.to_json({name:@@__name, uname:@uname, data:data_copy, class:@class.name}) ]
7086 262:[ print("Ret is:", ret) ] >> 229:[ print("Ret is:",ret) ]
7109 263:[ return ret ] >> 230:[ ret ]
7141 266:[ print("Deserializing character") ] >> 233:[ print("Deserializing character") ]
7176 267:[ local tbl = am.parse_json(data) ] >> 234:[ tbl = am.parse_json(data) ]
7206 268:[ if mod.classes[tbl.class] then ] >> 235:[ if mod.classes[tbl.class] ]
7233 269:[ local data_abilities = { } ] >> 236:[ data_abilities = {} ]
7278 270:[ for i, ability_name in pairs(tbl.data.abilities) do ] >> 237:[ for i, ability_name in pairs(tbl.data.abilities) ]
7309 271:[ data_abilities[i] = ability_reg[ability_name] ] >> 238:[ data_abilities[i] = ability_reg[ability_name] ]
7256 272:[ end ] >> 237:[ for i, ability_name in pairs(tbl.data.abilities) ]
7358 273:[ tbl.data.abilities = data_abilities ] >> 239:[ tbl.data.abilities = data_abilities ]
7397 274:[ return mod.inherited[tbl.name](tbl.uname, tbl.data, mod.classes[tbl.class]) ] >> 240:[ return mod.inherited[tbl.name](tbl.uname, tbl.data, mod.classes[tbl.class]) ]
7481 275:[ elseif mod.enemies[tbl.class] then ] >> 241:[ elseif mod.enemies[tbl.class] ]
7508 276:[ local e = mod.Enemy(tbl.data, mod.enemies[tbl.class]) ] >> 242:[ e = mod.Enemy(tbl.data, mod.enemies[tbl.class]) ]
7559 277:[ e.uname = tbl.uname ] >> 243:[ e.uname = tbl.uname ]
7582 278:[ return e ] >> 244:[ return e ]
7616 282:[ return print("draw") ] >> 248:[ print("draw") ]
7647 285:[ return self.node:remove_all() ] >> 250:[ @node\remove_all! ]
7679 288:[ self.dead = true ] >> 252:[ @dead = true ]
7694 289:[ print(self, "is dieing, node is", self.node, "and color is", color) ] >> 253:[ print(@,"is dieing, node is",@.node,"and color is",color) ]
7754 290:[ self.node("char_sprite"):append(am.line(vec2(-10, -10), vec2(10, 10), 5, color.bright)) ] >> 254:[ @.node("char_sprite")\append(am.line(vec2(-10,-10),vec2(10,10),5,color.bright)) ]
7836 291:[ return self.node("char_sprite"):append(am.line(vec2(10, -10), vec2(-10, 10), 5, color.bright)) ] >> 255:[ @.node("char_sprite")\append(am.line(vec2(10,-10),vec2(-10,10),5,color.bright)) ]
7941 294:[ self.room = room ] >> 257:[ @room = room ]
7956 295:[ print("Character", self, "entered room", room) ] >> 258:[ print("Character",@,"entered room",room) ]
7999 296:[ self.node("char_translate").y = room.floor_y ] >> 259:[ @.node("char_translate").y = room.floor_y ]
8045 297:[ if room.__class == LobbyRoom then ] >> 260:[ if room.__class == LobbyRoom ]
8075 298:[ print("Class was lobbyRoom") ] >> 261:[ print("Class was lobbyRoom") ]
8107 299:[ local rng_x = math.random(-(main.width / 2), (main.width / 2)) ] >> 262:[ rng_x = math.random(-(main.width/2), (main.width/2)) ]
8163 300:[ print("RNG x:", rng_x) ] >> 263:[ print("RNG x:",rng_x) ]
8188 301:[ self.node("char_translate").x = rng_x ] >> 264:[ @.node("char_translate").x = rng_x ]
8233 303:[ print("Class was not LobbyRoom") ] >> 266:[ print("Class was not LobbyRoom") ]
8269 304:[ local x_pos = self.room:player_location_of(self.data.position) ] >> 267:[ x_pos = @room\player_location_of(@data.position) ]
8321 305:[ print("Got x pos for", self, x_pos) ] >> 268:[ print("Got x pos for",@,x_pos) ]
8355 306:[ self.node("char_translate").x = x_pos + math.random(-15, 15) ] >> 269:[ @.node("char_translate").x = x_pos + math.random(-15,15) --some random variance to stop stacking ]
8480 310:[ assert(newclass, "Cannot set a class to nil") ] >> 271:[ assert(newclass, "Cannot set a class to nil") ]
8528 311:[ self.class = newclass ] >> 272:[ @class = newclass ]
8548 312:[ self:calc_class_values() ] >> 273:[ @calc_class_values! ]
8570 313:[ self.node("char_sprite").source = newclass.sprite ] >> 274:[ @.node("char_sprite").source = newclass.sprite ]
8645 316:[ self.data.position = pos ] >> 277:[ @data.position = pos ]
8694 319:[ self.data.location = loc ] >> 280:[ @data.location = loc ]
3916 325:[ assert(charclass, "Charclass may not be nil") ] >> 147:[ assert(charclass, "Charclass may not be nil") ]
3964 326:[ self.uname = uname or false ] >> 148:[ @uname = uname or false ]
3990 327:[ self.data = data or { ] >> 149:[ @data = data or { ]
4018 328:[ status = "active", ] >> 150:[ status: "active", ]
4041 329:[ location = -1, ] >> 151:[ location: -1, ]
4058 330:[ position = charclass.default_position ] >> 152:[ position: charclass.default_position ]
3990 331:[ } ] >> 149:[ @data = data or { ]
4092 332:[ self.class = charclass ] >> 154:[ @class = charclass ]
4113 333:[ assert(self.class.name, "Character classes must have a name") ] >> 155:[ assert(@class.name, "Character classes must have a name") ]
4173 334:[ self:calc_class_values() ] >> 156:[ @calc_class_values! ]
4195 335:[ self.node = am.group() ] >> 157:[ @node = am.group! ]
4270 336:[ self.node:append(am.translate(0, 0):tag("char_translate") ^ am.sprite(self.class.sprite, color.white, "center", "bottom"):tag("char_sprite")) ] >> 160:[ @node\append(am.translate(0,0)\tag("char_translate")^ am.sprite(@class.sprite,color.white,"center","bottom")\tag("char_sprite")) ]
4401 337:[ print("A character has been created!") ] >> 161:[ print("A character has been created!") ]
4442 338:[ print(debug.traceback()) ] >> 162:[ print(debug.traceback!) ]
4487 339:[ local healthbar_trans = am.translate(0, 60) ] >> 164:[ healthbar_trans = am.translate(0,60) ]
4526 340:[ local healthbar_left = am.sprite("data/bar_left.png", color.white, "left", "center"):tag("hp_l") ] >> 165:[ healthbar_left = am.sprite("data/bar_left.png", color.white,"left","center")\tag("hp_l") ]
4617 341:[ local healthbar_right = am.sprite("data/bar_right.png", color.white, "right", "center"):tag("hp_r") ] >> 166:[ healthbar_right = am.sprite("data/bar_right.png", color.white, "right","center")\tag("hp_r") ]
4712 342:[ local healthbar_bar = am.sprite("data/bar_mid.png", color.white, "left", "center"):tag("hp_b") ] >> 167:[ healthbar_bar = am.sprite("data/bar_mid.png", color.white,"left","center")\tag("hp_b") ]
4801 343:[ local healthbar_fill = am.sprite("data/bar_fill.png", color.white, "left", "center"):tag("hp_f") ] >> 168:[ healthbar_fill = am.sprite("data/bar_fill.png", color.white,"left","center")\tag("hp_f") ]
4892 344:[ local healthbar_scale = am.scale(hp_bar_width, 1) ] >> 169:[ healthbar_scale = am.scale(hp_bar_width,1) ]
4937 345:[ local healthbar_fill_scale = am.scale(hp_bar_width + 1, 1):tag("hp_fill_scale") ] >> 170:[ healthbar_fill_scale = am.scale(hp_bar_width + 1,1)\tag("hp_fill_scale") ]
5012 346:[ healthbar_trans:append(am.translate(-hp_bar_width, 0) ^ healthbar_left) ] >> 171:[ healthbar_trans\append(am.translate(-hp_bar_width,0)^ healthbar_left) ]
5084 347:[ healthbar_trans:append(am.translate(hp_bar_width, 0) ^ healthbar_right) ] >> 172:[ healthbar_trans\append(am.translate(hp_bar_width,0)^ healthbar_right) ]
5156 348:[ healthbar_trans:append(am.translate(-hp_bar_width / 2, 0) ^ healthbar_scale ^ healthbar_bar) ] >> 173:[ healthbar_trans\append(am.translate(-hp_bar_width/2,0)^ healthbar_scale^ healthbar_bar) ]
5246 349:[ healthbar_trans:append(am.translate((-hp_bar_width / 2) - 1, 0) ^ healthbar_fill_scale ^ healthbar_fill) ] >> 174:[ healthbar_trans\append(am.translate((-hp_bar_width/2) - 1,0)^ healthbar_fill_scale^ healthbar_fill) ]
5348 350:[ self.node("char_sprite"):append(healthbar_trans) ] >> 175:[ @.node("char_sprite")\append(healthbar_trans) ]
5419 351:[ assert(self.__class.draw, "Characters must have a draw() method") ] >> 177:[ assert(@.__class.draw,"Characters must have a draw() method") ]
5483 352:[ table.insert(mod.characters, self) ] >> 178:[ table.insert(mod.characters,@) ]
5516 353:[ constrain(self, "set anim", function(self, value) ] >> 179:[ constrain(@,"set anim", (self,value) -> ]
5559 354:[ assertf(type(value) == "table", "Tried to set anim on %q to something other than a table (%q)", self, type(value)) ] >> 180:[ assertf(type(value) == "table", "Tried to set anim on %q to something other than a table (%q)",@, type(value)) ]
5673 355:[ return assert(#value > 0, "Tried to set animation for char to something with 0 frames!") ] >> 181:[ assert(#value > 0, "Tried to set animation for char to something with 0 frames!") ]
5516 356:[ end) ] >> 179:[ constrain(@,"set anim", (self,value) -> ]
5761 357:[ return assert(self.__class ~= Character, "Character class must be subclassed") ] >> 183:[ assert(@.__class != Character,"Character class must be subclassed") ]
3809 371:[ self.classes = { } ] >> 144:[ @classes = {} ]
3824 372:[ self.players = { } ] >> 145:[ @players = {} -- players singleton, [peerid] = Character ]
6074 374:[ assert(c, "Inheritance must exist") ] >> 195:[ assert(c, "Inheritance must exist") ]
6112 375:[ assert(c.__name, "Inherited class must have a .__name") ] >> 196:[ assert(c.__name, "Inherited class must have a .__name") ]
6170 376:[ self.__class.classes[c.__name] = c ] >> 197:[ @@.classes[c.__name] = c ]
6197 377:[ mod.inherited[c.__name] = c ] >> 198:[ mod.inherited[c.__name] = c ]
8716 381:[ mod.enemy_counter = 0 ] >> 282:[ mod.enemy_counter = 0 ]
8757 385:[ local _parent_0 = Character ] >> 283:[ class Enemy extends Character ]
8927 388:[ self(data, eclass) ] >> 288:[ @(data, eclass) ]
8946 389:[ mod.enemy_counter = mod.enemy_counter + 1 ] >> 290:[ mod.enemy_counter += 1 ]
8990 392:[ return string.format("<%s> at (%d)", self.uname, self.data.position or 0) ] >> 292:[ return string.format("<%s> at (%d)",@uname, @data.position or 0) ]
9127 395:[ print("Character", self, "entered room", room) ] >> 295:[ print("Character",@,"entered room",room) ]
9170 396:[ self.room = room ] >> 296:[ @room = room ]
9185 397:[ self.node("char_translate").y = self.room.floor_y ] >> 297:[ @.node("char_translate").y = @room.floor_y ]
9230 398:[ self.node("char_translate").x = self.room:enemy_location_of(self.data.position) ] >> 298:[ @.node("char_translate").x = @room\enemy_location_of(@data.position) ]
9325 401:[ return self.class.select_action(self) ] >> 301:[ return @class.select_action(@) ]
8794 408:[ _class_0.__parent.__init(self, eclass.name .. ":" .. tostring(mod.enemy_counter), data, eclass) ] >> 285:[ super(eclass.name .. ":" .. tostring(mod.enemy_counter), data, eclass) ]
8867 409:[ mod.enemy_counter = mod.enemy_counter + 1 ] >> 286:[ mod.enemy_counter += 1 ]
9357 438:[ mod["Character"] = Character ] >> 303:[ mod["Character"] = Character ]
9386 439:[ mod["KeyInput"] = KeyInput ] >> 304:[ mod["KeyInput"] = KeyInput ]
9413 440:[ mod["Enemy"] = Enemy ] >> 305:[ mod["Enemy"] = Enemy ]
9475 441:[ return mod ] >> 307:[ mod ]
|