forked from Mirrors/openclonk
Make LiftTower use the engine rope
parent
6bb893f387
commit
f58b565604
|
@ -28,7 +28,8 @@ public func ConnectTo(object connect)
|
|||
/* rope->BreakRope(true);
|
||||
SetRope(true);
|
||||
rope->Connect(tower, connect);*/
|
||||
rope->Reconnect(connect);
|
||||
//rope->Reconnect(connect);
|
||||
rope->SetFront(connect);
|
||||
AddEffect("Connecting", this, 1, 1, this, nil, connect);
|
||||
return true;
|
||||
}
|
||||
|
@ -61,7 +62,7 @@ private func FxConnectingTimer(object target, effect)
|
|||
if (!effect.connection)
|
||||
{
|
||||
Unhook();
|
||||
rope->BreakRope(true);
|
||||
rope->Remove(); //BreakRope(true);
|
||||
SetRope();
|
||||
return -1;
|
||||
}
|
||||
|
@ -89,7 +90,7 @@ public func Interact(object clonk)
|
|||
{
|
||||
RemoveEffect("Connecting", this);
|
||||
Unhook();
|
||||
rope->BreakRope(true);
|
||||
//rope->BreakRope(true);
|
||||
SetRope();
|
||||
return true;
|
||||
}
|
||||
|
@ -115,26 +116,34 @@ func Initialize()
|
|||
|
||||
func SetRope(bool no_connect)
|
||||
{
|
||||
rope = CreateObject(LiftTower_Rope,0,0,NO_OWNER);
|
||||
rope = CreateRope(this, tower, 5, LiftTower_Rope);
|
||||
if(rope)
|
||||
{
|
||||
rope->SetBackFixed(true);
|
||||
rope->SetBackAutoSegmentation(250);
|
||||
tower->SetRope(rope);
|
||||
}
|
||||
return rope;
|
||||
/*rope = CreateObject(LiftTower_Rope,0,0,NO_OWNER);
|
||||
if (!no_connect) rope->Connect(tower, this);
|
||||
tower->SetRope(rope);
|
||||
return rope;
|
||||
return rope;*/
|
||||
}
|
||||
|
||||
public func Destruction()
|
||||
{
|
||||
if(rope)
|
||||
rope->HookRemoved();
|
||||
rope->Remove();
|
||||
}
|
||||
|
||||
protected func Rotation()
|
||||
{
|
||||
if (!rope) return;
|
||||
SetR(rope->GetHookAngle());
|
||||
//SetR(rope->GetHookAngle()); // TODO: Hook rotation by last segment
|
||||
}
|
||||
|
||||
public func NoLiftTowerConnection() { return true; }
|
||||
|
||||
local Name = "$Name$";
|
||||
local Description = "$Description$";
|
||||
local Collectible = 1;
|
||||
local Collectible = 1;
|
||||
|
|
|
@ -4,5 +4,5 @@ Version=5,2,0,1
|
|||
Category=C4D_StaticBack
|
||||
Vertices=2
|
||||
Width=2
|
||||
Height=12
|
||||
Offset=-1,-6
|
||||
Height=11
|
||||
Offset=-1,-5
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.5 KiB |
|
@ -20,7 +20,7 @@ protected func Initialize()
|
|||
hook_pos = CreateArray();
|
||||
anim_no = PlayAnimation("Turn", 10, Anim_Const(0), Anim_Const(1000));
|
||||
stopped = true;
|
||||
AddEffect("SpinWheel", 5);
|
||||
AddTimer("SpinWheel", 5);
|
||||
}
|
||||
|
||||
/* Rope */
|
||||
|
@ -69,7 +69,7 @@ func Interact(object clonk)
|
|||
return false;
|
||||
}
|
||||
|
||||
func SetRope(object rope_to_set)
|
||||
func SetRope(proplist rope_to_set)
|
||||
{
|
||||
rope = rope_to_set;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ func SetRope(object rope_to_set)
|
|||
|
||||
public func ControlUp(object clonk)
|
||||
{
|
||||
return DrawIn();
|
||||
return this->DrawIn();
|
||||
}
|
||||
public func ControlStop(object clonk)
|
||||
{
|
||||
|
@ -92,10 +92,14 @@ public func DrawIn()
|
|||
if (hook->Contained() == this) return false;
|
||||
if (ObjectDistance(hook) < LIFTTOWER_HOOK_LOOSEDIST) return false;
|
||||
if (GetEffect("DrawIn", this)) return false;
|
||||
rope->ConnectPull();
|
||||
return AddEffect("DrawIn", this, 1, 1, this);
|
||||
}
|
||||
|
||||
private func FxDrawInStart(effect)
|
||||
{
|
||||
rope->PullBack(40);
|
||||
}
|
||||
|
||||
private func FxDrawInTimer(effect)
|
||||
{
|
||||
if (!rope) return -1;
|
||||
|
@ -104,15 +108,17 @@ private func FxDrawInTimer(effect)
|
|||
OnRopeBreak();
|
||||
return -1;
|
||||
}
|
||||
rope->DoLength(-1);
|
||||
//rope->DoLength(-1);
|
||||
if (ObjectDistance(hook) < LIFTTOWER_HOOK_LOOSEDIST) return -1;
|
||||
}
|
||||
|
||||
private func FxDrawInStop(object target, effect, int temp)
|
||||
{
|
||||
rope->PullBack(0);
|
||||
|
||||
if (temp) return;
|
||||
if (!rope) return;
|
||||
rope->ConnectLoose();
|
||||
//rope->ConnectLoose();
|
||||
}
|
||||
|
||||
/* Animation */
|
||||
|
@ -170,4 +176,4 @@ func Definition(def) {
|
|||
local Name = "$Name$";
|
||||
local Description = "$Description$";
|
||||
local Touchable = 1;
|
||||
local BlastIncinerate = 100;
|
||||
local BlastIncinerate = 100;
|
||||
|
|
Loading…
Reference in New Issue