forked from Mirrors/openclonk
Changed CTF carry mechanism.
parent
21e26b804d
commit
94c9a9642a
|
@ -1,11 +1,11 @@
|
|||
[DefCore]
|
||||
id=Goal_Flag
|
||||
Version=4,10,0,0
|
||||
Category=C4D_Object
|
||||
Width=30
|
||||
Height=40
|
||||
Offset=-15,-20
|
||||
Category=C4D_Vehicle
|
||||
Width=16
|
||||
Height=26
|
||||
Offset=-5,-13
|
||||
Vertices=5
|
||||
VertexX=-15,-15,-15,15,15
|
||||
VertexY=20,-5,-20,-20,-5
|
||||
VertexFriction=100,100,100,100,100
|
||||
VertexX=-5,-6,-7,7
|
||||
VertexY=13,0,-13,-6
|
||||
VertexFriction=100,100,100,50
|
||||
|
|
|
@ -37,6 +37,9 @@ public func FindTeam(int find_team)
|
|||
// Flag can be picked up by interaction.
|
||||
public func IsInteractable(object clonk)
|
||||
{
|
||||
if (GetAction() == "Attach")
|
||||
if (GetActionTarget() != clonk)
|
||||
return false;
|
||||
if (clonk->GetProcedure() != "WALK")
|
||||
return false;
|
||||
var controller = clonk->GetController();
|
||||
|
@ -55,7 +58,8 @@ public func GetInteractionMetaInfo(object clonk)
|
|||
var ctrl_team = GetPlayerTeam(controller);
|
||||
if (team == ctrl_team)
|
||||
return { Description = "$MsgBeamFlag$" };
|
||||
else
|
||||
if (GetAction() == "Attach" && GetActionTarget() == clonk)
|
||||
return { Description = "$MsgDropFlag$" };
|
||||
return { Description = "$MsgGrabFlag$" };
|
||||
}
|
||||
|
||||
|
@ -63,14 +67,24 @@ public func Interact(object clonk)
|
|||
{
|
||||
var controller = clonk->GetController();
|
||||
var ctrl_team = GetPlayerTeam(controller);
|
||||
// Picked up by owning team, beam flag to base.
|
||||
if (team == ctrl_team)
|
||||
BeamFlag(true);
|
||||
else
|
||||
{
|
||||
Enter(clonk); // TODO: Checks here.
|
||||
BeamFlag(true);
|
||||
return true;
|
||||
}
|
||||
// Carrying clonk, drop flag.
|
||||
if (GetAction() == "Attach" && GetActionTarget() == clonk)
|
||||
{
|
||||
SetAction("Idle");
|
||||
RemoveEffect("FlagCarried", clonk);
|
||||
Log("$MsgFlagDropped$", GetTeamName(ctrl_team), GetTeamName(team));
|
||||
return true;
|
||||
}
|
||||
// Fiendly team, grab flag.
|
||||
SetAction("Attach", clonk);
|
||||
Log("$MsgFlagStolen$", GetTeamName(ctrl_team), GetTeamName(team));
|
||||
AddEffect("FlagCarried", clonk, 100, 5, this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -82,14 +96,20 @@ protected func Initialize()
|
|||
|
||||
public func HasNoFadeOut() { return true; }
|
||||
|
||||
public func GetCarryMode() { return CARRY_Back; }
|
||||
public func GetCarryTransform()
|
||||
protected func FxFlagCarriedStart(object target, int num, int temp)
|
||||
{
|
||||
return Trans_Mul(Trans_Translate(0,-17000,0),Trans_Rotate(90,0,1,0));
|
||||
if (temp == 0)
|
||||
{
|
||||
var trans = Trans_Mul(Trans_Translate(0, -17000, 0), Trans_Rotate(-90, 0, 1, 0));
|
||||
EffectVar(0, target, num) = target->AttachMesh(this, "pos_back1", "main", trans);
|
||||
this.Visibility = VIS_None;
|
||||
ReducePhysicals(target);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Checks whether the carrier has reached its base.
|
||||
protected func FxFlagCarriedTimer(object target)
|
||||
protected func FxFlagCarriedTimer(object target, int num)
|
||||
{
|
||||
var controller = target->GetController();
|
||||
var ctrl_team = GetPlayerTeam(controller);
|
||||
|
@ -105,12 +125,38 @@ protected func FxFlagCarriedTimer(object target)
|
|||
return 1;
|
||||
}
|
||||
|
||||
protected func Departure()
|
||||
protected func FxFlagCarriedStop(object target, int num, int reason, bool temp)
|
||||
{
|
||||
RemoveEffect("FlagCarried");
|
||||
if (temp)
|
||||
return 1;
|
||||
this.Visibility = VIS_All;
|
||||
if (target)
|
||||
{
|
||||
target->DetachMesh(EffectVar(0, target, num));
|
||||
ResetPhysicals(target);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Reduces physicals by 80%.
|
||||
private func ReducePhysicals(object clonk)
|
||||
{
|
||||
var phys = ["Walk", "Jump", "Scale", "Hangle", "Swim"];
|
||||
for (var i = 0; i < GetLength(phys); i++)
|
||||
clonk->SetPhysical(phys[i], (8 * clonk->GetPhysical(phys[i], PHYS_Current)) / 10, PHYS_StackTemporary);
|
||||
return;
|
||||
}
|
||||
|
||||
// Resets physicals.
|
||||
private func ResetPhysicals(object clonk)
|
||||
{
|
||||
var phys = ["Walk", "Jump", "Scale", "Hangle", "Swim"];
|
||||
for (var i = 0; i < GetLength(phys); i++)
|
||||
clonk->ResetPhysical(phys[i]);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// Create a new flag on destruction.
|
||||
protected func Destruction()
|
||||
{
|
||||
|
@ -137,12 +183,12 @@ private func BeamFlag(bool msg)
|
|||
return;
|
||||
if (msg)
|
||||
Log("$MsgFlagBeamed$", GetTeamName(team));
|
||||
Exit();
|
||||
SetAction("Idle");
|
||||
var base = FindObject(Find_ID(Goal_FlagBase), Find_Func("FindTeam", team));
|
||||
if (base)
|
||||
{
|
||||
if(ObjectDistance(base) > 30)
|
||||
SetPosition(base->GetX(), base->GetY() - 20);
|
||||
SetPosition(base->GetX(), base->GetY() - 13);
|
||||
}
|
||||
else
|
||||
RemoveObject();
|
||||
|
@ -150,8 +196,20 @@ private func BeamFlag(bool msg)
|
|||
}
|
||||
|
||||
local Name = "$Name$";
|
||||
local ActMap = {
|
||||
Attach = {
|
||||
Prototype = Action,
|
||||
Name = "Attach",
|
||||
Procedure = DFA_ATTACH,
|
||||
Length = 1,
|
||||
Delay = 0,
|
||||
NextAction = "Attach",
|
||||
Animation = "Wave",
|
||||
},
|
||||
};
|
||||
|
||||
protected func Definition(def)
|
||||
{
|
||||
SetProperty("MeshTransformation", Trans_Mul(Trans_Translate(-130000,-3000,0), Trans_Rotate(60,0,1,0)), def);
|
||||
SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(60, 0, 1, 0), Trans_Scale(1200), Trans_Translate(-4000,6500,-3000)), def);
|
||||
SetProperty("MeshTransformation", Trans_Mul(Trans_Translate(-79000, 1000, 0), Trans_Rotate(60, 0, 1, 0)), def);
|
||||
SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(60, 0, 1, 0), Trans_Scale(1200), Trans_Translate(-4000, 6500, -3000)), def);
|
||||
}
|
||||
|
|
|
@ -2,8 +2,10 @@ Name=Flagge
|
|||
|
||||
MsgBeamFlag=Teleportiere die Flagge in deine Basis.
|
||||
MsgGrabFlag=Schnapp dir die Flagge und bring sie in deine Basis.
|
||||
MsgDropFlag=Leg die Flagge hier ab.
|
||||
|
||||
MsgFlagStolen=%s hat die Flagge von %s geklaut.
|
||||
MsgFlagDropped=%s hat die Flagge von %s fallen gelassen.
|
||||
MsgFlagBeamed=%s hat die Flagge in ihre Basis zurueckgebeamt.
|
||||
MsgFlagCaptured=%s hat erfolgreich die Flagge geklaut, und damit fuer sein Team einen Punkt gemacht.
|
||||
MsgFlagRestored=Die Flagge von %s wurde zurueckgesetzt.
|
||||
|
|
|
@ -2,8 +2,10 @@ Name=Flag
|
|||
|
||||
MsgBeamFlag=Beam the flag to your base.
|
||||
MsgGrabFlag=Grab the flag and carry it to your base.
|
||||
MsgDropFlag=Drop the flag here.
|
||||
|
||||
MsgFlagStolen=%s stole the flag of %s.
|
||||
MsgFlagDropped=%s dropped the flag of %s.
|
||||
MsgFlagBeamed=%s beamed the flag to their base.
|
||||
MsgFlagCaptured=%s successfully captured a flag, and scored a point.
|
||||
MsgFlagRestored=The flag of %s got restored.
|
|
@ -31,6 +31,7 @@ public func SetFlagBase(int team, int x, int y)
|
|||
var base = CreateObject(Goal_FlagBase, x, y, NO_OWNER);
|
||||
base->SetTeam(team);
|
||||
var flag = CreateObject(Goal_Flag, x, y, NO_OWNER);
|
||||
flag->SetPosition(x, y - 13);
|
||||
flag->SetTeam(team);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue