forked from Mirrors/openclonk
Fixed clonk's physical not being reset sometimes.
parent
8fa4929680
commit
58c2c45751
|
@ -6,6 +6,7 @@
|
|||
--*/
|
||||
|
||||
local liftheavy_carrier;
|
||||
local liftheavy_effect;
|
||||
|
||||
public func IsCarryHeavy() { return true; }
|
||||
public func IsInvInteract() { return true; }
|
||||
|
@ -114,7 +115,7 @@ func FxIntLiftHeavyTimer(object clonk, proplist effect, int timer)
|
|||
//When the clonk has finished lifting, remove movement-restrictions and add carry effect
|
||||
if(timer >= lift_heavy_time)
|
||||
{
|
||||
AddEffect("IntCarryHeavy", clonk, 1, 1, this);
|
||||
liftheavy_effect = AddEffect("IntCarryHeavy", clonk, 1, 1, this);
|
||||
// don't exit the object
|
||||
effect.doExit = false;
|
||||
return -1;
|
||||
|
@ -156,6 +157,7 @@ func FxIntCarryHeavyStart(object clonk, proplist effect, int temp)
|
|||
|
||||
func FxIntCarryHeavyTimer(object clonk, proplist effect, int timer)
|
||||
{
|
||||
if (!this) return -1;
|
||||
//Delete this effect if not contained in the clonk anymore
|
||||
if(Contained() != clonk) return -1;
|
||||
}
|
||||
|
@ -165,8 +167,9 @@ func FxIntCarryHeavyStop(object clonk, proplist effect, int reason, bool temp)
|
|||
if (temp) return;
|
||||
clonk->EnableScale();
|
||||
clonk->EnableHangle();
|
||||
Log("hey");
|
||||
clonk.ThrowSpeed += effect.throw;
|
||||
effect.throw = 0; // Failsafe
|
||||
liftheavy_effect = nil;
|
||||
}
|
||||
|
||||
// ------------------
|
||||
|
@ -266,7 +269,7 @@ func IsCarryingHeavy(object clonk)
|
|||
return false;
|
||||
}
|
||||
|
||||
protected func Entrance(object obj)
|
||||
func Entrance(object obj)
|
||||
{
|
||||
// tell the carrier to carryheavy if it got moved into it by script
|
||||
if(!liftheavy_carrier)
|
||||
|
@ -280,17 +283,22 @@ protected func Entrance(object obj)
|
|||
}
|
||||
}
|
||||
|
||||
protected func Departure(object obj)
|
||||
func Departure(object obj)
|
||||
{
|
||||
if(!liftheavy_carrier)
|
||||
return;
|
||||
|
||||
if (GetEffect("IntCarryHeavy", obj)) RemoveEffect("IntCarryHeavy", obj);
|
||||
liftheavy_carrier = nil;
|
||||
}
|
||||
|
||||
func Destruction()
|
||||
{
|
||||
if (liftheavy_effect) RemoveEffect(nil,nil, liftheavy_effect);
|
||||
}
|
||||
|
||||
// Cannot pickup other carryheavy objects (is that really what you intended, Ringwaul?)
|
||||
protected func RejectCollect(id collectid, object collect)
|
||||
func RejectCollect(id collectid, object collect)
|
||||
{
|
||||
if(collect->~IsCarryHeavy()) return true;
|
||||
else
|
||||
|
|
|
@ -654,7 +654,7 @@ public func RequestObject(id obj_id, int amount)
|
|||
func Collection2(object obj)
|
||||
{
|
||||
if (obj->~IsChunk())
|
||||
Schedule(obj, "Split2Components()", 1);
|
||||
obj->Split2Components();
|
||||
// 1 frame delay, so the chunk can trigger the appriopriate carry heavy ending calls
|
||||
// i.e. FxIntCarryHeavyStop
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue