diff --git a/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Cannon.c4d/ActMap.txt b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Cannon.c4d/ActMap.txt new file mode 100644 index 00000000..9af34ef9 --- /dev/null +++ b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Cannon.c4d/ActMap.txt @@ -0,0 +1,5 @@ +[Action] +Name=Turn +Procedure=ATTACH +Length=20 +Facet=0,0,106,53 diff --git a/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Cannon.c4d/DefCore.txt b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Cannon.c4d/DefCore.txt new file mode 100644 index 00000000..525f00d6 --- /dev/null +++ b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Cannon.c4d/DefCore.txt @@ -0,0 +1,11 @@ +[DefCore] +id=FRCN +Name=Cannon +Category=C4D_Vehicle +Offset=-53,-53 +Width=106 +Height=53 +Vertices=1 +VertexX=0 +VertexY=0 +Grab=2 diff --git a/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Cannon.c4d/Graphics.png b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Cannon.c4d/Graphics.png new file mode 100644 index 00000000..550d1c64 Binary files /dev/null and b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Cannon.c4d/Graphics.png differ diff --git a/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Cannon.c4d/Script.c b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Cannon.c4d/Script.c new file mode 100644 index 00000000..947815ea --- /dev/null +++ b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Cannon.c4d/Script.c @@ -0,0 +1,90 @@ +/* Frigate-Cannon */ +#strict 2 + +local phases; + +protected func Initialize() { + SetAction("Turn"); + phases = GetActMapVal("Length", "Turn"); +} + +private func TurnLeft() { + SetPhase(Max(GetPhase() - 1, 0)); +} + +private func TurnRight() { + SetPhase(Min(GetPhase() + 1, phases - 1)); +} + +protected func ControlLeft(object clonk) { + if(Hostile(GetOwner(), clonk->GetOwner())) + return; + TurnLeft(); + return true; +} + +protected func ControlRight(object clonk) { + if(Hostile(GetOwner(), clonk->GetOwner())) + return; + TurnRight(); + return true; +} + +protected func ControlThrow(object clonk) { + if(Hostile(GetOwner(), clonk->GetOwner())) + return; + Shoot(); + return true; +} + +private func GetAngle() { + var angles = [75, 71, 70, 64, 37, 32, 18, 8, 4, 1]; + var phase = GetPhase(); + var f = -1; + if(phase >= phases / 2) { + phase = phases - phase - 1; + f = 1; + } + return f*angles[phase]; +} + +private func GetAmmo() { + return CreateContents(FLNT); +} + +private func GetPower() { return 20; } +private func GetBarrelLength() { return 25; } +private func GetCooldown() { return 50; } +private func CannonSound() { return "Blast3"; } + +local cooldown; +private func StartCooldown() { + cooldown = true; + ScheduleCall(this, "FinishCooldown", GetCooldown()); +} + +protected func FinishCooldown() { + cooldown = false; +} + +private func Shoot() { + if(cooldown) + return; + var ammo = GetAmmo(); + if(!ammo) + return; + var angle = GetAngle(); + // Randomize the angle a little bit. + angle += RandomX(-5, 5); + var power = GetPower(); + + var x = Sin(angle, GetBarrelLength()), + y = -Cos(angle, GetBarrelLength()), + xdir = Sin(angle, power), + ydir = -Cos(angle, power); + + Exit(ammo, x, y, 0, xdir, ydir); + StartCooldown(); + Sound(CannonSound()); + return ammo; +} diff --git a/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/DescDE.txt b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/DescDE.txt index 81a960bd..61a3a63d 100644 --- a/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/DescDE.txt +++ b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/DescDE.txt @@ -2,4 +2,4 @@ Dieses Schiff muss erobert und gehalten werden. Erobern erfolgt automatisch, sobald Clonks auf dem Deck stehen. Mehrere Teammitglieder beschleunigen die Eroberung. Gegner auf der Plattform blockieren wiederum den Eroberungsvorgang. -Die Fregatte kann theoretisch beliebig oft erobert werden. Dabei setzt jede erfolgreiche Eroberung einen Countdown in Gang, der, wenn er abgelaufen ist, das Spiel für das jeweilige Team entscheidet. +Die Fregatte kann theoretisch beliebig oft erobert werden. Dabei setzt jede erfolgreiche Eroberung einen Countdown in Gang, der, wenn er abgelaufen ist, das Spiel für das jeweilige Team entscheidet. Außerdem können bei Eroberung die Waffen an Deck bedient werden. diff --git a/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/FLAK.c4d/ActMap.txt b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/FLAK.c4d/ActMap.txt new file mode 100644 index 00000000..0aac093b --- /dev/null +++ b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/FLAK.c4d/ActMap.txt @@ -0,0 +1,5 @@ +[Action] +Name=Turn +Procedure=ATTACH +Length=20 +Facet=0,0,46,29 diff --git a/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/FLAK.c4d/DefCore.txt b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/FLAK.c4d/DefCore.txt new file mode 100644 index 00000000..3a7922b0 --- /dev/null +++ b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/FLAK.c4d/DefCore.txt @@ -0,0 +1,11 @@ +[DefCore] +id=FRFK +Name=Flak +Category=C4D_Vehicle +Offset=-23,-29 +Width=46 +Height=29 +Vertices=1 +VertexX=0 +VertexY=0 +Grab=2 diff --git a/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/FLAK.c4d/Graphics.png b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/FLAK.c4d/Graphics.png new file mode 100644 index 00000000..cd5d5752 Binary files /dev/null and b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/FLAK.c4d/Graphics.png differ diff --git a/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/FLAK.c4d/Script.c b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/FLAK.c4d/Script.c new file mode 100644 index 00000000..85799fed --- /dev/null +++ b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/FLAK.c4d/Script.c @@ -0,0 +1,28 @@ +#strict 2 + +#include FRCN + +private func GetBarrelLength() { return 10; } +private func GetCooldown() { return 25; } +private func CannonSound() { return "Arrow"; } + +private func GetAmmo() { + return CreateContents(ADB1); +} + +/* Fixes the shooting angle. */ +private func GetPhase(bool real) { + if(real) + return inherited(); + else + return phases - 1 - inherited(); +} + +private func TurnLeft() { + SetPhase(Min(GetPhase(true) + 1, phases - 1)); +} + +private func TurnRight() { + SetPhase(Max(GetPhase(true) - 1, 0)); +} + diff --git a/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Graphics.png b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Graphics.png index 1dff9f58..3501bcba 100644 Binary files a/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Graphics.png and b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Graphics.png differ diff --git a/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Script.c b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Script.c index 6d8c5073..1659f85f 100644 --- a/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Script.c +++ b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Script.c @@ -6,6 +6,7 @@ #include L_CP local flag; +local cannon, flak; local t; public func Initialize() { @@ -13,10 +14,18 @@ public func Initialize() { flag = CreateObject(FLAG, 0, 0, NO_OWNER); flag->SetAction("FlyBase", this); + + cannon = CreateObject(FRCN, -166+53, 24, NO_OWNER); + cannon->AttachTo(this); + flak = CreateObject(FRFK, 77+23, 15, NO_OWNER); + flak->AttachTo(this); } private func Captured() { - flag->SetOwner(GetOwner()); + var o = GetOwner(); + for(var obj in [flag, cannon, flak]) + obj->SetOwner(o); + return inherited(...); } @@ -37,4 +46,4 @@ public func Pendle() { +fcos, +fsin, (1000-fcos) - fsin, -fsin, +fcos, (1000-fcos) + fsin ); -} \ No newline at end of file +} diff --git a/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/info.txt b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/info.txt new file mode 100644 index 00000000..f80e975d --- /dev/null +++ b/Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/info.txt @@ -0,0 +1,3 @@ +Cannon Coordinates: 0,0,106,53 + +FLAK Coordinates: 0,0,46,29