buldthensnip/docs/modding_lua.txt
2012-11-05 18:01:43 +13:00

65 lines
1.8 KiB
Plaintext

work in progress
libraries are "client" and "server"
stuff in both is also put in "common"
note, behaviour might be subtly different
all files must use "/" as a path separator (Unix Master Race)
valid characters are listed here (ignoring the path separator):
-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ[]_abcdefghijklmnopqrstuvwxyz
anything else is invalid and will just be outright rejected
maximum path length is 128
stuff that's actually implemented will be marked with an @
lua base library stuff:
math.* @
string.* @
pcall @
error @
print @
nothing else yet
(TODO: stop leaking the whole base library)
check http://www.lua.org/manual/5.1/ for more info on these
common.hook_tick = fn(sec_curtime, sec_delta)->sec_wait
sets a hook called every "tick"
returns a number telling it how long it wants to wait for
"sec_curtime" is the current time elapsed from the start
"sec_delta" is the time elapsed from the start of the last
call to the hooked function
setting this to nil will quit your game
success = server.stream_new_map(fname, fmt = "auto")
loads a map, either .vxl or some format we might invent
which will probably be .vxl with our own header
+ changed meaning for the 4th colour byte
this will also send the map to the other clients
success = server.create_new_map(lx, ly, lz)
creates a new map
note, ly is the *height* of the new map
success = common.save_map(fname, fmt = "bsm")
saves a map to a file
client.camera_point(dx, dy, dz, zoom = 1.0, pitch = 0.0)
points the camera in a direction with zoom factor "zoom"
and pitch "pitch" (in radians, sorry)
client.camera_move_local(dx, dy, dz)
moves the camera in the camera-local direction (dx,dy,dz)
client.camera_move_global(dx, dy, dz)
moves the camera in the world direction (dx,dy,dz)
client.camera_move_to(px, py, pz)
moves the camera to the world position (px,py,pz)