charob_script - Outerra/anteworld GitHub Wiki
|
||
| Parameter Description | Returns | Description |
|---|---|---|
| return: objdef parameters | Get the objdef parameters associated with the vehicle | |
|
||
| Parameter Description | Returns | Description |
|
ref: reference path path: relative path dst: resolved path |
return: false on argument error | Resolve relative path |
|
||
| Parameter Description | Returns | Description |
| id: Object ID | return: geomob object | Retrieve geomob |
|
||
| Parameter Description | Returns | Description |
| info: object information | return: objdef information | Retrieve objdef information |
|
||
| Parameter Description | Returns | Description |
|
key: parameter key group: group |
return: parameter value | Retrieve parameter from objdef |
|
||
| Parameter Description | Returns | Description |
| mask: optional mask value | return: collision group id | Get the collision group and mask |
|
||
| Parameter Description | Returns | Description |
|
group: collision group id mask: collision mask |
Set the collision group and mask | |
|
||
| Parameter Description | Returns | Description |
| text: message to post to the fading log | Post message to the fading log | |
|
||
| Parameter Description | Returns | Description |
| return: camera mode | Get the camera mode | |
|
||
| Parameter Description | Returns | Description |
| return: custom data value | Get the custom data value | |
|
||
| Parameter Description | Returns | Description |
| return: heading/pitch/roll angles | Get heading/pitch/roll angles of the object in radians | |
|
||
| Parameter Description | Returns | Description |
|
mpos: model-space postion to act on force: model or world-space force vector worldspace: true for world-space, false for model-space force vector |
Add extra force to be applied to the object. Multiple accumulated forces will remain active in simulation frames up until the next time extra forces are added. To reset forces, an extra_force call with zero force vector needs to be called in sim or update frame |
|
|
||
| Parameter Description | Returns | Description |
|
mpos: model-space postion to act on impulse: model or world-space force impulse vector worldspace: true for world-space, false for model-space force vector |
Apply extra force impulse (force * dt), one-time impulse, non-persistent | |
|
||
| Parameter Description | Returns | Description |
| name: Name of the joint | return: joint/bone id or -1 if doesn't exist | Get the joint/bone id for given bone name |
|
||
| Parameter Description | Returns | Description |
|
name: Name of the mesh lod_group: lod group for given base name (0xff if all lod groups) mat_group: material group for given base name (0xff if all material groups) |
return: mesh id for given params or -1 if doesn't exist | Gets the mesh id |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
|
pos: model-space launch position dir: model-space launch direction speed: firing velocity in m/s caliber: diameter of the ray [m] color: plasma color joint: bone id to attach to |
Fire a colored plasma projectile | |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
| ge: explosion parameters | Explode ground at model position | |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
|
pos: model-space position maxdist: max distance/height to check negdist: max negative distance to test joint: [optional] bone id to be relative to |
return: height above terrrain or >= maxdist if no hit, <= negdist if under terrain | Elevation test |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
|
pos: model-space position maxdist: max distance/height to check negdist: max negative distance to test hp: [out, optional] hitpoint result hpflags: [optional] query flags (ot::hit_flags) joint: [optional] bone id to be relative to |
return: height above terrain or >= maxdist if no hit, <= negdist if under terrain | Elevation test with extended info |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
|
pos: model-space (or bone-space) position dir: model-space (or bone-space) ray direction maxdist: max distance/height to check negdist: max negative distance to test hp: [out, optional] hitpoint result hpflags: [optional] query flags (ot::hit_flags) joint: [optional] bone id to be relative to |
return: intersection distance or >= maxdist if no hit, <= negdist if under terrain | Test if ray from model intersects with terrain |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
|
pos: model-space (or bone-space) position dir: model-space (or bone-space) ray direction maxdist: max ray distance to check (keep short if possible) hp: [out, optional] hitpoint result hpflags: [optional] query flags (ot::hit_flags) joint: bone id to be relative to |
return: object hit | Test if ray from model hits an object |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
|
obj: Object to attach joint_id: bone id pos: attachment position rot: attachment rotation custom_id: id that can be used to identify the attached object when detaching |
Attach object | |
|
||
| Parameter Description | Returns | Description |
|
custom_id: id set previously by attach_geom activate: activate object (if it's not a static one) |
return: detached object, if found | Detach specified object |
|
||
| Parameter Description | Returns | Description |
| return: the object this object is attached to or nullptr if this object is free | Get object we are attached to | |
|
||
| Parameter Description | Returns | Description |
|
object: attached object activate: activate object (if it's not a static one) |
return: true if successful | Detach specified object |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
|
pos: position to set joint_id: to set position to bone position joint_rotation: to set rotation based on bone rotation |
Set model space position for FPS camera | |
|
|||
| Parameter Description | Returns | Description | |
|---|---|---|---|
|
rot: model space rotation mouse_rotation: rotation mode: 0 freeze, 1 reset&disable, 2 enable, 3 reset & enable |
Set model space rotation frame | ||
|
|||
| Parameter Description | Returns | Description | |
|
hfov: horizontal fov in degrees, 0 to reset to the default one vfov: optional vertical fov in degrees, otherwise computed from aspect ratio |
Set FOV to chassis FPS preset and also to the current camera if vehicle is entered and FPC camera is active | ||
|
|||
| Parameter Description | Returns | Description | |
| return: current FPS camera position | Get current FPS camera position | ||
|
|||
| Parameter Description | Returns | Description | |
| base: true for the base orientation frame, false for current camera orientation as altered by mouse | return: camera rotation | Get current FPS camera rotation in model space | |
|
|||
| Parameter Description | Returns | Description | |
| return: camera FOV | Get FPS camera FOV | ||
|
|||
| Parameter Description | Returns | Description | |
|
yaw: yaw angle in radians, positive values to the right pitch: pitch pitch angle in radians, positive up roll: roll angle in radians, positive clockwise mouse_rotation: rotation mode: 0 freeze, 1 reset&disable, 2 enable, 3 reset & enable |
Set model space orientation for FPS camera | ||
|
|||
| Parameter Description | Returns | Description | |
| base: true for the base orientation frame, false for current camera orientation as altered by mouse | return: yaw/pitch/roll angles | Get current yaw/pitch/roll angles of the camera in model space | |
|
|||
| Parameter Description | Returns | Description | |
|
target: ECEF coordinates of the point level_horizon: keep horizon level (roll the camera) |
return: true if tracking was enabled, false if center wasn't on terrain or the current camera mode is not FPS | Enable tracking of world point | |
|
|||
| Parameter Description | Returns | Description | |
| level_horizon: keep horizon level (roll the camera) | return: true if tracking was enabled, false if center wasn't on terrain or the current camera mode is not FPS | Enable tracking of the current world point (in screen center) | |
|
|||
| Parameter Description | Returns | Description | |
| Disable tracking | |||
|
|||
| Parameter Description | Returns | Description | |
| return: ot::snd_group interface | Get sound interface | ||
|
|||
| Parameter Description | Returns | Description | |
|
name: hierarchic action name, file/group/action group: activation group where the action is assigned (can be enabled/disabled together) |
return: slot id or -1 on fail | Register action handler for an existing knob | |
|
|||
| Parameter Description | Returns | Description | |
|
name: hierarchic action name, file/group/action release_event: true if handler should also receive release events (if bound to key) group: activation group where the action is assigned (can be enabled/disabled together) |
return: slot id or -1 on fail | Register event action handler | |
|
|||
| Parameter Description | Returns | Description | |
|
name: hierarchic action name, file/group/action ramp: value limiter parameters (ignored for buttons) group: activation group where the action is assigned (can be enabled/disabled together) |
return: slot id or -1 on fail | Register axis action handler | |
|
|||
| Parameter Description | Returns | Description | |
|
name: hierarchic action name, file/group/action handler: handler for changed value, void fn(int flags, uint code, uint channel, int handler_id) handler_id: optional extra data for the handler group: activation group where the action is assigned (can be enabled/disabled together) |
return: slot id or -1 on fail | Register input action for an existing knob, create new using def_ramp if doesn't exist | |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
|
name hierarchic action name, file/group/action handler handler for changed value, void fn(int flags, uint code, uint channel, int handler_id) def_ramp: action options to use if knob wasn't found, if nullptr do not create handler_id: optional extra data for the handler def_val: optional default action value group: activation group where the action is assigned (can be enabled/disabled together) |
return: slot id or -1 on fail | Register input action for an existing knob, if doesn't exist create new if def_ramp |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
|
name: hierarchic action name, file/group/action handler: optional handler for changed value, void fn(float val, uint code, uint channel, int handler_id) ramp: ramp parameters handler_id: optinal extra data for the handler def_val: optional default action value ramp: value limiter parameters group: activation group where the action is assigned (can be enabled/disabled together) |
return: slot ID or -1 on fail | Register input action sending events on value change (full state button and axis) |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
|
name: hierarchic action name, file/group/action handler: optional handler for changed value, void fn(int flags, uint code, uint channel, int handler_id) handler_id: optional extra data for the handler group: activation group where the action is assigned (can be enabled/disabled together) extra_channels: number of extra channels that are handled (multiple engines etc) |
return: slot ID or -1 on fail | Register input action sending events on button press (value > 0) |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
| return: action id, -1 if not found | Get action id for given action name, -1 if not found | |
|
||
| Parameter Description | Returns | Description |
|
group: group id activate: activate/deactivate the group |
Activate or deactivate the given action group | |
|
||
| Parameter Description | Returns | Description |
|
action: action id center: center value, will be clamped to minval..maxval range |
Set the value to center to, default 0 | |
|
||
| Parameter Description | Returns | Description |
|
action: action id value: target action value, will be clamped to minval..maxval range hold: true if the value should be held (disabled centering) |
Set target action value | |
|
||
| Parameter Description | Returns | Description |
|
action: action id value: instant action value, will be clamped to minval..maxval range notify: invoke/don't invoke the handler |
Set instant action value | |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
|
offset: model-space offset relative to the bone or model pivot dir: light direction lp: light parameters joint: joint name to attach the light to |
return: light emitter id | Define a circular spotlight source. Can only be called from within init_chassis |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
|
offset: model-space offset relative to the bone or model pivot lp: light parameters joint: joint name to attach the light to |
return: light emitter ID | Define a point light source. Can only be called from within init_chassis |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
|
id: light id on: boolean flag to turn the light on/off |
Turn light on or off | |
|
||
| Parameter Description | Returns | Description |
|
mask: bitmask for selecting lights on: boolean flag to turn lights on/off offset: optional offset for light bitmask |
Turn lights on or off using a bitmask | |
|
||
| Parameter Description | Returns | Description |
| id: light id | Toggle the state of a light (on/off) | |
|
||
| Parameter Description | Returns | Description |
|
mask: bitmask for selecting lights offset: optional offset for light bitmask |
Toggle lights using a bitmask | |
|
||
| Parameter Description | Returns | Description |
|
id: light id color: color and intensity of the light range: optional range |
Set the color and intensity of a light | |
|
||
| Parameter Description | Returns | Description |
| instant: boolean flag to instantly turn off lights | Turn off all lights with an option to turn them off instantly | |
|
||
| Parameter Description | Returns | Description |
|
time: [out] solar time at vehicle location [s] sun_coef: sun position relative to horizon: 0 sun at horizon, 1 sun at zenith, -1 sun at anti-zenith |
Return current solar time and cosine of sun-zenith angle | |
|
||
| Parameter Description | Returns | Description |
|
width: display width height: display height mesh_name: name of the display mesh in geomob |
return: ID of the display | Add a new display |
|
||
| Parameter Description | Returns | Description |
| display_id: id of the display | return: canvas reference | Get the canvas of a display |
|
||
| Parameter Description | Returns | Description |
| return: dynamic array of display names | Get display names | |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
|
joint: name of the joint emitter will be attached to texture: relative path of the texture to use as particle billboard (must be in RGBA8 dds format) params: emitter parameters |
return: emitter ID | Add a smoke emitter |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
|
joint: name of the joint emitter will be attached to texture: relative path to the particle texture |
return: emitter ID | Add a dust emitter. Call in init_chassis |
|
||
| Parameter Description | Returns | Description |
|
emitter: emitter id color: particle color |
Set overall emitter color | |
|
||
| Parameter Description | Returns | Description |
|
emitter: emitter id pause: boolean flag to pause/unpause the emitter |
Pause or unpause the emitter | |
|
||
| Parameter Description | Returns | Description |
| filename: path to the sound file | return: sound id | Load sound |
|
||
| Parameter Description | Returns | Description |
|
joint: bone name to attach to type: sound type (-1 = interior, 0 = universal, 1 = exterior) ref_distance: reference distance (saturated volume distance) |
return: sound emitter ID | Attach a sound emitter to a model joint by name |
|
||
| Parameter Description | Returns | Description |
|
joint_id: bone id to attach to type: sound type (-1 = interior, 0 = universal, 1 = exterior) ref_distance: reference distance (saturated volume distance) |
return: sound emitter id | Attach a sound emitter to a model joint by id |
|
||
| Parameter Description | Returns | Description |
| att: attenuation value | Set attenuation for sounds coming from outside | |
|
||
| Parameter Description | Returns | Description |
|
buf: Array to store retrieved control commands or states append: true ifcontrols should be appended |
Fetch controls | |
|
||
| Parameter Description | Returns | Description |
|
cmd: controls to apply ncmds: number of commands to process. |
Apply commands | |
|
||
| Parameter Description | Returns | Description |
|
openid: ID of the openable part (script specific) modifiers: keyboard modifiers (LSHIFT=1, RSHIFT=2, LCTRL=4, RCTRL=8) |
Insert an open door command | |
|
||
| Parameter Description | Returns | Description |
| return: animator component | Get the animator component | |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
|
model: full model path under packages directory pos: relative position of the pivot point rot: relative orientation of the model persistent: true if the object should persist in the world |
return: reference to the spawned object | Spawn object |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
|
maxdist: max ray distance to check (keep short if possible) hp: [out, optional] hitpoint result hpflags: [optional] query flags (ot::hit_flags) |
return: object hit | Test if ray from camera hits an object |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
| return: object that is in focus | Get object that is currently in focus | |
|
||
| Parameter Description | Returns | Description |
|
pos: relative position in tangent space, x side, y forward, z up yawd: yaw angle delta [rad] pitch: pitch angle [rad] roll: roll angle [rad] |
Move character relatively in tangent space. Only dynamic game objects can move | |
|
||
| Parameter Description | Returns | Description |
| fwd: forward vector to align to (in ecef space) | Set the rotation. Use this method mainly for initial setup of object's rotation, during runtime is better to rotate by move method | |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
|
obj: object that should be entered. If this is a static scenery object, returned object may be different due to activation. Can be null if re-entering a different bone bone_id: bone to attach this to. When invalid, model pivot is used preserve_position: true to try and preserve current world position relative to the bone, false to reset to the bone pos: relative position after entering rot: relative rotation after entering camode: camode camera mode to use bindio: bindio bind user controls |
return: entered object (can be different than the one passed in, in case static object was awakened) | Enter vehicle/interactor object |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
|
preserve_position: true to try and preserve current world position relative to the bone, false to reset to the bone pos: relative position of this object to obj after exit rot: relative rotation of this object to obj after exit camode: camera mode to use |
Exit entered object. Right now it is usable only for vehicles | |
|
||
| Parameter Description | Returns | Description |
|---|---|---|
| params: custom parameters from objdef | return: ot::chassis_params | Initialize chassis shared across all instances of the same type |
|
||
| Parameter Description | Returns | Description |
| params: custom parameters from objdef | return: ot::chassis_params | Initialize chassis from a script. This is typically used for scripted chassis initialization |
|
||
| Parameter Description | Returns | Description |
|
dt: delta time since the last update actbuf: range of actions to process from the script |
Invoke registered actions on the script side | |
|
||
| Parameter Description | Returns | Description |
| start: boolean flag to start or stop the engine | Called when engine is started/stopped | |
|
||
| Parameter Description | Returns | Description |
|
name: name of the external parameter value: value to set (or null to request the current value) |
return: the new or existing parameter value | Set/get an externally provided parameter |
|
||
| Parameter Description | Returns | Description |
| reload: boolean flag to indicate if the object is being reloaded | Initialize the object instance | |
|
||
| Parameter Description | Returns | Description |
|
dt: delta time since the last update dtinterp: interpolation time ahead from the last simulation state |
Update the object's visual model for rendering. Called each frame | |
|
||
| Parameter Description | Returns | Description |
| dt: delta time for the simulation step | Called 60 times per second | |
|
||
| Parameter Description | Returns | Description |
| return: | ||
|
||
| Parameter Description | Returns | Description |
| return: true if the use action was handled | Invoked to handle the player's "use" action. Use get_object_in_focus() to get the object to interact with | |
|
||
| Parameter Description | Returns | Description |
| return: true if the open action was handled | Invoked to handle the player's "open" action. Use get_object_in_focus() to get the object to interact with | |
|
||
| Parameter Description | Returns | Description |
| joint: bone ID of the part being entered, or -1 | return: true if the enter action was handled | Invoked when character can enter an object. Use get_object_in_focus() to get the object to interact with |
|
||
| Parameter Description | Returns | Description |
| mode: camera mode or ot::CamFree on exit | Invoked on camera change | |
|
||
| Parameter Description | Returns | Description |
| Invoked when this object is used as interactor "entered by camera" | ||
|
||
| Parameter Description | Returns | Description |
|
||
| Parameter Description | Returns | Description |
| action_id: index of action as given in enter_object call | Called when entered in object and that object is handling action registered from knobs | |
|
||
| Parameter Description | Returns | Description |
| seat_id: id of the seat | ||
|
||
| Parameter Description | Returns | Description |