Category: Objects
/ Status
Since engine version: 5.1 OC
SetMass
Description
Changes the mass of the object. The mass is initialized with DefCore.txt/[DefCore]/Mass. The actual weight is the deadweight plus the weight of the contained objects.
Syntax
void SetMass(int mass);
Parameter
- mass:
- New mass of the object
Example
private func GetOwnMass(object clonk)
{
var mass=clonk->GetMass(), i, obj;
while(obj = clonk->Contents(i++)) mass -= obj->GetMass();
return mass;
}
protected func ControlUse(object clonk)
{
clonk->SetMass(GetOwnMass(clonk) + 100);
clonk->Sound("ClonkMunch");
RemoveObject();
return true;
}
Script for a cookie: when eating this cookie the mass of the clonk will increase.
See also: GetMass


