Make navigation buoys rotate again

This commit is contained in:
cim 2013-07-03 17:43:49 +01:00
parent 2b224685f3
commit 6d12aa177e
5 changed files with 42 additions and 34 deletions

View File

@ -2,6 +2,7 @@
GLOBAL = GLOBAL =
{ {
ENTER = (performIdle); ENTER = (performIdle);
START_TUMBLING = (performBuoyTumble);
ATTACKED = (setTargetToPrimaryAggressor, broadcastDistressMessage); ATTACKED = (setTargetToPrimaryAggressor, broadcastDistressMessage);
UPDATE = ("pauseAI: 3600"); UPDATE = ("pauseAI: 3600");
}; };

View File

@ -116,6 +116,7 @@
"setCoordinatesFromPosition", "setCoordinatesFromPosition",
"performFaceDestination", "performFaceDestination",
"performTumble", "performTumble",
"performBuoyTumble",
"fightOrFleeMissile", "fightOrFleeMissile",
"setCourseToPlanet", "setCourseToPlanet",
"setTakeOffFromPlanet", "setTakeOffFromPlanet",

View File

@ -40,13 +40,9 @@ this.version = "1.79";
/* TO-DO: /* TO-DO:
* Buoys need to be given spin (0.15 pitch, 0.1 roll) * Buoys need to be given spin (0.15 pitch, 0.1 roll)
* Thargoid chance should be lower for non-human systems
* Nova mission/system needs modifying
*/ */
this.systemWillPopulate = function() this.systemWillPopulate = function()
{ {
log(this.name,"System populator");
/* Priority range 0-99 used by Oolite default populator */ /* Priority range 0-99 used by Oolite default populator */
/* Add navigation buoys */ /* Add navigation buoys */
@ -60,6 +56,7 @@ this.systemWillPopulate = function()
callback: function(pos) { callback: function(pos) {
var nb = system.addShips("buoy",1,pos,0)[0]; var nb = system.addShips("buoy",1,pos,0)[0];
nb.scanClass = "CLASS_BUOY"; nb.scanClass = "CLASS_BUOY";
nb.reactToAIMessage("START_TUMBLING");
}, },
deterministic: true deterministic: true
}); });
@ -72,6 +69,7 @@ this.systemWillPopulate = function()
callback: function(pos) { callback: function(pos) {
var wb = system.addShips("buoy-witchpoint",1,pos,0)[0]; var wb = system.addShips("buoy-witchpoint",1,pos,0)[0];
wb.scanClass = "CLASS_BUOY"; wb.scanClass = "CLASS_BUOY";
wb.reactToAIMessage("START_TUMBLING");
}, },
deterministic: true deterministic: true
}); });
@ -142,16 +140,12 @@ this.systemWillPopulate = function()
/* Calculate thargoids */ /* Calculate thargoids */
var thargoids = 0; var thargoids = 0;
while (Math.random() < 0.1) while (Math.random() < 0.065)
{ {
thargoids++; thargoids++;
} }
/* Start adding ship groups */ /* Start adding ship groups */
log(this.name,"Adding Traders: "+traders+" to route 1, "+pstraders+" to route 2");
log(this.name,"Adding Pirate packs: "+pirates+" to route 1, "+pspirates+" to route 2");
log(this.name,"Adding Hunters: "+hunters+" to route 1, "+pshunters+" to route 2");
log(this.name,"Adding Thargoids: "+thargoids+" to route 1");
/* Add traders */ /* Add traders */
system.setPopulator("oolite-route1-traders", system.setPopulator("oolite-route1-traders",
@ -277,7 +271,6 @@ this.systemWillPopulate = function()
var rh = system.addShips("rockhermit",1,pos,0)[0]; var rh = system.addShips("rockhermit",1,pos,0)[0];
rh.scanClass = "CLASS_ROCK"; rh.scanClass = "CLASS_ROCK";
} }
log("oolite-populator","Added "+size+" rocks and "+hermit+" hermit at "+pos);
} }
system.setPopulator("oolite-route1-asteroids", system.setPopulator("oolite-route1-asteroids",
@ -309,8 +302,6 @@ this.systemWillPopulate = function()
if (system.countShipsWithPrimaryRole("rockhermit")==0) { if (system.countShipsWithPrimaryRole("rockhermit")==0) {
var rh = system.addShips("rockhermit",1,pos,0)[0]; var rh = system.addShips("rockhermit",1,pos,0)[0];
rh.scanClass = "CLASS_ROCK"; rh.scanClass = "CLASS_ROCK";
log("oolite-populator","Added offlane hermit at "+pos);
// just the hermit, no other rocks // just the hermit, no other rocks
} }
}, },
@ -333,7 +324,7 @@ this.systemWillRepopulate = function()
{ {
if (Math.random() < 0.2) if (Math.random() < 0.2)
{ {
var newskimmer = system.addShips("sunskim-trader",1,[0,0,0],7500)[0]; var newtrader = system.addShips("sunskim-trader",1,[0,0,0],7500)[0];
var reqIns = 1000/(1+newskimmer.maxSpeed); var reqIns = 1000/(1+newskimmer.maxSpeed);
if (reqIns > 12) if (reqIns > 12)
{ {
@ -347,8 +338,9 @@ this.systemWillRepopulate = function()
} }
else else
{ {
system.addShips("trader",1,[0,0,0],7500)[0]; var newtrader = system.addShips("trader",1,[0,0,0],7500)[0];
} }
newtrader.setBounty(0,"setup actions");
return; return;
} }
@ -368,6 +360,7 @@ this.systemWillRepopulate = function()
{ {
newpolice.switchAI("route1patrolAI.plist"); newpolice.switchAI("route1patrolAI.plist");
} }
newpolice.setBounty(0,"setup actions");
} }
else else
{ {
@ -388,6 +381,7 @@ this.systemWillRepopulate = function()
{ {
newhunter.switchAI("route2patrolAI.plist"); newhunter.switchAI("route2patrolAI.plist");
} }
newhunter.setBounty(0,"setup actions");
} }
} }
return; return;
@ -489,25 +483,24 @@ this.novaSystemWillRepopulate = function()
} }
*/ */
/* Utility functions */ /* Utility functions */
this._addPirates = function(pos) this._addPirates = function(pos)
{
var size = Math.random()*4;
if (system.government >= 6)
{ {
var size = Math.random()*4; size = size/2;
if (system.government >= 6)
{
size = size/2;
}
else if (system.government <= 1)
{
size += Math.random()*3;
}
size = Math.ceil(size);
log("oolite-populator","Pirate pack, size: "+size);
var pg = system.addGroup("pirate",size,pos,2.5E3);
for (var i=0;i<pg.ships.length;i++)
{
pg.ships[i].setBounty(20+system.government+size+Math.floor(Math.random()*8),"setup actions");
}
} }
else if (system.government <= 1)
{
size += Math.random()*3;
}
size = Math.ceil(size);
log("oolite-populator","Pirate pack, size: "+size);
var pg = system.addGroup("pirate",size,pos,2.5E3);
for (var i=0;i<pg.ships.length;i++)
{
pg.ships[i].setBounty(20+system.government+size+Math.floor(Math.random()*8),"setup actions");
}
}

View File

@ -326,6 +326,15 @@
} }
- (void) performBuoyTumble
{
stick_roll = 0.10;
stick_pitch = 0.15;
behaviour = BEHAVIOUR_TUMBLE;
frustration = 0.0;
}
- (void) performStop - (void) performStop
{ {
behaviour = BEHAVIOUR_STOP_STILL; behaviour = BEHAVIOUR_STOP_STILL;

View File

@ -2500,8 +2500,12 @@ GLfloat docked_light_specular[4] = { DOCKED_ILLUM_LEVEL, DOCKED_ILLUM_LEVEL, DOC
- (void) addWitchspaceJumpEffectForShip:(ShipEntity *)ship - (void) addWitchspaceJumpEffectForShip:(ShipEntity *)ship
{ {
[self addEntity:[OORingEffectEntity ringFromEntity:ship]]; // don't add rings when system is being populated
[self addEntity:[OORingEffectEntity shrinkingRingFromEntity:ship]]; if ([PLAYER status] != STATUS_ENTERING_WITCHSPACE && [PLAYER status] != STATUS_EXITING_WITCHSPACE)
{
[self addEntity:[OORingEffectEntity ringFromEntity:ship]];
[self addEntity:[OORingEffectEntity shrinkingRingFromEntity:ship]];
}
} }