The main "game object" class, holds components and properties.
Also provides mechanisms for sending and recieving commands, as well as for syncing properties from server to client and client to server.
Returns a handle to the ScriptData relating to the script that's currently running.
ScriptData | this script's data. |
Initialise a previously uninitialised blob. This is only useful (or safe) for blobs initialised with .server_CreateBlobNoInit()
Get the current health of a blob.
f32 | the health. |
Get the initial health of a blob set in the config file.
f32 | the original health of this blob. |
Get the current position of a blob.
Vec2f | the position. |
Get the previous (last frame) position of a blob.
Vec2f | the position. |
Get the interpolated position of a blob, useful during rendering at uncapped framerates. You should use this when visually tracking a blob. Linear interpolation of the ShapeVars old position and new position using getInterpolationFactor().
Vec2f | the interpolated position. |
Set the position of a blob. If this is done clientside for a player's blob it will be synced. If this is done serverside for any other blob it will be synced.
Vec2f | the position to set in world space coordinates |
Get the current velocity of a blob.
Vec2f | the velocity. |
Get the previous frame's velocity of a blob. (useful just after you collided with a wall, or the ground)
Vec2f | the old velocity. |
Get the current position of a blob.
Vec2f | the velocity to set |
Apply a force to the blob. (Physically speaking this function is more similar to an impulse than a force) A force accelerates a blob inversely proportional to it's mass, meaning lighter objects move more when the same force is applied.
Vec2f | the force to apply |
Apply a force to the blob at a specific position. This will invoke a torque as well if the position isn't the object's centre of mass.
Warning: This function has not been used internally.
Vec2f | the force to apply |
Vec2f | the position to apply the force at |
See Also: CBlob.AddForce, CBlob.AddTorque
Apply a torque to the blob. A torque rotates a blob inversely proportional to it's mass, meaning lighter objects spin more when the same torque is applied.
f32 | the torque to apply |
Get the radius of the blob.
Note: for polygon shapes this equates to the maximal distance of any point to the centre of the blob.
f32 | the radius in world units. |
Get the width of the blob.
Note: this doesn't take into account rotation.
f32 | the width in world units. |
Get the height of the blob.
Note: this doesn't take into account rotation.
f32 | the height in world units. |
Set the rotation of the blob.
If this is done clientside for a player's blob it will be synced. If this is done serverside for any other blob it will be synced.
f32 | the angle to set the rotation to |
Get the rotation of the blob.
f32 | the blob's rotation. |
Set the rotation of the blob.
If this is done clientside for a player's blob it will be synced. If this is done serverside for any other blob it will be synced.
f32 | the angle to set the rotation to |
Get the rotation of the blob.
f32 | the blob's rotation. |
Set the rotational speed of the blob.
f32 | the angular velocity to set the rotation to |
Get the speed at which this blob is rotating.
f32 | the angular velocity. |
Get the mass of the blob. This describes how physically heavy the blob is.
f32 | the blob's mass. |
Set the mass of the blob.
Note: This can cause all sorts of physical strangeness and is only included for completeness.
f32 | the mass to forcefully set this blob to become. |
Set if the blob should be rendered at all.
bool | the new visibility value. |
Hard-Kill this blob, erase it from the world.
Does not gib the blob, but does cause any onDie hooks to be run.
Returns whether or not the blob is active and ticking.
bool | active: true or false |
Disables the body so it doesn't run any ticks.
bool | active: true or false |
If the blob is collideable at all, or not.
Note that this doesn't necessarily mean everything will collide with it.
bool | if the object can collide with anything. |
Get if the blob counts as a ladder or not.
bool | if the object is a ladder. |
Get if the blob has any "platform" collision information.
bool | if the object is a "platform". |
Returns position of blob with offset (corrected by facing)
Vec2f | offset |
Vec2f | position |
Get the screen position of the blob.
Vec2f | the screen position |
Get the interpolated screen position of the blob, see getInterpolatedPosition.
Returns Vec2f - the interpolated screen position
Get directional facing information.
bool | if the blob is facing left. |
Set directional facing information.
bool | if the blob should be facing left. |
Get collision information.
bool | if the blob is on the ground. |
Get collision information.
bool | if the blob was on the ground last frame. |
Get collision information.
bool | if the blob is on a wall. |
Get collision information.
bool | if the blob is on the ceiling. |
Find out if we're overlapping any ladder blobs.
bool | if the blob is touching a ladder. |
See Also: CBlob.isLadder
Find out if we were overlapping any ladder blobs in the last tick.
bool | if the blob is touching a ladder. |
See Also: CBlob.isOnLadder
Get collision information.
Vec2f | the overall normal of the blob's collisions. |
Get collision information.
int | the number of frames since we last touched the map. |
Get collision information.
bool | if the blob is touching the tilemap in any way. |
Get collision information.
bool | if the blob is in water. |
Returns snap to grid variable from CShape.
bool | true or not |
Find out if a blob overlaps a specific point.
Vec2f | point to check in worldspace coordinates |
bool | if the blob overlaps the given point. |
Remove a script from this blob.
const string &in | the filename or partial filename of the script to remove |
bool | if the script was removed successfully. |
Add a script to this blob.
const string &in | the filename or partial filename of the script to add |
bool | if the script was added successfully. |
Check if a blob has a script added or not. This is not very performant, and slows down the more scripts are present on a blob. don't use this as an "every frame" feature-detection if you can help it - tags or bool properties will be between 10 and 100 faster.
const string &in | the filename or partial filename of the script to check |
bool | if the script was present. |
If we should do any tick scripts at all.
Note: you're probably better off using ScriptData for this.
If we should sync stuff only if we're visible | defaults on to save bandwidth, but if you need an object to be constantly synced (eg you depend on its position across the map) you can disable that. |
What frame to display when inside the inventory.
Note: you should set this in the config file or with CBlob.SetInventoryIcon.
Maximum number this will stack to in the inventory before requiring more slots. Zero for disabled stacking behaviour.
Note: you should set this in the config file or with CBlob.SetInventoryIcon.
<Vec2f> The icon rendering offset in the inventory menu.
The name of the icon to display.
Note: you should set this in the config file or with CBlob.SetInventoryIcon.
The size of one frame of the icon
Note: you should set this in the config file or with CBlob.SetInventoryIcon.
Set the appearance of this object in the inventory.
Note: you should probably set this in the config file unless you want to change it dynamically.
const string &in | the texture filename |
int | the frame |
Vec2f | the frame dimensions |
If we should check the inventory "carefully", ie checked each time there is some inventory activity synced on net.
Defaults false for speed/permissiveness, but for movable stuff with inventory this can help prevent exploits.
Get the blob we're currently ignoring collisions with, if any.
CBlob@ | the blob we're ignoring collisions with, or null. |
Put the passed blob into our inventory if possible.
CBlob@ | the blob to attempt to put in our inventory. |
bool | if the blob was successfully put into our inventory. |
Remove the passed blob from our inventory if possible.
CBlob@ | the blob to attempt to remove from our inventory. |
bool | if the blob was successfully removed. |
Attempt to remove a blob from our inventory by name, getting a handle to the blob removed if successful.
const string &in | the name of the blob to try to remove. |
CBlob@ | the blob removed if any, null otherwise. |
Removes blob from all inventory it might be in.
Check if a given blob can be put in our inventory at the moment.
CBlob@ | the blob to check. |
bool | if the blob will fit. |
Check if a given blob can access our inventory at the moment.
CBlob@ | the blob to check. |
bool | if the inventory is accessible for the given blob. |
Set the quantity stored in this blob (eg in a stack of materials).
This allows you to avoid having 1000s of blobs when you want to use them as materials, currency, or ammunition.
This will be synced to all clients.
s32 | the amount to store in this "stack". |
Get the quantity stored in this blob (eg in a stack of materials).
u16 | the quantity |
See Also: CBlob.server_SetQuantity
The maximum quantity that may be stored in this blob.
Setting this on the client more or less constitutes an error, and you should consider using CBlob.getMaxQuantity there to avoid slip-ups.
Any CBlob.server_SetQuantity calls specifying more than this will be capped (silently).
Get the maximum quantity that may be stored in this blob.
Use this on the client or anywhere you don't want to be modifying maxQuantity to avoid slip-ups.
Get the name of this blob when viewed inside the inventory.
string | the name displayed |
Set the name of this blob when viewed inside the inventory.
string | the name to be displayed |
Find out if this blob is inside an inventory.
bool | if inside an inventory. |
Get the blob that has this blob in it's inventory, if any.
CBlob@ | the blob holding us, or null otherwise. |
Find out if this blob can be picked up by another blob
CBlob@ | the blob to check compatibility with. |
bool | if this blob can be picked up. |
Set this blob to render for the HUD.
Vec2f | offset on the rendering |
f32 | angle to render at |
SColor | a color to multiply with |
RenderStyle::Style | the render style |
Set this blob to render for the HUD.
Vec2f | offset on the rendering |
RenderStyle::Style | the render style |
Set this blob to render for the HUD.
RenderStyle::Style | the render style |
Find out how many blobs we're touching.
MM: "touchy touchy"
int | the number of blobs we're touching |
Get one of the blobs touching us by arbitrary index.
int | index to get, must be less than CBlob.getTouchingCount |
CBlob@ | the blob corresponding to the given index |
Get the offset to one of blobs touching us by arbitrary index.
int | index to get, must be less than CBlob.getTouchingCount |
Vec2f | the offset to the blob corresponding to the given index |
Get the offset to one of blobs touching us by blob handle.
CBlob@ | blob to find the offset to, must be touching this blob. |
Vec2f | the offset to the given blob |
Check if this blob is overlapping the given one
Note: this won't work if a blob has recently spawned into a position that would overlap you.
CBlob@ | the blob to check for overlap |
bool | if the given blob is overlapping this one. |
Check if this blob is overlapping one with a given name
Note: this won't work if a blob has recently spawned into a position that would overlap you.
const string &in | the name to look out for |
bool | if a blob with a matching name is overlapping this one. |
Gets a list of all blobs that are overlapping this blob
CBlob@[]@ | a reference to a CBlob@ array |
bool | true if there is at least one blob overlapping |
Check if this blob can collide with a given blob.
Note: this is the check used internally to determine if two blobs will actually collide.
CBlob@ | the blob to check against |
bool | if they can collide. |
Get all the attachment points of this blob, into a given array.
AttachmentPoint@[]@ | the array to fill with attachment points |
bool | if any attachment points were added. |
Get the number of attachment points of this blob.
int | the number of attachment points. |
Get the attachment point of this blob corresponding to a given arbitrary index.
int | the index of the attachment point to get, should be less than CBlob.getAttachmentPointCount |
AttachmentPoint@ | the attachment point, or null for a bad index. |
Attempt to detach from a given blob, must be called serverside. Sucessful outcomes will be synced to all clients.
CBlob@ | the blob to attempt to detach from. |
bool | if detachment was successful. |
Attempt to detach all attached blobs, must be called serverside. Sucessful outcomes will be synced to all clients.
Attempt to detach from all blobs, must be called serverside. Sucessful outcomes will be synced to all clients.
Check if this blob is attached to a given one.
CBlob@ | the blob to check for attachment. |
bool | if we're attached. |
Check if this blob is attached to a point with a given name.
const string &in | the name to watch out for. |
bool | if we're attached to a point with the given name. |
Check if this blob is attached to anything.
bool | if we're attached to a point at all. |
Check if this blob has anything attached.
bool | if we have attached objects. |
Get the absolute position of a given attachment point.
Takes into account rotations, facing left, all that good stuff.
AttachmentPoint@ | the attachment point |
Vec2f | the current position of the attachment point. |
Gets the blob attached to the first "PICKUP" attachment point.
Gets null if there's no "PICKUP" attachment point or no blob attached.
Note: Semi-legacy function, still pretty useful though as all vanilla characters have the needed pickup point and use it for "held" items.
CBlob@ | the "carried" blob or null. |
Puts the blob attached to the first "PICKUP" attachment point into this blob's inventory, if possible.
Note: Semi-legacy function, still pretty useful though as all vanilla characters have the needed pickup point and use it for "held" items.
Detaches the blob attached to the first "PICKUP" attachment point.
Note: Semi-legacy function, still pretty useful though as all vanilla characters have the needed pickup point and use it for "held" items.
Attaches the given blob to the first attachment point with a given name.
Must be run on the server, any successful outcomes will be synced to all clients.
Note: Won't give particularly useful behaviour for blobs with multiple attachments of the same name.
CBlob@ | the blob to try to attach |
const string& in | the name of the attachment point to attach to. |
bool | if attachment was successful. |
Attaches the given blob to the attachment point with the given index.
Must be run on the server, any successful outcomes will be synced to all clients.
CBlob@ | the blob to try to attach |
int | the index to attach to, should be less than <CBlob.getAttachmentPointsCount> |
bool | if attachment was successful. |
Attaches the given blob to the given attachment point.
Must be run on the server, any successful outcomes will be synced to all clients.
CBlob@ | the blob to try to attach |
AttachmentPoint@ | the attachment point to attach to |
bool | if attachment was successful. |
Creates the round in-game functionality button.
int | frame number from the default button texture |
Vec2f | offset from the blob this button is attached to |
CBlob@ | button is attached to this blob |
u8 cmdID | the command Id that pressing this button sends |
const string | the label |
CBitStream | parameters for the command message |
CButton@ | the button |
Clears all menus that are open, grids and bubbles.
Must be run on the client, make sure to only call it for the owner player or you'll clear everyone's menus :)
Clears all grid menus that are open except for the inventory grid.
Must be run on the client, make sure to only call it for the owner player or you'll clear everyone's menus :)
Clears all grid menus that are open.
Must be run on the client, make sure to only call it for the owner player or you'll clear everyone's menus :)
Clears all button menus that are open.
Must be run on the client, make sure to only call it for the owner player or you'll clear everyone's menus :)
Shows the button menu for this object.
Must be run on the client, make sure to only call it for the owner player or you'll open menus for everyone :)
Click any interaction button that's highlighted on the client.
bool | if a button was pressed. |
Click the interaction button closest to the given position.
Vec2f | position to click at |
f32 | the maximum radius to find buttons in |
bool | if a button was pressed. |
Create the inventory menu for this blob at a given screen position.
Vec2f | position to spawn the menu at |
Show the pickup buttons for this object.
Show the emoticon menu.
Hide the emoticon menu.
Add a bubble to the emoticon menu, with a description.
const string &in | description of the bubble |
int | the frame index in the emoticon file |
Clear the list of bubbles for the emoticon menu.
Load an image for the bubble/emoticon menu.
const string &in | the filename of the image to load. |
Set up the minimap vars for this object.
Should usually be done in oninit, though you can change things as the game progresses for things like !!! on the minimap.
const string &in | the texture to get frames from. |
const u16 | the frame to display |
const Vec2f | the frame size in pixels |
Set up the minimap edge behaviour.
Should usually be done in oninit.
u8 | a bitfield of the flags, use MinimapEnum values |
Set up if we should always render this on the minimap, even if its in the dark and an enemy.
Should usually be done in oninit.
bool | always or not? |
Unset all the minimap vars, so this renders nothing on the minimap again.
Predefined bitfields ready to be passed to CBlob.SetMinimapOutsideBehaviour
Set the map edge collision flags.
Use a bitfield of CBlob.EdgeEnum values.
u8 | the flags to set. |
Get the currently set map edge collision flags.
u8 | the current flags. |
Retrieves the sprite component if present.
CSprite@ | the component class |
Retrieves the shape component if present.
CShape@ | the component class |
Retrieves the movement component if present.
CMovement@ | the component class |
Retrieves the brain component for AI if present.
CBrain@ | the component class |
Retrieves the attachments component if present.
CAttachment@ | the component class |
Retrieves the inventory component if present.
CInventory@ | the component class |
Picks up another blob and puts it in the 'PICKUP' attachment slot
CBlob@ | the blob to pickup |
bool | whether or not the pickup succeeded |
Gets the unique ID number of the blob
u16 | an id number |
Returns the blobs team number
int | team number |
Sets the blob team number (server-side and synced to clients).
int | the new team number |
Gets the head index of the blob.
int | head index |
Sets the head index of the blob.
int | head index |
Gets the sex of the blob (0/1 male/female).
int | 0 or 1 |
Sets the sex of the blob (0/1 male/female).
int | 0 or 1 |
Gets the blob class name
string | blob name |
Is this blob controlled by my player? (local player)
bool | true or false |
Get the index of the local player (0 | first player) |
int
Is this blob controlled by a bot?
bool | true or false |
Gets the blob input system.
CControls@ | the controls class |
Returns the .cfg config file name from which this blob was loaded from
string | the file name |
Is the blob currently having this key pressed?
keys | the key (see E_ACTIONKEYS) |
bool | true or false |
Was this key pressed in the previous tick?
keys | the key (see E_ACTIONKEYS) |
bool -true or false
Was this key pressed this tick?
keys | the key (see E_ACTIONKEYS) |
bool -true or false
Was this key released in this tick?
keys | the key (see E_ACTIONKEYS) |
bool -true or false
Sets the blobs key.
keys | the key (see E_ACTIONKEYS) |
bool | pressed or not |
Get the blob's aim/mouse position.
Vec2f | the aim position |
Set the blob's aim/mouse position.
Note that this won't actually move the mouse for player controlled blobs - it's intended for use in bots, remote controlled items, animals, etc.
Vec2f | the aim position |
Get the blob's aim/mouse direction (and optionally the aim vector as well).
Vec2f &out | the normalised "exact" aim vector |
int | simplified aim direction, 0 for forward, -1 for up, 1 for down |
Disable (or enable) specific keys for this blob.
u16 | bitfield of the keys to disable |
Disable (or enable) the mouse for this blob.
bool | should the mouse be disabled? |
Check if we would be overlapped if we moved to a given position, at a given angle.
Kinda buggy as is.
Vec2f | the position to test |
f32 | the angle to test |
bool | would we be overlapped? |
Get the distance to a given other blob.
Very likely faster than doing it yourself.
CBlob@ | the other blob |
f32 | the distance to the other blob |
Hit another blob.
CBlob@ | the blob to hit |
Vec2f | the position to hit them at |
Vec2f | the velocity/direction to hit them with |
f32 | the damage to do to them |
u8 | custom data, used throughout KAG as the "hitter" |
bool | whether or not to hit teamies |
Hit another blob.
CBlob@ | the blob to hit |
Vec2f | the position to hit them at |
Vec2f | the velocity/direction to hit them with |
f32 | the damage to do to them |
u8 | custom data, used throughout KAG as the "hitter" |
Hit the tilemap.
Vec2f | the position to hit |
Vec2f | the velocity/direction to hit |
f32 | the damage to do to the tile |
u8 | custom data, used throughout KAG as the "hitter" |
Do damage to this blob, setting who hit us last in the process.
Only use this in a blob's onHit function!
f32 | the damage to do |
CBlob@ | the blob that hit us |
Heal this blob by some amount, up to a maximum of its original (configfile) health.
f32 | the amount to heal |
Set this blob's health absolutely.
f32 | the amount to set our health to. |
Set the player that owns the damage from this blob.
Useful for things like bombs/arrows, anything they hit will act as though hit by their owner.
CPlayer@ | the player to set as the damage owner of this blob. |
Get the player that owns the damage from this blob.
CPlayer@ | the player that owns the damage of this blob. |
Set the player that most recently hit this blob.
CPlayer@ | the player that recently (probably just now) hit this blob. |
f32 | the damage the player dealt. |
Get the player that most recently hit this blob.
CPlayer@ | the player that recently hit this blob. |
Gets a list of all players that have dealt damage to this blob
CPlayer@[]@ | a reference to a CPlayer@ array |
bool | true if at least one player has dealt damage |
Gets a list of all the times when the blob was damaged
int[] | an array of game ticks when damaged |
bool | true if the blob was damaged at least once |
Gets a list of the hearts of damage done to the blob on each hit
int[] | an array of hearts of damage done when damaged |
bool | true if the blob was damaged at least once |
Set a blob to ignore collisions with until we stop overlapping.
CBlob@ | the blob to ignore. |
Set a blob to ignore collisions with until we stop overlapping or some ticks run out.
CBlob@ | the blob to ignore. |
int | the number of ticks to ignore for. |
Plug a player into this blob, or remove the currently plugged player.
CPlayer@ | the player to plug, or null to unplug the current player. |
bool | on success |
Move this blob's inventory to some other blob's (normally done just before killing the blob).
CBlob@ | the blob to recieve all our stuff. |
Get the player plugged into this blob.
CPlayer@ | our player. |
Set the time before this blob mysteriously vanishes. The timer stops if blob is in an inventory.
This is generally done for bodies, materials etc; the blob dying by this method doesn't invoke any hits/effects.
If you want effects when it happens you need to do so in onDie (similarly with CBlob.server_Die)
Set a negative time to disable the kill countdown.
f32 | the number of seconds before we die. |
Get the time in ticks before this blob mysteriously vanishes.
int | the number of ticks before we die. |
Get the time in seconds before this blob mysteriously vanishes.
f32 | the number of seconds before we die. |
Get an existing command ID from a string.
Adds the ID if it doesn't already exist, but prints a warning. It's best to add the command id in onInit.
const string &in | the ID name to get |
u8 | the id corresponding to that name |
Add a command ID from a string.
const string &in | the ID name to add |
u8 | the new id corresponding to that name |
Checks if command ID exists
const string &in | the ID name |
bool | true/false |
Get the name of an existing command ID.
Essentially the reverse of CBlob.getCommandID
u8 | the ID to get a name for |
string | the name corresponding to that id |
Set the light radius of this blob.
f32 | the new light radius |
Set the light color of this blob.
SColor | the new light color |
Set the light on or off.
bool | if the light is on or not. |
Check if the light is on or off.
bool | if the light is on or not. |
Get the light radius.
f32 | the current radius of the light. |
Get the light color.
SColor | the current color of the light. |
Check if the blob is on screen or not.
bool | true if the blob is currently on screen. |
Check if the blob is in fire or not.
bool | true if the blob is currently overlapping fire. |
Check if the blob is flammable.
This is really just to check the variable from config file - the engine doesn't do anything special with flammable blobs.
bool | true if the blob is marked as flammable in config. |
Check how long this blob has existed for.
int | time in ticks since this blob was created. |
Make this blob say a chat bubble.
Useful for bots/npcs.
const string &in | the text to put in the chat bubble. |
Sets the chat font.
const string &in | the name of the font (hud/gui/intro,menu) |
Max number of lines in chat bubble
int | lines number |
Sets the chat font.
const string &in | the name of the font (hud/gui/intro/menu) |
Is the chat bubble visible?
Get the map that contains this blob.
For now (and probably forever) this is the same as the global <getMap()>
CMap@ | the map containing this blob. |
Returns true if the blob has the passed quantity of blobs in its inventory
string | blob name |
u16 | blob quantity |
bool | has or not |
Removes the passed quantity of blobs from inventory
string | blob name |
u16 | blob quantity |
u16 | how much was actually taken |
Quantity of blobs inside of this blobs inventory
string | blob name |
u16 | how much is there |
Creates a new blob in the world.
const string &in | blob config name |
int | team number |
Vec2f | position |
CBlob@ | returns a reference to the newly created blob |
Creates a new blob in the world.
const string &in | blob config name |
CBlob@ | returns a reference to the newly created blob |
Creates a new blob in the world but doesn't initialize it. Useful if you need to pass parameters to the onInit() function. Call blob.init() when you're ready.
const string &in | blob config name |
CBlob@ | returns a reference to the newly created blob |
Structure holding script information, such as how often to update, what conditions to run under, and so on.
How often to run the script's onTick functions.
A set of bit-flags of when to run the script.
enum RunFlags { tick_sleeping = 0x1, tick_onscreen = 0x2, tick_inwater = 0x4, tick_not_inwater = 0x8, tick_onground = 0x10, tick_not_onground = 0x20, tick_moving = 0x40, tick_not_moving = 0x80, tick_infire = 0x100, tick_not_infire = 0x200, tick_overlapping = 0x400, tick_not_overlapping = 0x800, tick_blob_in_proximity = 0x1000, // can use radius, tag remove_after_this = 0x2000, tick_not_sleeping = 0x4000, tick_attached = 0x8000, tick_not_attached = 0x10000, tick_onladder = 0x20000, tick_not_onladder = 0x40000, tick_myplayer = 0x80000, tick_onmap = 0x100000, tick_not_onmap = 0x200000, tick_hasattached = 0x400000, tick_not_hasattached = 0x800000, tick_ininventory = 0x1000000, tick_not_ininventory = 0x2000000 };
A tag to check for nearby (only one supported). The script will run only if an object with this tag is within runProximityRadius
the radius to check for objects with runProximityTag within.
This script will be removed if the CBlob it's attached to gains this tag. Most often used for the "dead" tag, so that some scripts stop running once the object is a ragdoll.
This script will tick only if the CBlob it's attached to has this tag.