2025-06-16 19:58:26 -04:00
|
|
|
makeclass("world")
|
2021-12-28 13:56:16 -05:00
|
|
|
makeclass('login')
|
2025-01-14 18:37:31 -05:00
|
|
|
makeclass("engio")
|
2025-03-28 23:31:44 -04:00
|
|
|
makeclass('cube')
|
|
|
|
|
makeclass('sphere')
|
2025-01-21 20:20:54 -05:00
|
|
|
|
2025-06-16 19:58:26 -04:00
|
|
|
-- This gets called on every login except the admin user.
|
2025-02-26 15:58:12 -05:00
|
|
|
function login.init()
|
2025-06-27 16:34:11 -04:00
|
|
|
local player = global.get("nextplayer")
|
|
|
|
|
global.set("nextplayer", player + 1)
|
|
|
|
|
dprint("login.init initializing player ", player)
|
|
|
|
|
actor.player = player
|
2026-02-17 15:49:52 -05:00
|
|
|
tangible.animinit{tan=actor, anim={bp="character", mesh="manny", plane="earth", xyz={player * 100, 0, 90}}}
|
2025-06-16 19:58:26 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- This gets called on the admin user. You can call login.init in here if you want.
|
|
|
|
|
function world.init()
|
2025-06-27 16:34:11 -04:00
|
|
|
dprint("world.init")
|
|
|
|
|
global.set("nextplayer", 0)
|
2026-02-06 17:34:26 -05:00
|
|
|
tangible.build{class=cube, anim={plane="earth", xyz={500,-100,0}, mat_color={1,0,0}}}
|
|
|
|
|
tangible.build{class=sphere, anim={plane="earth", xyz={500,100,0}, mat_color={0,0,1}}}
|
2025-06-16 19:58:26 -04:00
|
|
|
login.init()
|
2025-01-21 20:20:54 -05:00
|
|
|
end
|
2024-02-07 15:59:17 -05:00
|
|
|
|
2025-02-26 15:58:12 -05:00
|
|
|
function engio.move(action, xyz, facing)
|
2024-02-16 15:48:49 -05:00
|
|
|
-- todo: sanity check the parameters.
|
2026-02-14 03:35:08 -05:00
|
|
|
dprint("engio.move ", action, " ", xyz[1], " ", xyz[2], " ", xyz[3])
|
2026-02-06 17:34:26 -05:00
|
|
|
tangible.animate{tan=actor, anim={action=action, interactive=true, xyz=xyz, facing=facing}}
|
2025-01-21 20:20:54 -05:00
|
|
|
end
|
2025-02-24 16:46:05 -05:00
|
|
|
|
2026-02-14 00:24:52 -05:00
|
|
|
function moveto(x, y)
|
|
|
|
|
local z = tangible.animfinal(actor).xyz[3]
|
|
|
|
|
tangible.animate{tan=actor, anim={action="moveto", xyz={x, y, z}, facing=math.auto}}
|
|
|
|
|
end
|
|
|
|
|
|
2026-04-13 16:08:23 -04:00
|
|
|
function cube.lookhotkeys(add)
|
|
|
|
|
add("Z", "Cube Hi", function () dprint("Doing Cube Hi") end)
|
|
|
|
|
add("X", "Cube Bye", function () dprint("Doing Cube Bye") end)
|
|
|
|
|
add("C", "Cube Yo", function () dprint("Doing Cube Yo") end)
|
2025-02-24 16:46:05 -05:00
|
|
|
end
|
2025-02-26 14:47:53 -05:00
|
|
|
|
2026-04-13 16:08:23 -04:00
|
|
|
function sphere.lookhotkeys(add)
|
|
|
|
|
add("Z", "Sphere Hi", function () dprint("Doing Sphere Hi") end)
|
|
|
|
|
add("X", "Sphere Bye", function () dprint("Doing Sphere Bye") end)
|
|
|
|
|
add("C", "Sphere Yo", function () dprint("Doing Sphere Yo") end)
|
2025-04-07 16:48:27 -04:00
|
|
|
end
|
|
|
|
|
|
2025-04-15 18:59:03 -04:00
|
|
|
|
2025-04-07 16:48:27 -04:00
|
|
|
function engio.getlookat()
|
2025-06-27 16:34:11 -04:00
|
|
|
local class = tangible.getclass(place)
|
2025-05-12 18:23:37 -04:00
|
|
|
|
|
|
|
|
-- if the tangible is not of any class, return empty string.
|
|
|
|
|
if class == nil then
|
|
|
|
|
return ""
|
|
|
|
|
end
|
2025-04-15 18:59:03 -04:00
|
|
|
|
|
|
|
|
-- if the class has a function 'lookhotkeys', then the correct
|
2026-04-09 14:43:11 -04:00
|
|
|
-- look-at widget is 'hotkeys'.
|
2025-04-15 18:59:03 -04:00
|
|
|
if class.lookhotkeys ~= nil then
|
2026-04-09 14:43:11 -04:00
|
|
|
return "hotkeys"
|
2025-04-15 18:59:03 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- otherwise, if the class has a function 'getlookat', use that.
|
|
|
|
|
if class.getlookat ~= nil then
|
|
|
|
|
return class.getlookat()
|
2025-04-07 19:29:47 -04:00
|
|
|
end
|
2025-05-12 18:23:37 -04:00
|
|
|
|
|
|
|
|
-- by default, return the empty string.
|
|
|
|
|
return ""
|
2025-02-26 14:47:53 -05:00
|
|
|
end
|
|
|
|
|
|
2026-04-09 14:43:11 -04:00
|
|
|
|
2025-06-02 19:21:17 -04:00
|
|
|
|
2025-11-18 00:40:43 -05:00
|
|
|
function jp3()
|
2026-02-06 17:34:26 -05:00
|
|
|
tangible.animate{tan=actor, anim={action="play", seq="jump"}}
|
|
|
|
|
tangible.animate{tan=actor, anim={action="play", seq="jump"}}
|
|
|
|
|
tangible.animate{tan=actor, anim={action="play", seq="jump"}}
|
2025-11-18 00:40:43 -05:00
|
|
|
end
|
2026-04-09 14:43:11 -04:00
|
|
|
|