-
Notifications
You must be signed in to change notification settings - Fork 0
Hooks
Hooks are a way for you to register for updates that happen around Starfall.
Syntax for Starfall hooks:
hook("hook_identifier", "unique_identifier", hook_func )
This will register hook_func to get called whenever the hook hook_identifier
gets triggered.
function hook_func( input_changed, value )
print( input_changed .. value )
end
hook("input", "hook_name", hook_func)
This hook gets called every time one of the wire inputs change.
It passed you the name of the value that got changed and the new value in a return list.
hook("readcell", "hook_name", hook_func)
This hook gets called whenever a wire high-speed device tries to read from a cell on starfall.
hook("writecell", "hook_name", hook_func)
This hook gets called whenver a wire high-speed device tries to write to a cell on your starfall chip.
hook("think", "hook_name", hook_func)
This hook gets called every tick of the server.
function hook_func( user )
print( user:SteamID() )
end
hook("sf_used", "hook_name", hook_func)
This hook gets called when someone presses use on a Starfall entity.
hook("render", "hook_name", paint_func)
This function is used for Starfall screens only, It is called every frame on viewer's screens.
In functions called by this hook is the only time you are able to use most functions from the client side Screen library.
function umsg_receive( data )
print( data:getString() )
end
hook("umsg", "hook_name", umsg_receive )
This hook is how you receive a umsg on client side when the server instance sends a UMSG.