C4Script style guidelines are there for a reason

Some might take a look here http://wiki.openclonk.org/w/C4Script_Style_Guidelines
Maikel de Vries 2010-10-28 23:42:38 +02:00
parent 3347f2ca5d
commit 281abde3bb
11 changed files with 191 additions and 196 deletions

View File

@ -7,24 +7,27 @@
protected func Initialize()
{
// Create parkour goal & checkpoints.
var goal = CreateObject(Goal_Parkour, 0, 0, NO_OWNER);
var mode = PARKOUR_CP_Respawn | PARKOUR_CP_Check | PARKOUR_CP_Ordered;
goal->SetStartpoint(90, 820);
goal->AddCheckpoint(660, 580, 28);
goal->AddCheckpoint(500, 270, 28);
goal->AddCheckpoint(1850, 90, 28);
goal->AddCheckpoint(1650, 740, 28);
goal->AddCheckpoint(2200, 870, 28);
goal->AddCheckpoint(3300, 240, 28);
goal->AddCheckpoint(3830, 710, 28);
goal->AddCheckpoint(660, 580, mode);
goal->AddCheckpoint(500, 270, mode);
goal->AddCheckpoint(1850, 90, mode);
goal->AddCheckpoint(1650, 740, mode);
goal->AddCheckpoint(2200, 870, mode);
goal->AddCheckpoint(3300, 240, mode);
goal->AddCheckpoint(3830, 710, mode);
goal->SetFinishpoint(3650, 180);
SetSkyAdjust(RGB(255,128,0), RGB(0,0,0));
// Red sky.
SetSkyAdjust(RGB(255, 128, 0), RGB(0, 0, 0));
}
// Gamecall from parkour goal, on respawning.
protected func PlrHasRespawned(int iPlr, object cp)
protected func PlrHasRespawned(int plr, object cp)
{
var clonk = GetCrew(iPlr);
var clonk = GetCrew(plr);
clonk->CreateContents(Boompack);
}
@ -32,4 +35,4 @@ global func FxRespawnBoomTimer(object target, int num, int time)
{
target->CreateContents(Boompack);
return -1;
}
}

View File

@ -1,7 +1,11 @@
// Give the player a new boompack 2.5 seconds after launch.
#appendto Boompack
func Launch(int angle, object clonk)
{
if(clonk) clonk->AddEffect("RespawnBoom",clonk,1,90,nil,nil);
if (clonk)
clonk->AddEffect("RespawnBoom", clonk, 100, 90, nil, nil);
return _inherited(angle, clonk);
}
}

View File

@ -1,8 +1,11 @@
// The clonk can only hold one item and only collect boompacks.
#appendto Clonk
protected func RejectCollect(id objid, object obj)
{
if(objid != Boompack) return true;
if (objid != Boompack)
return true;
return _inherited(objid, obj);
}

View File

@ -1,39 +1,36 @@
overlay mats
{
mask = 1;
overlay {algo = rndchecker; turbulence = 100; mat = granite; a=3;b=4;};
overlay {algo = rndchecker; turbulence = 100; mat = rock; a=4;b=3;};
overlay {algo = rndchecker; turbulence = 100; mat = ore; a=6;b=3;};
overlay {algo = rndchecker; turbulence = 100; mat = rock; a=5;b=3; tex=rock_cracked;};
overlay {algo = rndchecker; turbulence = 100; mat = gold; a=4;b=7;};
overlay {algo = rndchecker; turbulence = 100; mat = earth; a=3;b=6;};
/*-- BristleRidge --*/
overlay Mats {
mask=1;
overlay { algo=rndchecker; turbulence=100; mat=Granite; a=3; b=4; };
overlay { algo=rndchecker; turbulence=100; mat=Rock; a=4; b=3; };
overlay { algo=rndchecker; turbulence=100; mat=Ore; a=6; b=3; };
overlay { algo=rndchecker; turbulence=100; mat=Rock; tex=rock_cracked; a=5; b=3; };
overlay { algo=rndchecker; turbulence=100; mat=Gold; a=4; b=7; };
overlay { algo=rndchecker; turbulence=100; mat=Earth; a=3; b=6; };
};
map o
{
overlay
{
algo = lines; a=26; b=46; mat = tunnel; turbulence = 100; zoomY=60; y=5; loosebounds=1; x=-10; wdt=120;
overlay {mat = earth; algo = rndchecker; zoomX=40; a=2;b=1; turbulence = 100; mats{};};
overlay {mat = earth; hgt=3;};
overlay
{
algo = lines; rotate = 75; a=5; b=30; turbulence = 50; mat = earth; mats{};
overlay {algo = rndchecker; a=2;b=2; mat = tunnel; turbulence = 100;};
};
};
overlay
{
algo = sin; mask = 1; oy=80; zoomY=-100; zoomX=50;
overlay
{
mat = earth; algo = border; invert = 1; a=2;b=2; turbulence = 100;
mats{};
overlay {algo = lines; mat = tunnel; a=13; b=55; turbulence = 20;};
};
};
overlay {y=86;wdt=5; mat = earth; mats{};
overlay{ mat=Brick; algo=border; a=1; };
};
overlay {y = 76;hgt=9;wdt=6; mat = tunnel;};
map BristleRidge {
overlay {
algo=lines; a=26; b=46; mat=Tunnel; turbulence=100; zoomY=60; y=5; loosebounds=1; x=-10; wdt=120;
overlay { mat=earth; algo=rndchecker; zoomX=40; a=2; b=1; turbulence=100; Mats{}; };
overlay { mat=earth; hgt=3; };
overlay {
algo=lines; rotate=75; a=5; b=30; turbulence=50; mat=Earth; Mats{};
overlay { algo=rndchecker; a=2; b=2; mat=tunnel; turbulence=100; };
};
};
overlay {
algo=sin; mask=1; oy=80; zoomY=-100; zoomX=50;
overlay {
mat=Earth; algo=border; invert=1; a=2; b=2; turbulence=100;
Mats{};
overlay { algo=lines; mat=Tunnel; a=13; b=55; turbulence=20; };
};
};
overlay {
y=86; wdt=5; mat=Earth; Mats{};
overlay { mat=Brick; algo=border; a=1; };
};
overlay { y=76; hgt=9; wdt=6; mat=Tunnel; };
};

View File

@ -5,37 +5,44 @@
Parkour on a dynamic map.
--*/
func Initialize()
protected func Initialize()
{
var pGoal = CreateObject(Goal_Parkour, 0, 0, NO_OWNER);
var goal = CreateObject(Goal_Parkour, 0, 0, NO_OWNER);
var x, y;
y=LandscapeHeight()-400;
x=10;
pGoal->SetStartpoint(x, y);
y = LandscapeHeight() - 400;
x = 10;
goal->SetStartpoint(x, y);
var ix,iy;
for(var i=0; i<5;i++)
var mode = PARKOUR_CP_Check | PARKOUR_CP_Respawn | PARKOUR_CP_Ordered;
for (var i = 0; i < 5; i++)
{
y-=LandscapeHeight()/10;
x+=LandscapeWidth()/6;
iy=y;ix=x;
var l=0,u=20;
while(GBackSolid(ix,iy) || GBackSky(ix,iy)) {++l;u+=3;iy=y-u+Random(2*u); ix=x-u+Random(2*u);if(l>100){break;};}
var mode = PARKOUR_CP_Check | PARKOUR_CP_Respawn | PARKOUR_CP_Ordered;
pGoal->AddCheckpoint(ix, iy, mode);
CreateObject(Dynamite,ix,iy,NO_OWNER)->Explode(20);
y -= LandscapeHeight()/10;
x += LandscapeWidth()/6;
iy = y; ix = x;
var l = 0, u = 20;
while (GBackSolid(ix, iy) || GBackSky(ix, iy))
{
++l; u += 3;
iy = y - u + Random(2 * u);
ix = x - u + Random(2 * u);
if (l > 100)
break;
}
goal->AddCheckpoint(ix, iy, mode);
CreateObject(Dynamite, ix, iy, NO_OWNER)->Explode(20);
}
x=LandscapeWidth()-130;
y=50;
pGoal->SetFinishpoint(x, y);
SetFoW(0);
Sound("BirdsLoop.ogg",true,100,nil,+1);
x = LandscapeWidth() - 130;
y = 50;
goal->SetFinishpoint(x, y);
SetFoW(false);
Sound("BirdsLoop.ogg", true, 100, nil, 1);
CreateObject(Environment_Clouds);
PlaceGrass(200);
}
protected func PlrHasRespawned(int iPlr, object cp)
protected func PlrHasRespawned(int plr, object cp)
{
var clonk = GetCrew(iPlr);
var clonk = GetCrew(plr);
clonk->CreateContents(GrappleBow);
clonk->CreateContents(JarOfWinds);
clonk->CreateContents(Loam);

View File

@ -1,4 +0,0 @@
RelaunchMsg0=%s versucht es nochmal.
RelaunchMsg1=%s ist tot.
RelaunchMsg2=Eine Runde Gelaechter fuer %s.
RelaunchMsg3=Wir trauern um %s.

View File

@ -1,4 +0,0 @@
RelaunchMsg0=%s tries it again.
RelaunchMsg1=%s is dead.
RelaunchMsg2=Haha, %s!
RelaunchMsg3=We're mourning %s.

View File

@ -1,74 +1,63 @@
map mount
/*-- ShiverPeak --*/
map ShiverPeak
{
overlay
{
algo = poly; mask = 1;
point {x=18%;y=100%;};
point {x=82%;y=100%;};
point {x=74%;y=41%;};
point {x=50%;y=0%;};
point {x=26%;y=41%;};
overlay
{
algo = border; mat = ice; invert = 1; a=7; b=7; turbulence = 100;
overlay {algo = rndchecker; turbulence = 100; mat = earth; tex = earth_dry;};
overlay { algo = rndchecker; a=5;b=5; zoomX=-30; zoomY=-30; turbulence = 100; mat = ore; };
overlay { algo = rndchecker; a=2;b=2; zoomX=30; zoomY=30; turbulence = 100; mat = granite; };
overlay { algo = rndchecker; a=19;b=19; zoomX=-30; zoomY=-30; turbulence = 100; mat = gold; };
overlay
{
algo = rndchecker; turbulence = 190; a=2;b=2; invert = 1;
mask = 1;
overlay {algo = rndchecker; mat = rock; a=2; b=2; turbulence = 100;};
overlay
{
algo = border; a=10; b=10; invert = 1; turbulence = 100; mask = 1;
overlay { algo = rndchecker; a=3;b=3; zoomX=-50; zoomY=-50; turbulence = 100; mat = granite; };
overlay { algo = rndchecker; a=6;b=6; zoomX=-20; zoomY=-20; turbulence = 100; mat = gold; }
|
overlay { algo = rndchecker; a=8;b=8; zoomX=10; zoomY=10; turbulence = 100; mat = gold; };
overlay { algo = rndchecker; a=4;b=4; zoomX=-40; zoomY=-40; turbulence = 100; mat = sulphur; }
|
overlay { algo = rndchecker; a=4;b=4; zoomX=-40; zoomY=-40; turbulence = 100; mat = sulphur; };
overlay { algo = rndchecker; a=3;b=3; zoomX=30; zoomY=30; turbulence = 100; mat = earth; tex = earth_rough;};
overlay
{
algo = rndchecker; a=2;b=2; zoomX=50; zoomY=50; turbulence = 100; mat = tunnel;
overlay {algo = border; b=1; mat = rock; turbulence = 2;};
}
|
overlay
{
algo = rndchecker; a=1;b=2; zoomX=50; zoomY=50; turbulence = 100; mat = tunnel;
overlay {algo = border; b=1; mat = rock; turbulence = 2;};
};
};
overlay {algo = border; invert = 1; turbulence = 80; a=4; b=4;}
&
overlay
{
algo = lines; a=22; b=24; rotate = 90; mask = 1;
overlay
{
algo = border; invert = 1; a=2; b=2; turbulence = 20; mask = 1;
overlay
{
algo = solid; mask = 1;
overlay
{
algo = solid; wdt=45; hgt=90; mask = 1;
overlay {algo = border; mat = tunnel; invert = 1; a=2; b=1; turbulence = 60;};
};
overlay
{
algo = solid; x=55; hgt=90; mask = 1;
overlay {algo = border; mat = tunnel; invert = 1; a=2; b=1; turbulence = 60;};
};
};
};
};
};
overlay {x=37; wdt = 26; y=86; hgt = 12; mask = 1; overlay {algo = border; invert = 1; a=2;b=2; turbulence = 100; mat = tunnel;};};
};
};
overlay {
algo=poly; mask=1;
point { x=18%; y=100%; };
point { x=82%; y=100%; };
point { x=74%; y=41%; };
point { x=50%; y=0%; };
point { x=26%; y=41%; };
overlay {
algo = border; mat = ice; invert = 1; a=7; b=7; turbulence = 100;
overlay {algo = rndchecker; turbulence = 100; mat = earth; tex = earth_dry;};
overlay { algo = rndchecker; a=5;b=5; zoomX=-30; zoomY=-30; turbulence = 100; mat = ore; };
overlay { algo = rndchecker; a=2;b=2; zoomX=30; zoomY=30; turbulence = 100; mat = granite; };
overlay { algo = rndchecker; a=19;b=19; zoomX=-30; zoomY=-30; turbulence = 100; mat = gold; };
overlay {
algo = rndchecker; turbulence = 190; a=2;b=2; invert = 1; mask = 1;
overlay {algo = rndchecker; mat = rock; a=2; b=2; turbulence = 100;};
overlay {
algo = border; a=10; b=10; invert = 1; turbulence = 100; mask = 1;
overlay { algo = rndchecker; a=3;b=3; zoomX=-50; zoomY=-50; turbulence = 100; mat = granite; };
overlay { algo = rndchecker; a=6;b=6; zoomX=-20; zoomY=-20; turbulence = 100; mat = gold; }
| overlay { algo = rndchecker; a=8;b=8; zoomX=10; zoomY=10; turbulence = 100; mat = gold; };
overlay { algo = rndchecker; a=4;b=4; zoomX=-40; zoomY=-40; turbulence = 100; mat = sulphur; }
| overlay { algo = rndchecker; a=4;b=4; zoomX=-40; zoomY=-40; turbulence = 100; mat = sulphur; };
overlay { algo = rndchecker; a=3;b=3; zoomX=30; zoomY=30; turbulence = 100; mat = earth; tex = earth_rough;};
overlay {
algo = rndchecker; a=2;b=2; zoomX=50; zoomY=50; turbulence = 100; mat = tunnel;
overlay {algo = border; b=1; mat = rock; turbulence = 2;};
}
| overlay {
algo = rndchecker; a=1;b=2; zoomX=50; zoomY=50; turbulence = 100; mat = tunnel;
overlay {algo = border; b=1; mat = rock; turbulence = 2;};
};
};
overlay {algo = border; invert = 1; turbulence = 80; a=4; b=4;}
& overlay {
algo = lines; a=22; b=24; rotate = 90; mask = 1;
overlay {
algo = border; invert = 1; a=2; b=2; turbulence = 20; mask = 1;
overlay {
algo = solid; mask = 1;
overlay {
algo = solid; wdt=45; hgt=90; mask = 1;
overlay {algo = border; mat = tunnel; invert = 1; a=2; b=1; turbulence = 60;};
};
overlay {
algo = solid; x=55; hgt=90; mask = 1;
overlay {algo = border; mat = tunnel; invert = 1; a=2; b=1; turbulence = 60;};
};
};
};
};
};
overlay {
x=37; wdt = 26; y=86; hgt = 12; mask = 1;
overlay {algo = border; invert = 1; a=2;b=2; turbulence = 100; mat = tunnel;};
};
};
};
};

View File

@ -7,72 +7,80 @@
func Initialize()
{
var pGoal = CreateObject(Goal_Parkour, 0, 0, NO_OWNER);
var goal = CreateObject(Goal_Parkour, 0, 0, NO_OWNER);
var x, y;
y=LandscapeHeight()-120;
x=LandscapeWidth()/2;
pGoal->SetStartpoint(x, y);
var ix,iy;
y=LandscapeHeight()/7*6;
for(var i=1; i<7;i++)
y = LandscapeHeight() - 120;
x = LandscapeWidth() / 2;
goal->SetStartpoint(x, y);
var ix, iy;
y = 6 * LandscapeHeight() / 7;
var mode = PARKOUR_CP_Check | PARKOUR_CP_Respawn | PARKOUR_CP_Ordered;
for (var i = 1; i < 7; i++)
{
iy=y-50+Random(100); ix=x-125+Random(250);
var l=0,u=125;
while(GBackSolid(ix,iy)) {++l;u+=5;iy=y-50+Random(100); ix=x-u+Random(2*u);if(l>50){break;};}
var mode = PARKOUR_CP_Check | PARKOUR_CP_Respawn;
pGoal->AddCheckpoint(ix, iy, mode);
y-=LandscapeHeight()/7;
iy = y - 50 + Random(100);
ix = x - 125 + Random(250);
var l = 0, u = 125;
while (GBackSolid(ix, iy))
{
++l; u += 5;
iy = y - 50 + Random(100);
ix = x - u + Random(2 * u);
if (l > 50)
break;
}
goal->AddCheckpoint(ix, iy, mode);
y -= LandscapeHeight() / 7;
}
x=LandscapeWidth()/2;;
y=35;
pGoal->SetFinishpoint(x, y);
x = LandscapeWidth() / 2;
y = 35;
goal->SetFinishpoint(x, y);
//Environmental Effects
var time = CreateObject(Environment_Time);
time->SetCycleSpeed();
time->SetCycleSpeed(0);
time->SetTime(900);
//Clouds
for(var i; i < 30; i++)
CreateObject(CloudEffect,Random(LandscapeWidth()),Random(LandscapeHeight()))->Show(nil,nil,5000,true);
for (var i = 0; i < 30; i++)
CreateObject(CloudEffect, Random(LandscapeWidth()), Random(LandscapeHeight()))->Show(nil, nil, 5000, true);
//Snow
AddEffect("Snowfall",0,1,2);
AddEffect("Snowfall", 0, 1, 2);
MapBottomFix();
//Place powderkegs and dynamite boxes
var i = 0;
while(i < 25)
for (var i = 0; i < 25; i++)
{
var pos = FindPosInMat("Tunnel",0,0,LandscapeWidth(),LandscapeHeight());
if(Random(2)) CreateObject(PowderKeg,pos[0],pos[1],NO_OWNER);
else CreateObject(DynamiteBox,pos[0],pos[1],NO_OWNER);
i++;
var pos = FindPosInMat("Tunnel", 0, 0, LandscapeWidth(), LandscapeHeight());
if (!pos)
continue;
if (Random(2))
CreateObject(PowderKeg, pos[0], pos[1], NO_OWNER);
else
CreateObject(DynamiteBox, pos[0], pos[1], NO_OWNER);
}
}
protected func PlrHasRespawned(int iPlr, object cp)
protected func PlrHasRespawned(int plr, object cp)
{
var clonk = GetCrew(iPlr);
var clonk = GetCrew(plr);
clonk->CreateContents(Shovel);
if (!Random(2))
clonk->CreateContents(Loam);
else
clonk->CreateContents(Dynamite);
clonk->CreateContents(Loam);
clonk->CreateContents(Dynamite);
return;
}
global func FxSnowfallTimer(object target, int num, int timer)
{
CastPXS("Snow",5,1,RandomX(0,LandscapeWidth()),1);
CastPXS("Snow", 5, 1, RandomX(0, LandscapeWidth()), 1);
}
global func MapBottomFix()
{
for(var i=1; i < LandscapeWidth(); i++)
for (var i = 1; i < LandscapeWidth(); i++)
{
var sway = Sin(i,10);
if(GetMaterial(i,LandscapeHeight()-1) == Material("Tunnel"))
DrawMaterialQuad("Granite",i-1,LandscapeHeight() - 13 + sway,i+1,LandscapeHeight() - 13 + sway,i+1,LandscapeHeight(),i-1,LandscapeHeight());
var sway = Sin(i, 10);
if (GetMaterial(i, LandscapeHeight() - 1) == Material("Tunnel"))
DrawMaterialQuad("Granite", i - 1, LandscapeHeight() - 13 + sway, i + 1, LandscapeHeight() - 13 + sway, i + 1, LandscapeHeight(), i - 1, LandscapeHeight());
}
}

View File

@ -1,4 +0,0 @@
RelaunchMsg0=%s versucht es nochmal.
RelaunchMsg1=%s ist tot.
RelaunchMsg2=Eine Runde Gelaechter fuer %s.
RelaunchMsg3=Wir trauern um %s.

View File

@ -1,4 +0,0 @@
RelaunchMsg0=%s tries it again.
RelaunchMsg1=%s is dead.
RelaunchMsg2=Haha, %s!
RelaunchMsg3=We're mourning %s.