From 9b7d9449bfb87473f1f6286d3654fea9abc3401c Mon Sep 17 00:00:00 2001 From: Felix Wagner Date: Fri, 30 Dec 2011 15:53:10 +0000 Subject: [PATCH] Decrease physical abilities of the clonk when carrying heavily --- .../Clonk.ocd/Animations.ocd/Script.c | 32 +++++++++++++++++-- planet/Objects.ocd/Clonk.ocd/Script.c | 4 +++ .../Libraries.ocd/CarryHeavy.ocd/Script.c | 24 ++++++++++++-- 3 files changed, 56 insertions(+), 4 deletions(-) diff --git a/planet/Objects.ocd/Clonk.ocd/Animations.ocd/Script.c b/planet/Objects.ocd/Clonk.ocd/Animations.ocd/Script.c index aeb06ccbb..79bf4e343 100644 --- a/planet/Objects.ocd/Clonk.ocd/Animations.ocd/Script.c +++ b/planet/Objects.ocd/Clonk.ocd/Animations.ocd/Script.c @@ -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]; diff --git a/planet/Objects.ocd/Clonk.ocd/Script.c b/planet/Objects.ocd/Clonk.ocd/Script.c index fb50b64e0..c3ec37ced 100644 --- a/planet/Objects.ocd/Clonk.ocd/Script.c +++ b/planet/Objects.ocd/Clonk.ocd/Script.c @@ -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 diff --git a/planet/Objects.ocd/Libraries.ocd/CarryHeavy.ocd/Script.c b/planet/Objects.ocd/Libraries.ocd/CarryHeavy.ocd/Script.c index 1b18e6c56..4f8e9685c 100644 --- a/planet/Objects.ocd/Libraries.ocd/CarryHeavy.ocd/Script.c +++ b/planet/Objects.ocd/Libraries.ocd/CarryHeavy.ocd/Script.c @@ -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)