Wren testing
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
class TempEntity {
|
||||
static SPIKE { 0 }
|
||||
static SUPERSPIKE { 1 }
|
||||
static GUNSHOT { 2 }
|
||||
static EXPLOSION { 3 }
|
||||
static TAREXPLOSION { 4 }
|
||||
static LIGHTNING1 { 5 }
|
||||
static LIGHTNING2 { 6 }
|
||||
static WIZSPIKE { 7 }
|
||||
static KNIGHTSPIKE { 8 }
|
||||
static LIGHTNING3 { 9 }
|
||||
static LAVASPLASH { 10 }
|
||||
static TELEPORT { 11 }
|
||||
}
|
||||
|
||||
class ServerCommand {
|
||||
static BAD { 0 }
|
||||
static NOP { 1 }
|
||||
static DISCONNECT { 2 }
|
||||
static UPDATESTAT { 3 }
|
||||
static VERSION { 4 }
|
||||
static SETVIEW { 5 }
|
||||
static SOUND { 6 }
|
||||
static TIME { 7 }
|
||||
static PRINT { 8 }
|
||||
static STUFFTEXT { 9 }
|
||||
static SETANGLE { 10 }
|
||||
static SERVERINFO { 11 }
|
||||
static LIGHTSTYLE { 12 }
|
||||
static UPDATENAME { 13 }
|
||||
static UPDATEFRAGS { 14 }
|
||||
static CLIENTDATA { 15 }
|
||||
static STOPSOUND { 16 }
|
||||
static UPDATECOLORS { 17 }
|
||||
static PARTICLE { 18 }
|
||||
static DAMAGE { 19 }
|
||||
static SPAWNstatic { 20 }
|
||||
static SPAWNBASELINE { 22 }
|
||||
static TEMP_ENTITY { 23 }
|
||||
static SETPAUSE { 24 }
|
||||
static SIGNONNUM { 25 }
|
||||
static CENTERPRINT { 26 }
|
||||
static KILLEDMONSTER { 27 }
|
||||
static FOUNDSECRET { 28 }
|
||||
static SPAWNstaticSOUND { 29 }
|
||||
static INTERMISSION { 30 }
|
||||
static FINALE { 31 }
|
||||
static CDTRACK { 32 }
|
||||
static SELLSCREEN { 33 }
|
||||
static CUTSCENE { 34 }
|
||||
}
|
||||
|
||||
class Quake {
|
||||
foreign static sound(entity, channel, sample, volume, attenuation)
|
||||
foreign static precache_sound(sound)
|
||||
|
||||
foreign static error(err)
|
||||
foreign static normalize(vec)
|
||||
|
||||
foreign static write_byte(dest, value)
|
||||
foreign static write_coord(dest, value)
|
||||
foreign static write_char(dest, value)
|
||||
|
||||
static MSG_BROADCAST { 0 }
|
||||
static MSG_ALL { 2 }
|
||||
|
||||
foreign static time
|
||||
|
||||
static spawn_particle(dest, origin, dir, count, colour) {
|
||||
Quake.write_byte(dest, ServerCommand.PARTICLE)
|
||||
Quake.write_coord(dest, origin[0])
|
||||
Quake.write_coord(dest, origin[1])
|
||||
Quake.write_coord(dest, origin[2])
|
||||
Quake.write_char(dest, dir[0])
|
||||
Quake.write_char(dest, dir[1])
|
||||
Quake.write_char(dest, dir[2])
|
||||
Quake.write_byte(dest, count)
|
||||
Quake.write_byte(dest, colour)
|
||||
}
|
||||
}
|
||||
|
||||
foreign class EntityVariables {
|
||||
construct new() {}
|
||||
|
||||
foreign origin
|
||||
foreign next_think
|
||||
|
||||
foreign origin=(origin)
|
||||
foreign next_think=(nt)
|
||||
}
|
||||
|
||||
class EntityBase {
|
||||
construct new() {
|
||||
_vars = EntityVariables.new()
|
||||
}
|
||||
|
||||
|
||||
setThink(think) {
|
||||
_thinkFn = think
|
||||
}
|
||||
|
||||
think() {
|
||||
if (_thinkFn) {
|
||||
_thinkFn.call()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
vars { _vars }
|
||||
}
|
||||
|
||||
class monster_ogre is EntityBase {
|
||||
construct new() {
|
||||
super()
|
||||
setThink { test_think() }
|
||||
}
|
||||
|
||||
|
||||
test_think() {
|
||||
super.vars.next_think = Quake.time + 0.1
|
||||
//Quake.precache_sound("demon/djump.wav")
|
||||
Quake.spawn_particle(Quake.MSG_BROADCAST, vars.origin, [0, (Quake.time.cos * 127), (Quake.time.sin * 127)], 5, (Quake.time / 2).sin * 128)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user