Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fregattenwaffen #67

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Cannon.c4d/ActMap.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[Action]
Name=Turn
Procedure=ATTACH
Length=20
Facet=0,0,106,53
11 changes: 11 additions & 0 deletions Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Cannon.c4d/DefCore.txt
Original file line number Diff line number Diff line change
@@ -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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 90 additions & 0 deletions Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Cannon.c4d/Script.c
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 1 addition & 1 deletion Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/DescDE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
5 changes: 5 additions & 0 deletions Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/FLAK.c4d/ActMap.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[Action]
Name=Turn
Procedure=ATTACH
Length=20
Facet=0,0,46,29
11 changes: 11 additions & 0 deletions Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/FLAK.c4d/DefCore.txt
Original file line number Diff line number Diff line change
@@ -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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/FLAK.c4d/Script.c
Original file line number Diff line number Diff line change
@@ -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));
}

Binary file modified Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Graphics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 11 additions & 2 deletions Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/Script.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,26 @@
#include L_CP

local flag;
local cannon, flak;
local t;

public func Initialize() {
SetAction("MakeSound");

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(...);
}

Expand All @@ -37,4 +46,4 @@ public func Pendle() {
+fcos, +fsin, (1000-fcos) - fsin,
-fsin, +fcos, (1000-fcos) + fsin
);
}
}
3 changes: 3 additions & 0 deletions Clinfinity.c4d/Vehicles.c4d/Frigate.c4d/info.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Cannon Coordinates: 0,0,106,53

FLAK Coordinates: 0,0,46,29