trees shake a little when hit by an axe

stable-6.1
Maikel de Vries 2015-03-16 21:19:56 +01:00
parent e7d66139eb
commit b94893f17a
2 changed files with 49 additions and 2 deletions

View File

@ -59,6 +59,32 @@ public func ChopDown()
_inherited(...);
}
protected func Damage(int change, int cause)
{
_inherited(change, cause, ...);
if (cause == FX_Call_DmgChop && IsStanding())
ShakeTree();
return;
}
private func ShakeTree()
{
var effect = AddEffect("IntShakeTree", this, 100, 1, this);
effect.current_trans = this.MeshTransformation;
return;
}
protected func FxIntShakeTreeTimer(object target, proplist effect, int time)
{
if (time > 24)
return FX_Execute_Kill;
var angle = Sin(time * 45, 2);
var r = Trans_Rotate(angle, 0, 0, 1);
target.MeshTransformation = Trans_Mul(r, effect.current_trans);
return FX_OK;
}
/*-- Properties --*/
protected func Definition(def)

View File

@ -38,9 +38,9 @@ public func ChopDown()
_inherited(...);
}
func Damage()
protected func Damage(int change, int cause)
{
_inherited();
_inherited(change, cause, ...);
if (GetDamage() > MaxDamage() && OnFire())
{
@ -58,6 +58,27 @@ func Damage()
RemoveObject();
return;
}
if (cause == FX_Call_DmgChop && IsStanding())
ShakeTree();
return;
}
private func ShakeTree()
{
var effect = AddEffect("IntShakeTree", this, 100, 1, this);
effect.current_trans = this.MeshTransformation;
return;
}
protected func FxIntShakeTreeTimer(object target, proplist effect, int time)
{
if (time > 24)
return FX_Execute_Kill;
var angle = Sin(time * 45, 2);
var r = Trans_Rotate(angle, 0, 0, 1);
target.MeshTransformation = Trans_Mul(r, effect.current_trans);
return FX_OK;
}
/*-- Properties --*/