added firefly and test scenario for it

squashed:
adjusted fireflies to style guidelines
* fireflys emmit light
+ added firefly and test scenario for it
shapetextures
Randrian45 2015-09-09 22:35:27 +02:00 committed by David Dormagen
parent e6e4f06c92
commit 8076075c5b
10 changed files with 363 additions and 0 deletions

View File

@ -0,0 +1,11 @@
[DefCore]
id=Firefly
Version=6,1
Category=C4D_Living
Width=4
Height=4
Offset=-2,-2
Vertices=1
VertexFriction=100
Value=1
Mass=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,129 @@
/*
Firefly
Author: Randrian, Nachtschatten (Clinfinity)
A small glowing being, often encountered in groups.
*/
static const Firefly_MaxSpawnDistance = 15;
static const Firefly_MaxDistance = 40;
static const Firefly_ShynessDistance = 40;
local attracted_to;
local timer;
public func SpawnSwarm(object attracted_to, int size)
{
if (!size) size = 10;
var x = attracted_to->GetX();
var y = attracted_to->GetY();
for (var i = 0; i < size; i++)
{
var firefly = CreateObject(Firefly, RandomX(x - Firefly_MaxSpawnDistance, x + Firefly_MaxSpawnDistance), RandomX(y - Firefly_MaxSpawnDistance, y + Firefly_MaxSpawnDistance), NO_OWNER);
firefly.attracted_to = attracted_to;
}
}
private func Flying() {
var xdir, ydir;
timer += Random(2);
var angle = timer*180/10;
SetObjDrawTransform(900+Sin(angle,100), 0, 0, 0, 900+Sin(angle, 100), 0, 1);
SetLightColor(RGB(200,255,150+Sin(angle,10)));
var away_from = FindObject(Find_Distance(Firefly_ShynessDistance), Find_Category(C4D_Object), Find_OCF(OCF_HitSpeed1), Find_NoContainer());
if (away_from)
{
xdir = BoundBy(GetX() - away_from->GetX(), -1, 1);
ydir = BoundBy(GetY() - away_from->GetY(), -1, 1);
if(xdir == 0) xdir = Random(2) * 2 - 1;
if(ydir == 0) ydir = Random(2) * 2 - 1;
xdir = RandomX(5 * xdir, 10 * xdir);
ydir = RandomX(5 * ydir, 10 * ydir);
// No check for liquids here, you can scare fireflies into those ;)
SetSpeed(xdir, ydir);
}
else
{
if (Random(4)) return;
if (attracted_to != 0 && ObjectDistance(attracted_to) > Firefly_MaxDistance)
{
xdir = BoundBy(attracted_to->GetX() - GetX(), -1, 1);
ydir = BoundBy(attracted_to->GetY() - GetY(), -1, 1);
xdir = RandomX(xdir, 6 * xdir);
ydir = RandomX(ydir, 6 * ydir);
}
else
{
xdir = Random(120) - 60;
ydir = Random(80) - 40;
}
if (GBackLiquid(xdir, ydir))
{
SetSpeed(0, 0);
}
else
{
xdir *= 10;
ydir *= 10;
while(GBackSemiSolid(0, ydir)) ydir-=1;
SetCommand("MoveTo", 0, GetX()+xdir, GetY()+ydir);
if(Random(10)==0 && attracted_to)
SetCommand("MoveTo", attracted_to);
}
}
}
private func Check()
{
// Buried or in water: Instant death
if (GBackSemiSolid())
{
Death();
}
}
public func Initialize()
{
SetAction("Fly");
SetGraphics("", GetID(), 1, 1, 0, GFX_BLIT_Additive);
SetClrModulation(RGBa(200,255,100,50),1);
SetGraphics("", GetID(), 2, 1, 0, GFX_BLIT_Additive);
SetClrModulation(RGBa(200,255,0,255),2);
SetObjDrawTransform(300, 0, 0, 0, 300, 0, 2);
SetLightRange(5,30);
SetLightColor(RGB(200,255,100));
}
public func CatchBlow() { RemoveObject(); }
public func Damage() { RemoveObject(); }
public func Death() { RemoveObject(); }
local ActMap = {
Fly = {
Prototype = Action,
Name = "Fly",
Procedure = DFA_FLOAT,
Speed = 30,
Accel = 5,
Decel = 5,
Directions = 2,
Length = 1,
Delay = 1,
NextAction = "Fly",
PhaseCall = "Flying",
EndCall = "Check",
},
};
local Name = "$Name$";
local MaxEnergy = 40000;
local MaxBreath = 125;
local Placement = 2;
local NoBurnDecay = 1;

View File

@ -0,0 +1 @@
Name=Glühwürmchen

View File

@ -0,0 +1 @@
Name=Firefly

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,57 @@
[Head]
Icon=26
Title=FireflyTest
Version=6,0
Difficulty=10
MaxPlayer=8
NoInitialize=0
[Definitions]
Definition1=Objects.ocd
[Game]
Rules=RSTR=1
[Player1]
Wealth=50,0,0,250
Crew=Clonk=1
[Player2]
Wealth=50,0,0,250
Crew=Clonk=1
[Player3]
Wealth=50,0,0,250
Crew=Clonk=1
[Player4]
Wealth=50,0,0,250
Crew=Clonk=1
[Landscape]
Vegetation=TRE1=1;TRE2=2;TRE3=1;TRE4=1
VegetationLevel=100,0,0,100
InEarth=Rock=1;Gold=1;Fireglobe=1;Loam=1
InEarthLevel=65,0,0,100
Sky=Clouds2
BottomOpen=0
MapWidth=500,0,64,10000
MapHeight=100,0,40,10000
MapZoom=10
Amplitude=10,10,0,100
Phase=50,50,0,100
Period=10,10,0,100
Random=20,20,0,100
Liquid=Water-Smooth
LiquidLevel=20,30,0,100
Layers=Rock=7;Rock=7;Gold=7;Granite=4;Water=5;Earth-earth=50;Earth-earth_dry=50
SkyScrollMode=2
NewStyleLandscape=2
[Weather]
Climate=0,0,0,100
YearSpeed=20,10,0,100
Wind=1,100,-100,100
[Environment]
Objects=EGLN=1;EGRS=1

View File

@ -0,0 +1,157 @@
/* Sky race */
func Initialize()
{
// CreateObjectAbove(Ropeladder, 174, 445)->Unroll(-1, 0, 25);
CreateObjectAbove(Ropeladder, 328, 564);
CreateObjectAbove(Ropeladder, 226, 330);
CreateObjectAbove(Rock, 159, 363);
CreateObjectAbove(Rock, 232, 388);
var Anchor1 = CreateObjectAbove(Ropebridge_Post, 515, 547);
var Anchor2 = CreateObjectAbove(Ropebridge_Post, 602, 538);
Anchor2->SetObjDrawTransform(-1000, 0, 0, 0, 1000);
Anchor2.Double->SetObjDrawTransform(-1000, 0, 0, 0, 1000);
var bridge = CreateObjectAbove(Ropebridge, 515, 547);
bridge->MakeBridge(Anchor1, Anchor2);
bridge->SetFragile();
var Anchor1 = CreateObjectAbove(Ropebridge_Post, 266, 435+6);
var Anchor2 = CreateObjectAbove(Ropebridge_Post, 346, 473+6);
Anchor2->SetObjDrawTransform(-1000, 0, 0, 0, 1000);
Anchor2.Double->SetObjDrawTransform(-1000, 0, 0, 0, 1000);
CreateObjectAbove(Ropebridge, 515, 547)->MakeBridge(Anchor1, Anchor2);
CreateObjectAbove(Branch, 505, 547);
CreateObjectAbove(Rock,495, 547);
// CreateObjectAbove(Ropeladder, 197, 432)->MakeBridge(Rock1, Rock2);
// for(var i = 0; i < 10; i++)
// bridge->CreateObjectAbove(Zap, RandomX(-30,30), -40+RandomX(-30,30));
var obj;
obj = CreateObjectAbove(Branch, 395, 484);
obj->SetR(40);
obj->SetProperty("MeshTransformation", [-1000, 0, 0, 0, 0, 1000, 0, 0, 0, 0, -1000, 0]);
obj.Plane = 400;
obj = CreateObjectAbove(Branch, 433, 509);
obj->SetR(-26);
obj->SetProperty("MeshTransformation", [-602, 0, -799, 0, 0, 1000, 0, 0, 799, 0, -602, 0]);
obj.Plane = 400;
obj = CreateObjectAbove(Branch, 448, 517);
obj->SetR(24);
obj->SetProperty("MeshTransformation", [-848, 0, 530, 0, 0, 1000, 0, 0, -530, 0, -848, 0]);
obj.Plane = 100;
obj = CreateObjectAbove(Branch, 366, 482);
obj->SetR(16);
obj->SetProperty("MeshTransformation", [-999, 0, -52, 0, 0, 1000, 0, 0, 52, 0, -999, 0]);
obj.Plane = 100;
obj = CreateObjectAbove(Branch, 501, 548);
obj->SetR(-16);
obj->SetProperty("MeshTransformation", [629, 0, 777, 0, 0, 1000, 0, 0, -777, 0, 629, 0]);
obj.Plane = 100;
obj = CreateObjectAbove(Branch, 417, 474);
obj->SetR(-4);
obj->SetProperty("MeshTransformation", [978, 0, 208, 0, 0, 1000, 0, 0, -208, 0, 978, 0]);
obj.Plane = 100;
obj = CreateObjectAbove(Branch, 482, 532);
obj->SetR(11);
obj->SetProperty("MeshTransformation", [743, 0, 669, 0, 0, 1000, 0, 0, -669, 0, 743, 0]);
obj.Plane = 100;
obj = CreateObjectAbove(Branch, 468, 511);
obj->SetR(40);
obj->SetProperty("MeshTransformation", [-423, 0, 906, 0, 0, 1000, 0, 0, -906, 0, -423, 0]);
obj.Plane = -400;
obj = CreateObjectAbove(Trunk, 402, 507);
obj->SetR(10);
obj->SetProperty("MeshTransformation", [940, 0, 342, 0, 0, 1000, 0, 0, -342, 0, 940, 0]);
obj.Plane = 100;
obj = CreateObjectAbove(Trunk, 456, 545);
obj->SetR(120);
obj->SetProperty("MeshTransformation", [-906, 0, -423, 0, 0, 1000, 0, 0, 423, 0, -906, 0]);
obj.Plane = -40;
obj = CreateObjectAbove(Tree_Coniferous, 375, 483);
obj->SetProperty("MeshTransformation", [139, 0, 990, 0, 0, 1000, 0, 0, -990, 0, 139, 0]);
obj.Plane = 100;
obj = CreateObjectAbove(Tree_Coniferous, 455, 526);
obj->SetProperty("MeshTransformation", [276, 0, 961, 0, 0, 1000, 0, 0, -961, 0, 276, 0]);
obj.Plane = 100;
obj = CreateObjectAbove(BigRock, 497, 561);
obj->SetProperty("MeshTransformation", [1003, -29, 18, 0, 0, -313, -521, 0, 44, 1096, -658, 0]);
obj.Plane = 100;
obj = CreateObjectAbove(BigRock, 448, 527);
obj->SetProperty("MeshTransformation", [916, 133, -534, 0, 0, -1124, -280, 0, -354, 142, -571, 0]);
obj.Plane = -100;
obj = CreateObjectAbove(BigRock, 363, 491);
obj->SetProperty("MeshTransformation", [-782, 469, 16, 0, 0, -40, 1162, 0, 465, 772, 27, 0]);
obj.Plane = -400;
obj = CreateObjectAbove(BigRock, 417, 512);
obj->SetProperty("MeshTransformation", [-759, -552, 9, 0, 0, -22, -1337, 0, 465, -639, 10, 0]);
obj.Plane = -400;
obj = CreateObjectAbove(Fern, 468, 530);
Firefly->SpawnSwarm(obj, 10);
obj->SetProperty("MeshTransformation", [-156, 0, 988, 0, 0, 1000, 0, 0, -988, 0, -156, 0]);
obj.Plane = 400;
obj = CreateObjectAbove(Fern, 383, 481);
Firefly->SpawnSwarm(obj, 10);
obj->SetProperty("MeshTransformation", [-891, 0, -454, 0, 0, 1000, 0, 0, 454, 0, -891, 0]);
obj.Plane = 100;
obj = CreateObjectAbove(Fern, 422, 512);
obj->SetProperty("MeshTransformation", [921, 0, -391, 0, 0, 1000, 0, 0, 391, 0, 921, 0]);
Firefly->SpawnSwarm(obj, 10);
obj.Plane = 100;
obj = CreateObjectAbove(Mushroom, 368, 482);
obj->SetProperty("MeshTransformation", [-999, 0, 35, 0, 0, 1000, 0, 0, -35, 0, -999, 0]);
obj.Plane = 500;
obj = CreateObjectAbove(Mushroom, 472, 532);
obj->SetProperty("MeshTransformation", [-707, 0, 707, 0, 0, 1000, 0, 0, -707, 0, -707, 0]);
obj.Plane = 500;
SetSkyAdjust(RGB(50,50,50));
}
func SerializeObjects(ids)
{
if(!ids)
ids = [Branch, Trunk, Tree_Coniferous, BigRock, Fern];
for( findid in ids)
for(var obj in FindObjects(Find_ID(findid)))
{
Log("obj = CreateObjectAbove(%i, %d, %d);", findid, obj->GetX(), obj->GetDefBottom());
if(obj->GetR())
Log("obj->SetR(%d);", obj->GetR());
if(obj->GetProperty("MeshTransformation"))
Log("obj->SetProperty(\"MeshTransformation\", %v);", obj->GetProperty("MeshTransformation"));
if(obj->GetProperty("Plane"))
Log("obj.Plane = %d;", obj->GetProperty("Plane"));
}
}
func InitializePlayer(int iPlr, int iX, int iY, object pBase, int iTeam)
{
JoinPlayer(iPlr);
return;
}
func RelaunchPlayer(int iPlr)
{
var clonk = CreateObjectAbove(Clonk, 0, 0, iPlr);
clonk->MakeCrewMember(iPlr);
SetCursor(iPlr,clonk);
JoinPlayer(iPlr);
return;
}
func JoinPlayer(int iPlr)
{
var clonk = GetCrew(iPlr);
clonk->SetPosition(425, 498);
clonk->DoEnergy(100000);
clonk->CreateContents(Musket);
clonk->CreateContents(LeadShot);
clonk->CreateContents(GrappleBow);
clonk->CreateContents(Bow);
clonk->Collect(CreateObjectAbove(Arrow));
return;
}

View File

@ -0,0 +1,5 @@
[Teams]
Active=false
Custom=false
AllowHostilityChange=true
AutoGenerateTeams=true

View File

@ -0,0 +1,2 @@
DE:Glühwürmchentest
US:Firefly test