forked from Mirrors/openclonk
Decrease physical abilities of the clonk when carrying heavily
parent
26d8ac2b00
commit
9b7d9449bf
|
@ -514,6 +514,21 @@ func StartStand()
|
|||
During scaling the clonk adjusts his rotation to the ground.. When he is a the top, he uses a extra animation. When the wall doesn't have a platform for the feet he just scales using his arms.
|
||||
--*/
|
||||
|
||||
/* Renders the clonk unable to scale */
|
||||
func DisableScale()
|
||||
{
|
||||
if (!this.ActMap.Scale) return;
|
||||
this.Scale = this.ActMap.Scale;
|
||||
this.ActMap.Scale = nil;
|
||||
}
|
||||
/* Reenabled hangling */
|
||||
func EnableScale()
|
||||
{
|
||||
if (!this.Scale) return;
|
||||
this.ActMap.Scale = this.Scale;
|
||||
this.Scale = nil;
|
||||
}
|
||||
|
||||
func StartScale()
|
||||
{
|
||||
if(!GetEffect("IntScale", this))
|
||||
|
@ -747,11 +762,24 @@ func FxFallTimer(object target, effect, int timer)
|
|||
Adjust the speed sinoidal. Plays two different stand animations according to the position the clonk stops.
|
||||
--*/
|
||||
|
||||
/* Renders the clonk unable to hangle */
|
||||
func DisableHangle()
|
||||
{
|
||||
if (!this.ActMap.Hangle) return;
|
||||
this.Hangle = this.ActMap.Hangle;
|
||||
this.ActMap.Hangle = nil;
|
||||
}
|
||||
/* Reenabled hangling */
|
||||
func EnableHangle()
|
||||
{
|
||||
if (!this.Hangle) return;
|
||||
this.ActMap.Hangle = this.Hangle;
|
||||
this.Hangle = nil;
|
||||
}
|
||||
|
||||
/* Replaces the named action by an instance with a different speed */
|
||||
func PushActionSpeed(string action, int n)
|
||||
{
|
||||
if (ActMap == this.Prototype.ActMap)
|
||||
ActMap = { Prototype = this.Prototype.ActMap };
|
||||
ActMap[action] = { Prototype = ActMap[action], Speed = n };
|
||||
if (this.Action == ActMap[action].Prototype)
|
||||
this.Action = ActMap[action];
|
||||
|
|
|
@ -32,6 +32,10 @@ protected func Construction()
|
|||
{
|
||||
_inherited(...);
|
||||
|
||||
// Modifiable ActMap
|
||||
if (ActMap == this.Prototype.ActMap)
|
||||
ActMap = { Prototype = this.Prototype.ActMap };
|
||||
|
||||
SetAction("Walk");
|
||||
SetDir(Random(2));
|
||||
// Broadcast for rules
|
||||
|
|
|
@ -42,7 +42,7 @@ public func Grabbed(object clonk, bool grab)
|
|||
|
||||
liftheavy_carrier = clonk;
|
||||
|
||||
AddEffect("IntLiftHeavy", liftheavy_carrier, 1, 1, this);
|
||||
//AddEffect("IntLiftHeavy", liftheavy_carrier, 1, 1, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,6 +169,18 @@ func IsCarryingHeavy(object clonk)
|
|||
return false;
|
||||
}
|
||||
|
||||
func FxIntCarryHeavyStart(object clonk, proplist effect, int temp)
|
||||
{
|
||||
if (temp) return;
|
||||
clonk->DisableScale();
|
||||
clonk->DisableHangle();
|
||||
var throw = clonk.ThrowSpeed;
|
||||
if (throw < 150) return; // I know this may be bad in some situations and result in normal throwing speed
|
||||
// If so, see it as an easter egg exploit!
|
||||
clonk.ThrowSpeed -= 150;
|
||||
effect.throw = throw - clonk.ThrowSpeed;
|
||||
}
|
||||
|
||||
func FxIntCarryHeavyTimer(object clonk, proplist effect, int timer)
|
||||
{
|
||||
//Is there more than one carry-heavy object in the clonk? Then exit one
|
||||
|
@ -203,11 +215,19 @@ func FxIntCarryHeavyTimer(object clonk, proplist effect, int timer)
|
|||
if(Contained() != clonk) return -1;
|
||||
}
|
||||
|
||||
func FxIntCarryHeavyStop(object clonk, proplist effect, int reason, bool temp)
|
||||
{
|
||||
if (temp) return;
|
||||
clonk->EnableScale();
|
||||
clonk->EnableHangle();
|
||||
clonk.ThrowSpeed += effect.throw;
|
||||
}
|
||||
|
||||
//In case the object is added via script, add the carry heavy effect
|
||||
func Entrance(object container)
|
||||
{
|
||||
if(container->~IsClonk() && !IsCarryingHeavy())
|
||||
AddEffect("IntCarryHeavy", container, 1, 1, this);
|
||||
AddEffect("IntLiftHeavy", container, 1, 1, this);
|
||||
}
|
||||
|
||||
func RejectCollect(id collectid, object collect)
|
||||
|
|
Loading…
Reference in New Issue