Item

consoledoc.h

Base Item class. Uses the ItemData datablock for common properties.

More...

Misc

bool

If true, the object is not moving in the world.

bool

If true, the object will automatically rotate around its Z axis.

Callbacks

void
onStickyCollision(string objID)

Informs the Item object that it is now sticking to another object.

void
onEnterLiquid(string objID, float waterCoverage, string liquidType)

Informs an Item object that it has entered liquid, along with information about the liquid type.

void
onLeaveLiquid(string objID, string liquidType)

Informs an Item object that it has left a liquid, along with information about the liquid type.

Public Static Attributes

bool

Disables rendering of all instances of this type.

bool

Disables selection of all instances of this type.

int

When a warp needs to occur due to the client being too far off from the server, this is the maximum number of ticks we'll allow the client to warp to catch up.

float

Fraction of tick at which instant warp occures on the client.

Public Functions

string

Get the normal of the surface on which the object is stuck.

string

Get the position on the surface on which this Item is stuck.

bool

Is the object at rest (ie, no longer moving)?

bool

Is the object still rotating?

bool

Is the object static (ie, non-movable)?

bool
setCollisionTimeout(int ignoreColObj)

Temporarily disable collisions against a specific ShapeBase object.

Detailed Description

Base Item class. Uses the ItemData datablock for common properties.

Items represent an object in the world, usually one that the player will interact with. One example is a health kit on the group that is automatically picked up when the player comes into contact with it.

// This is the "health patch" dropped by a dying player.
datablock ItemData(HealthKitPatch)
{
   // Mission editor category, this datablock will show up in the
   // specified category under the "shapes" root category.
   category = "Health";

   className = "HealthPatch";

   // Basic Item properties
   shapeFile = "art/shapes/items/patch/healthpatch.dts";
   mass = 2;
   friction = 1;
   elasticity = 0.3;
   emap = true;

   // Dynamic properties used by the scripts
   pickupName = "a health patch";
   repairAmount = 50;
};

%obj = new Item()
{
   dataBlock = HealthKitSmall;
   parentGroup = EWCreatorWindow.objectGroup;
   static = true;
   rotate = true;
};

Misc

bool static 

If true, the object is not moving in the world.

bool rotate 

If true, the object will automatically rotate around its Z axis.

Callbacks

onStickyCollision(string objID)

Informs the Item object that it is now sticking to another object.

This callback is only called if the ItemData::sticky property for this Item is true. Parameters:

objID

Object ID this Item object.

note:

Server side only.

onEnterLiquid(string objID, float waterCoverage, string liquidType)

Informs an Item object that it has entered liquid, along with information about the liquid type.

Parameters:

objID

Object ID for this Item object.

waterCoverage

How much coverage of water this Item object has.

liquidType

The type of liquid that this Item object has entered.

note:

Server side only.

onLeaveLiquid(string objID, string liquidType)

Informs an Item object that it has left a liquid, along with information about the liquid type.

Parameters:

objID

Object ID for this Item object.

liquidType

The type of liquid that this Item object has left.

note:

Server side only.

Public Static Attributes

bool isRenderable 

Disables rendering of all instances of this type.

bool isSelectable 

Disables selection of all instances of this type.

int maxWarpTicks 

When a warp needs to occur due to the client being too far off from the server, this is the maximum number of ticks we'll allow the client to warp to catch up.

float minWarpTicks 

Fraction of tick at which instant warp occures on the client.

Public Functions

getLastStickyNormal()

Get the normal of the surface on which the object is stuck.

return:

Returns The XYZ normal from where this Item is stuck.

// Acquire the position where this Item is currently stuck
%stuckPosition = %item.getLastStickPos();

note:

Server side only.

getLastStickyPos()

Get the position on the surface on which this Item is stuck.

return:

Returns The XYZ position of where this Item is stuck.

// Acquire the position where this Item is currently stuck
%stuckPosition = %item.getLastStickPos();

note:

Server side only.

isAtRest()

Is the object at rest (ie, no longer moving)?

return:

True if the object is at rest, false if it is not.

// Query the item on if it is or is not at rest.
%isAtRest = %item.isAtRest();

isRotating()

Is the object still rotating?

return:

True if the object is still rotating, false if it is not.

// Query the item on if it is or is not rotating.
%isRotating = %itemData.isRotating();

see:

isStatic()

Is the object static (ie, non-movable)?

return:

True if the object is static, false if it is not.

// Query the item on if it is or is not static.
%isStatic = %itemData.isStatic();

see:

setCollisionTimeout(int ignoreColObj)

Temporarily disable collisions against a specific ShapeBase object.

This is useful to prevent a player from immediately picking up an Item they have just thrown. Only one object may be on the timeout list at a time. The timeout is defined as 15 ticks.

Parameters:

objectID

ShapeBase object ID to disable collisions against.

return:

Returns true if the ShapeBase object requested could be found, false if it could not.

// Set the ShapeBase Object ID to disable collisions against
%ignoreColObj = %player.getID();

// Inform this Item object to ignore collisions temproarily against the %ignoreColObj.
%item.setCollisionTimeout(%ignoreColObj);