CBlob

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.

Script Related
CBlob.​getCurrentScript

Returns a handle to the ScriptData relating to the script that's currently running.

Returns
ScriptData

this script's data.

CBlob.​Init

Initialise a previously uninitialised blob.  This is only useful (or safe) for blobs initialised with .server_CreateBlobNoInit()

Basic Info
CBlob.​getHealth

Get the current health of a blob.

Returns
f32

the health.

CBlob.​getInitialHealth

Get the initial health of a blob set in the config file.

Returns
f32

the original health of this blob.

CBlob.​getPosition

Get the current position of a blob.

Returns
Vec2f

the position.

CBlob.​getOldPosition

Get the previous (last frame) position of a blob.

Returns
Vec2f

the position.

CBlob.​getInterpolatedPosition

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().

Returns
Vec2f

the interpolated position.

CBlob.​setPosition

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.

Parameters
Vec2f

the position to set in world space coordinates

CBlob.​getVelocity

Get the current velocity of a blob.

Returns
Vec2f

the velocity.

CBlob.​getOldVelocity

Get the previous frame's velocity of a blob.  (useful just after you collided with a wall, or the ground)

Returns
Vec2f

the old velocity.

CBlob.​setVelocity

Get the current position of a blob.

Parameters
Vec2f

the velocity to set

CBlob.​AddForce

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.

Parameters
Vec2f

the force to apply

CBlob.​AddForceAtPosition

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.

Parameters
Vec2f

the force to apply

Vec2f

the position to apply the force at

See Also: CBlob.AddForce, CBlob.AddTorque

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.

Parameters
f32

the torque to apply

CBlob.​getRadius

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.

Returns
f32

the radius in world units.

CBlob.​getWidth

Get the width of the blob.

Note: this doesn't take into account rotation.

Returns
f32

the width in world units.

CBlob.​getHeight

Get the height of the blob.

Note: this doesn't take into account rotation.

Returns
f32

the height in world units.

CBlob.​setAngleDegrees

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.

Parameters
f32

the angle to set the rotation to

CBlob.​getAngleDegrees

Get the rotation of the blob.

Returns
f32

the blob's rotation.

CBlob.​setAngleRadians

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.

Parameters
f32

the angle to set the rotation to

CBlob.​getAngleRadians

Get the rotation of the blob.

Returns
f32

the blob's rotation.

CBlob.​setAngularVelocity

Set the rotational speed of the blob.

Parameters
f32

the angular velocity to set the rotation to

CBlob.​getAngularVelocity

Get the speed at which this blob is rotating.

Returns
f32

the angular velocity.

CBlob.​getMass

Get the mass of the blob.  This describes how physically heavy the blob is.

Returns
f32

the blob's mass.

CBlob.​SetMass

Set the mass of the blob.

Note: This can cause all sorts of physical strangeness and is only included for completeness.

Parameters
f32

the mass to forcefully set this blob to become.

CBlob.​SetVisible

Set if the blob should be rendered at all.

Parameters
bool

the new visibility value.

CBlob.​server_Die

Hard-Kill this blob, erase it from the world.

Does not gib the blob, but does cause any onDie hooks to be run.

CBlob.​isActive

Returns whether or not the blob is active and ticking.

Returns
bool

active: true or false

CBlob.​server_SetActive

Disables the body so it doesn't run any ticks.

Parameters
bool

active: true or false

CBlob.​isCollideable

If the blob is collideable at all, or not.

Note that this doesn't necessarily mean everything will collide with it.

Returns
bool

if the object can collide with anything.

CBlob.​isLadder

Get if the blob counts as a ladder or not.

Returns
bool

if the object is a ladder.

CBlob.​isPlatform

Get if the blob has any "platform" collision information.

Returns
bool

if the object is a "platform".

CBlob.​getPositionWithOffset

Returns position of blob with offset (corrected by facing)

Parameters
Vec2f

offset

Returns
Vec2f

position

CBlob.​getScreenPos

Get the screen position of the blob.

Returns
Vec2f

the screen position

CBlob.​getInterpolatedScreenPos

Get the interpolated screen position of the blob, see getInterpolatedPosition.

Returns Vec2f - the interpolated screen position

CBlob.​isFacingLeft

Get directional facing information.

Returns
bool

if the blob is facing left.

CBlob.​SetFacingLeft

Set directional facing information.

Parameters
bool

if the blob should be facing left.

Collision
CBlob.​isOnGround

Get collision information.

Returns
bool

if the blob is on the ground.

CBlob.​wasOnGround

Get collision information.

Returns
bool

if the blob was on the ground last frame.

CBlob.​isOnWall

Get collision information.

Returns
bool

if the blob is on a wall.

CBlob.​isOnCeiling

Get collision information.

Returns
bool

if the blob is on the ceiling.

CBlob.​isOnLadder

Find out if we're overlapping any ladder blobs.

Returns
bool

if the blob is touching a ladder.

See Also: CBlob.isLadder

CBlob.​wasOnLadder

Find out if we were overlapping any ladder blobs in the last tick.

Returns
bool

if the blob is touching a ladder.

See Also: CBlob.isOnLadder

CBlob.​getGroundNormal

Get collision information.

Returns
Vec2f

the overall normal of the blob's collisions.

CBlob.​getAirTime

Get collision information.

Returns
int

the number of frames since we last touched the map.

CBlob.​isOnMap

Get collision information.

Returns
bool

if the blob is touching the tilemap in any way.

CBlob.​isInWater

Get collision information.

Returns
bool

if the blob is in water.

CBlob.​isSnapToGrid

Returns snap to grid variable from CShape.

Returns
bool

true or not

CBlob.​isPointInside

Find out if a blob overlaps a specific point.

Parameters
Vec2f

point to check in worldspace coordinates

Returns
bool

if the blob overlaps the given point.

Script Management
CBlob.​RemoveScript

Remove a script from this blob.

Parameters
const string &in

the filename or partial filename of the script to remove

Returns
bool

if the script was removed successfully.

CBlob.​AddScript

Add a script to this blob.

Parameters
const string &in

the filename or partial filename of the script to add

Returns
bool

if the script was added successfully.

CBlob.​hasScript

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.

Parameters
const string &in

the filename or partial filename of the script to check

Returns
bool

if the script was present.

CBlob.​doTickScripts

If we should do any tick scripts at all.

Note: you're probably better off using ScriptData for this.

CBlob.​sendonlyvisible
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.

Inventory
CBlob.​inventoryIconFrame

What frame to display when inside the inventory.

Note: you should set this in the config file or with CBlob.SetInventoryIcon.

CBlob.​inventoryMaxStacks

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.

CBlob.​inventoryButtonPos

<Vec2f> The icon rendering offset in the inventory menu.

CBlob.​inventoryIconName

The name of the icon to display.

Note: you should set this in the config file or with CBlob.SetInventoryIcon.

CBlob.​inventoryFrameDimension

The size of one frame of the icon

Note: you should set this in the config file or with CBlob.SetInventoryIcon.

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.

Parameters
const string &in

the texture filename

int

the frame

Vec2f

the frame dimensions

CBlob.​checkInventoryAccessibleCarefully

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.

CBlob.​getIgnoreCollisionBlob

Get the blob we're currently ignoring collisions with, if any.

Returns
CBlob@

the blob we're ignoring collisions with, or null.

CBlob.​server_PutInInventory

Put the passed blob into our inventory if possible.

Parameters
CBlob@

the blob to attempt to put in our inventory.

Returns
bool

if the blob was successfully put into our inventory.

CBlob.​server_PutOutInventory

Remove the passed blob from our inventory if possible.

Parameters
CBlob@

the blob to attempt to remove from our inventory.

Returns
bool

if the blob was successfully removed.

CBlob.​server_PutOutInventory

Attempt to remove a blob from our inventory by name, getting a handle to the blob removed if successful.

Parameters
const string &in

the name of the blob to try to remove.

Returns
CBlob@

the blob removed if any, null otherwise.

CBlob.​server_RemoveFromInventories

Removes blob from all inventory it might be in.

CBlob.​canBePutInInventory

Check if a given blob can be put in our inventory at the moment.

Parameters
CBlob@

the blob to check.

Returns
bool

if the blob will fit.

CBlob.​isInventoryAccessible

Check if a given blob can access our inventory at the moment.

Parameters
CBlob@

the blob to check.

Returns
bool

if the inventory is accessible for the given blob.

CBlob.​server_SetQuantity

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.

Parameters
s32

the amount to store in this "stack".

CBlob.​getQuantity

Get the quantity stored in this blob (eg in a stack of materials).

Returns
u16

the quantity

See Also: CBlob.server_SetQuantity

CBlob.​maxQuantity

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).

CBlob.​getMaxQuantity

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.

CBlob.​getInventoryName

Get the name of this blob when viewed inside the inventory.

Returns
string

the name displayed

CBlob.​setInventoryName

Set the name of this blob when viewed inside the inventory.

Parameters
string

the name to be displayed

CBlob.​isInInventory

Find out if this blob is inside an inventory.

Returns
bool

if inside an inventory.

CBlob.​getInventoryBlob

Get the blob that has this blob in it's inventory, if any.

Returns
CBlob@

the blob holding us, or null otherwise.

CBlob.​canBePickedUp

Find out if this blob can be picked up by another blob

Parameters
CBlob@

the blob to check compatibility with.

Returns
bool

if this blob can be picked up.

Rendering
RenderStyle::​Style
normal

normal rendering mode.

light

render light.

outline

render a light outline.

outline_front

render a light outline, in front of most other objects

addititive

render with additive blending

subtractive

render with subtractive blending

shadow

render shadow

CBlob.​RenderForHUD

Set this blob to render for the HUD.

Parameters
Vec2f

offset on the rendering

f32

angle to render at

SColor

a color to multiply with

RenderStyle::Style

the render style

CBlob.​RenderForHUD

Set this blob to render for the HUD.

Parameters
Vec2f

offset on the rendering

RenderStyle::Style

the render style

CBlob.​RenderForHUD

Set this blob to render for the HUD.

Parameters
RenderStyle::Style

the render style

Collision/Overlap Management
CBlob.​getTouchingCount

Find out how many blobs we're touching.

MM: "touchy touchy"

Returns
int

the number of blobs we're touching

CBlob.​getTouchingByIndex

Get one of the blobs touching us by arbitrary index.

Parameters
int

index to get, must be less than CBlob.getTouchingCount

Returns
CBlob@

the blob corresponding to the given index

CBlob.​getTouchingOffsetByIndex

Get the offset to one of blobs touching us by arbitrary index.

Parameters
int

index to get, must be less than CBlob.getTouchingCount

Returns
Vec2f

the offset to the blob corresponding to the given index

CBlob.​getTouchingOffsetByIndex

Get the offset to one of blobs touching us by blob handle.

Parameters
CBlob@

blob to find the offset to, must be touching this blob.

Returns
Vec2f

the offset to the given blob

CBlob.​isOverlapping

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.

Parameters
CBlob@

the blob to check for overlap

Returns
bool

if the given blob is overlapping this one.

CBlob.​isOverlapping

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.

Parameters
const string &in

the name to look out for

Returns
bool

if a blob with a matching name is overlapping this one.

CBlob.​getOverlapping

Gets a list of all blobs that are overlapping this blob

Parameters
CBlob@[]@

a reference to a CBlob@ array

Returns
bool

true if there is at least one blob overlapping

CBlob.​doesCollideWithBlob

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.

Parameters
CBlob@

the blob to check against

Returns
bool

if they can collide.

Attachment
CBlob.​getAttachmentPoints

Get all the attachment points of this blob, into a given array.

Parameters
AttachmentPoint@[]@

the array to fill with attachment points

Returns
bool

if any attachment points were added.

CBlob.​getAttachmentPointCount

Get the number of attachment points of this blob.

Returns
int

the number of attachment points.

See Also

CBlob.getAttachmentPoint

CBlob.​getAttachmentPoint

Get the attachment point of this blob corresponding to a given arbitrary index.

Parameters
int

the index of the attachment point to get, should be less than CBlob.getAttachmentPointCount

Returns
AttachmentPoint@

the attachment point, or null for a bad index.

CBlob.​server_DetachFrom

Attempt to detach from a given blob, must be called serverside.  Sucessful outcomes will be synced to all clients.

Parameters
CBlob@

the blob to attempt to detach from.

Returns
bool

if detachment was successful.

CBlob.​server_DetachAll

Attempt to detach all attached blobs, must be called serverside.  Sucessful outcomes will be synced to all clients.

CBlob.​server_DetachFromAll

Attempt to detach from all blobs, must be called serverside.  Sucessful outcomes will be synced to all clients.

CBlob.​isAttachedTo

Check if this blob is attached to a given one.

Parameters
CBlob@

the blob to check for attachment.

Returns
bool

if we're attached.

CBlob.​isAttachedToPoint

Check if this blob is attached to a point with a given name.

Parameters
const string &in

the name to watch out for.

Returns
bool

if we're attached to a point with the given name.

CBlob.​isAttached

Check if this blob is attached to anything.

Returns
bool

if we're attached to a point at all.

CBlob.​hasAttached

Check if this blob has anything attached.

Returns
bool

if we have attached objects.

CBlob.​getAbsoluteAttachmentPoint

Get the absolute position of a given attachment point.

Takes into account rotations, facing left, all that good stuff.

Parameters
AttachmentPoint@

the attachment point

Returns
Vec2f

the current position of the attachment point.

CBlob.​getCarriedBlob

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.

Returns
CBlob@

the "carried" blob or null.

CBlob.​PutCarriedInInventory

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.

CBlob.​DropCarried

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.

CBlob.​server_AttachTo

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.

Parameters
CBlob@

the blob to try to attach

const string& in

the name of the attachment point to attach to.

Returns
bool

if attachment was successful.

CBlob.​server_AttachTo

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.

Parameters
CBlob@

the blob to try to attach

int

the index to attach to, should be less than <CBlob.getAttachmentPointsCount>

Returns
bool

if attachment was successful.

CBlob.​server_AttachTo

Attaches the given blob to the given attachment point.

Must be run on the server, any successful outcomes will be synced to all clients.

Parameters
CBlob@

the blob to try to attach

AttachmentPoint@

the attachment point to attach to

Returns
bool

if attachment was successful.

Generic Buttons @MM
CBlob.​CreateGenericButton

Creates the round in-game functionality button.

Parameters
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

Returns
CButton@

the button

Menus
CBlob.​ClearMenus

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 :)

CBlob.​ClearGridMenusExceptInventory

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 :)

CBlob.​ClearGridMenus

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 :)

CBlob.​ClearButtons

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 :)

CBlob.​ShowInteractButtons

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 :)

CBlob.​ClickInteractButton

Click any interaction button that's highlighted on the client.

Returns
bool

if a button was pressed.

CBlob.​ClickClosestInteractButton

Click the interaction button closest to the given position.

Parameters
Vec2f

position to click at

f32

the maximum radius to find buttons in

Returns
bool

if a button was pressed.

CBlob.​CreateInventoryMenu

Create the inventory menu for this blob at a given screen position.

Parameters
Vec2f

position to spawn the menu at

CBlob.​ShowPickupButtons

Show the pickup buttons for this object.

CBlob.​CreateBubbleMenu

Show the emoticon menu.

CBlob.​ClearBubbleMenu

Hide the emoticon menu.

CBlob.​AddBubble

Add a bubble to the emoticon menu, with a description.

Parameters
const string &in

description of the bubble

int

the frame index in the emoticon file

CBlob.​ClearBubbles

Clear the list of bubbles for the emoticon menu.

CBlob.​LoadBubbles

Load an image for the bubble/emoticon menu.

Parameters
const string &in

the filename of the image to load.

Minimap
CBlob.​SetMinimapVars

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.

Parameters
const string &in

the texture to get frames from.

const u16

the frame to display

const Vec2f

the frame size in pixels

CBlob.​SetMinimapOutsideBehaviour

Set up the minimap edge behaviour.

Should usually be done in oninit.

Parameters
u8

a bitfield of the flags, use MinimapEnum values

CBlob.​SetMinimapRenderAlways

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.

Parameters
bool

always or not?

CBlob.​UnsetMinimapVars

Unset all the minimap vars, so this renders nothing on the minimap again.

CBlob.​MinimapEnum

Predefined bitfields ready to be passed to CBlob.SetMinimapOutsideBehaviour

CBlob::minimap_none

no edge behaviour, this blob will pass off the edge of the map and vanish.

CBlob::minimap_snap

snap to the edge of the map but maintain the icon.

CBlob::minimap_arrow

snap to the edge of the map but show an arrow icon.

Scoreboard
Map Edge Behaviour
CBlob.​SetMapEdgeFlags

Set the map edge collision flags.

Use a bitfield of CBlob.EdgeEnum values.

Parameters
u8

the flags to set.

CBlob.​getMapEdgeFlags

Get the currently set map edge collision flags.

Return
u8

the current flags.

CBlob.​EdgeEnum
CBlob::map_collide_none

no flags set, fall through all edges of the map

CBlob::map_collide_up

collide with the top side of the map

CBlob::map_collide_down

collide with the bottom side of the map

CBlob::map_collide_left

collide with the left side of the map

CBlob::map_collide_right

collide with the right side of the map

CBlob::map_collide_sides

collide with both left and right, shortcut for CBlob::map_collide_left | CBlob::map_collide_right.

CBlob::map_collide_nodeath

don't kill if outside map

CBlob::map_collide_bounce

simple velocity inversion off the edge

Components
CBlob.​getSprite

Retrieves the sprite component if present.

Returns
CSprite@

the component class

CBlob.​getShape

Retrieves the shape component if present.

Returns
CShape@

the component class

CBlob.​getMovement

Retrieves the movement component if present.

Returns
CMovement@

the component class

CBlob.​getBrain

Retrieves the brain component for AI if present.

Returns
CBrain@

the component class

CBlob.​getAttachments

Retrieves the attachments component if present.

Returns
CAttachment@

the component class

CBlob.​getInventory

Retrieves the inventory component if present.

Returns
CInventory@

the component class

Attachments
CBlob.​server_Pickup

Picks up another blob and puts it in the 'PICKUP' attachment slot

Parameters
CBlob@

the blob to pickup

Returns
bool

whether or not the pickup succeeded

Net Object Stuff
CBlob.​getNetworkID

Gets the unique ID number of the blob

Returns
u16

an id number

Actor/Player Specific
CBlob.​getTeamNum

Returns the blobs team number

Returns
int

team number

CBlob.​server_setTeamNum

Sets the blob team number (server-side and synced to clients).

Parameters
int

the new team number

CBlob.​getHeadNum

Gets the head index of the blob.

Returns
int

head index

CBlob.​setHeadNum

Sets the head index of the blob.

Parameters
int

head index

CBlob.​getSexNum

Gets the sex of the blob (0/1 male/female).

Returns
int

0 or 1

CBlob.​setSexNum

Sets the sex of the blob  (0/1 male/female).

Parameters
int

0 or 1

CBlob.​getName

Gets the blob class name

Returns
string

blob name

CBlob.​isMyPlayer

Is this blob controlled by my player? (local player)

Returns
bool

true or false

CBlob.​getMyPlayerIndex
Get the index of the local player (0

first player)

Returns

int

CBlob.​isBot

Is this blob controlled by a bot?

Returns
bool

true or false

CBlob.​getControls

Gets the blob input system.

Returns
CControls@

the controls class

CBlob.​getConfig

Returns the .cfg config file name from which this blob was loaded from

Returns
string

the file name

Helpers/Shortcuts
CBlob.​isKeyPressed

Is the blob currently having this key pressed?

Parameters
keys

the key (see E_ACTIONKEYS)

Returns
bool

true or false

CBlob.​wasKeyPressed

Was this key pressed in the previous tick?

Parameters
keys

the key (see E_ACTIONKEYS)

Returns

bool -true or false

CBlob.​isKeyJustPressed

Was this key pressed this tick?

Parameters
keys

the key (see E_ACTIONKEYS)

Returns

bool -true or false

CBlob.​isKeyJustReleased

Was this key released in this tick?

Parameters
keys

the key (see E_ACTIONKEYS)

Returns

bool -true or false

CBlob.​setKeyPressed

Sets the blobs key.

Parameters
keys

the key (see E_ACTIONKEYS)

bool

pressed or not

CBlob.​getAimPos

Get the blob's aim/mouse position.

Return
Vec2f

the aim position

CBlob.​setAimPos

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.

Parameters
Vec2f

the aim position

CBlob.​getAimDirection

Get the blob's aim/mouse direction (and optionally the aim vector as well).

Parameters
Vec2f &out

the normalised "exact" aim vector

Return
int

simplified aim direction, 0 for forward, -1 for up, 1 for down

CBlob.​DisableKeys

Disable (or enable) specific keys for this blob.

Parameters
u16

bitfield of the keys to disable

CBlob.​DisableMouse

Disable (or enable) the mouse for this blob.

Parameters
bool

should the mouse be disabled?

CBlob.​isOverlappedAtPosition

Check if we would be overlapped if we moved to a given position, at a given angle.

Kinda buggy as is.

Parameters
Vec2f

the position to test

f32

the angle to test

Return
bool

would we be overlapped?

CBlob.​getDistanceTo

Get the distance to a given other blob.

Very likely faster than doing it yourself.

Parameters
CBlob@

the other blob

Return
f32

the distance to the other blob

Hitting
CBlob.​server_Hit

Hit another blob.

Parameters
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

CBlob.​server_Hit

Hit another blob.

Parameters
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"

CBlob.​server_HitMap

Hit the tilemap.

Parameters
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"

CBlob.​Damage

Do damage to this blob, setting who hit us last in the process.

Only use this in a blob's onHit function!

Parameters
f32

the damage to do

CBlob@

the blob that hit us

CBlob.​server_Heal

Heal this blob by some amount, up to a maximum of its original (configfile) health.

Parameters
f32

the amount to heal

CBlob.​server_SetHealth

Set this blob's health absolutely.

Parameters
f32

the amount to set our health to.

CBlob.​SetDamageOwnerPlayer

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.

Parameters
CPlayer@

the player to set as the damage owner of this blob.

CBlob.​getDamageOwnerPlayer

Get the player that owns the damage from this blob.

Return
CPlayer@

the player that owns the damage of this blob.

CBlob.​SetPlayerOfRecentDamage

Set the player that most recently hit this blob.

Parameters
CPlayer@

the player that recently (probably just now) hit this blob.

f32

the damage the player dealt.

CBlob.​getPlayerOfRecentDamage

Get the player that most recently hit this blob.

Return
CPlayer@

the player that recently hit this blob.

CBlob.​getPlayersOfDamage

Gets a list of all players that have dealt damage to this blob

Parameters
CPlayer@[]@

a reference to a CPlayer@ array

Returns
bool

true if at least one player has dealt damage

CBlob.​getTimesOfDamage

Gets a list of all the times when the blob was damaged

Parameters
int[]

an array of game ticks when damaged

Returns
bool

true if the blob was damaged at least once

CBlob.​getAmountsOfDamage

Gets a list of the hearts of damage done to the blob on each hit

Parameters
int[]

an array of hearts of damage done when damaged

Returns
bool

true if the blob was damaged at least once

Collision Helpers
CBlob.​IgnoreCollisionWhileOverlapped

Set a blob to ignore collisions with until we stop overlapping.

Parameters
CBlob@

the blob to ignore.

CBlob.​IgnoreCollisionWhileOverlapped

Set a blob to ignore collisions with until we stop overlapping or some ticks run out.

Parameters
CBlob@

the blob to ignore.

int

the number of ticks to ignore for.

Player
CBlob.​server_SetPlayer

Plug a player into this blob, or remove the currently plugged player.

Parameters
CPlayer@

the player to plug, or null to unplug the current player.

Return
bool

on success

CBlob.​MoveInventoryTo

Move this blob's inventory to some other blob's (normally done just before killing the blob).

Parameters
CBlob@

the blob to recieve all our stuff.

CBlob.​getPlayer

Get the player plugged into this blob.

Return
CPlayer@

our player.

CBlob.​server_SetTimeToDie

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.

Parameters
f32

the number of seconds before we die.

CBlob.​getTicksToDie

Get the time in ticks before this blob mysteriously vanishes.

Return
int

the number of ticks before we die.

CBlob.​getTimeToDie

Get the time in seconds before this blob mysteriously vanishes.

Return
f32

the number of seconds before we die.

Network Stuff
Sync Related
CBlob.​getCommandID

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.

Parameters
const string &in

the ID name to get

Return
u8

the id corresponding to that name

CBlob.​addCommandID

Add a command ID from a string.

Parameters
const string &in

the ID name to add

Return
u8

the new id corresponding to that name

CBlob.​hasCommandID

Checks if command ID exists

Parameters
const string &in

the ID name

Return
bool

true/false

CBlob.​getNameFromCommandID

Get the name of an existing command ID.

Essentially the reverse of CBlob.getCommandID

Parameters
u8

the ID to get a name for

Return
string

the name corresponding to that id

Light
CBlob.​SetLightRadius

Set the light radius of this blob.

Parameters
f32

the new light radius

CBlob.​SetLightColor

Set the light color of this blob.

Parameters
SColor

the new light color

CBlob.​SetLight

Set the light on or off.

Parameters
bool

if the light is on or not.

CBlob.​isLight

Check if the light is on or off.

Returns
bool

if the light is on or not.

CBlob.​getLightRadius

Get the light radius.

Returns
f32

the current radius of the light.

CBlob.​getLightColor

Get the light color.

Returns
SColor

the current color of the light.

Status
CBlob.​isOnScreen

Check if the blob is on screen or not.

Returns
bool

true if the blob is currently on screen.

CBlob.​isInFlames

Check if the blob is in fire or not.

Returns
bool

true if the blob is currently overlapping fire.

CBlob.​isFlammable

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.

Returns
bool

true if the blob is marked as flammable in config.

CBlob.​getTickSinceCreated

Check how long this blob has existed for.

Returns
int

time in ticks since this blob was created.

CBlob.​Chat

Make this blob say a chat bubble.

Useful for bots/npcs.

Parameters
const string &in

the text to put in the chat bubble.

CBlob.​SetChatBubbleFont

Sets the chat font.

Parameters
const string &in

the name of the font (hud/gui/intro,menu)

CBlob.​maxChatBubbleLines

Max number of lines in chat bubble

Parameters
int

lines number

CBlob.​SetChatBubbleFont

Sets the chat font.

Parameters
const string &in

the name of the font (hud/gui/intro/menu)

CBlob.​isChatBubbleVisible

Is the chat bubble visible?

Map
CBlob.​getMap()

Get the map that contains this blob.

For now (and probably forever) this is the same as the global <getMap()>

Return
CMap@

the map containing this blob.

Inventory
CBlob.​hasBlob()

Returns true if the blob has the passed quantity of blobs in its inventory

Parameters
string

blob name

u16

blob quantity

Return
bool

has or not

CBlob.​TakeBlob()

Removes the passed quantity of blobs from inventory

Parameters
string

blob name

u16

blob quantity

Return
u16

how much was actually taken

CBlob.​getBlobCount()

Quantity of blobs inside of this blobs inventory

Parameters
string

blob name

Return
u16

how much is there

Globals
server_CreateBlob()

Creates a new blob in the world.

Parameters
const string &in

blob config name

int

team number

Vec2f

position

Return
CBlob@

returns a reference to the newly created blob

server_CreateBlob()

Creates a new blob in the world.

Parameters
const string &in

blob config name

Return
CBlob@

returns a reference to the newly created blob

server_CreateBlobNoInit()

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.

Parameters
const string &in

blob config name

Return
CBlob@

returns a reference to the newly created blob

ScriptData

Structure holding script information, such as how often to update, what conditions to run under, and so on.

Variables
tickFrequency

How often to run the script's onTick functions.

runFlags

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 };

runProximityTag

A tag to check for nearby (only one supported).  The script will run only if an object with this tag is within runProximityRadius

runProximityRadius

the radius to check for objects with runProximityTag within.

removeIfTag

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.

tickIfTag

This script will tick only if the CBlob it's attached to has this tag.