Adjust comms messages to distinguish attack messages a bit

This commit is contained in:
cim 2013-11-28 21:54:00 +00:00
parent 1dd51a6adf
commit c1c28ae749

View File

@ -518,6 +518,19 @@ PriorityAIController.prototype.allied = function(ship1,ship2)
} }
PriorityAIController.prototype.broadcastAttackMessage = function(target,code,priority)
{
var msgcode = "oolite_"+code+"Attack";
var scan = target.scanClass;
if (scan == "CLASS_THARGOID") {
msgcode += "Thargoid";
} else if (scan == "CLASS_ROCK" || scan == "CLASS_CARGO" || scan == "CLASS_BUOY" || scan == "CLASS_MISSILE" || scan == "CLASS_MINE") {
msgcode += "Inanimate";
}
this.communicate(msgcode,target,priority);
}
PriorityAIController.prototype.broadcastDistressMessage = function() PriorityAIController.prototype.broadcastDistressMessage = function()
{ {
if (this.__ltcache.oolite_sentDistressMessage) if (this.__ltcache.oolite_sentDistressMessage)
@ -2697,12 +2710,12 @@ PriorityAIController.prototype.behaviourDestroyCurrentTarget = function()
if (!this.ship.hasHostileTarget) if (!this.ship.hasHostileTarget)
{ {
// entering attack mode // entering attack mode
this.communicate("oolite_beginningAttack",this.ship.target,3); this.broadcastAttackMessage(target,"beginning",3);
this.ship.requestHelpFromGroup(); this.ship.requestHelpFromGroup();
} }
else else
{ {
this.communicate("oolite_continuingAttack",this.ship.target,4); this.broadcastAttackMessage(target,"continuing",4);
} }
} }
this.ship.performAttack(); this.ship.performAttack();
@ -3234,12 +3247,12 @@ PriorityAIController.prototype.behaviourRepelCurrentTarget = function()
if (!this.ship.hasHostileTarget) if (!this.ship.hasHostileTarget)
{ {
// entering attack mode // entering attack mode
this.communicate("oolite_beginningAttack",target,3); this.broadcastAttackMessage(target,"beginning",3);
this.ship.requestHelpFromGroup(); this.ship.requestHelpFromGroup();
} }
else if (this.ship.target) else if (this.ship.target)
{ {
this.communicate("oolite_continuingAttack",target,4); this.broadcastAttackMessage(target,"continuing",4);
} }
if (this.ship.energy == this.ship.maxEnergy && this.getParameter("oolite_flag_escortsCoverRetreat") && this.ship.escortGroup.count > 1) if (this.ship.energy == this.ship.maxEnergy && this.getParameter("oolite_flag_escortsCoverRetreat") && this.ship.escortGroup.count > 1)
{ {
@ -6174,6 +6187,7 @@ this.startUp = function()
/* These are temporary for testing. Remove before release... */ /* These are temporary for testing. Remove before release... */
this.$commsSettings.generic.generic.oolite_continuingAttack = "I've got the [oolite_entityClass]"; this.$commsSettings.generic.generic.oolite_continuingAttack = "I've got the [oolite_entityClass]";
this.$commsSettings.generic.generic.oolite_beginningAttack = "Die, [oolite_entityName]!"; this.$commsSettings.generic.generic.oolite_beginningAttack = "Die, [oolite_entityName]!";
this.$commsSettings.generic.generic.oolite_beginningAttackInanimate = "I've got you this time, [oolite_entityName]!";
this.$commsSettings.generic.generic.oolite_hitTarget = "Take that, scum."; this.$commsSettings.generic.generic.oolite_hitTarget = "Take that, scum.";
this.$commsSettings.generic.generic.oolite_killedTarget = "[oolite_entityClass] down!"; this.$commsSettings.generic.generic.oolite_killedTarget = "[oolite_entityClass] down!";
this.$commsSettings.pirate.generic.oolite_hitTarget = "Where's the cargo, [oolite_entityName]?"; this.$commsSettings.pirate.generic.oolite_hitTarget = "Where's the cargo, [oolite_entityName]?";
@ -6188,8 +6202,9 @@ this.startUp = function()
this.$commsSettings.generic.generic.oolite_startFleeing = "I can't take this much longer! I'm getting out of here."; this.$commsSettings.generic.generic.oolite_startFleeing = "I can't take this much longer! I'm getting out of here.";
this.$commsSettings.generic.generic.oolite_continueFleeing = "I'm still not clear. Someone please help!"; this.$commsSettings.generic.generic.oolite_continueFleeing = "I'm still not clear. Someone please help!";
this.$commsSettings.generic.generic.oolite_groupIsOutnumbered = "Please, let us go!"; this.$commsSettings.generic.generic.oolite_groupIsOutnumbered = "Please, let us go!";
this.$commsSettings.pirate.generic.oolite_groupIsOutnumbered = "Argh! They're tougher than they looked. Break off the attack!"; this.$commsSettings.pirate.generic.oolite_groupIsOutnumbered = "Argh! They're tougher than they looked. Break off the attack!"
this.$commsSettings.generic.generic.oolite_dockingWait = "Bored now."; this.$commsSettings.generic.generic.oolite_dockingWait = "Bored now.";
this.$commsSettings.generic.generic.oolite_mining = "Maybe this one has gems.";
this.$commsSettings.generic.generic.oolite_quiriumCascade = "Cascade! %N! Get out of here!"; this.$commsSettings.generic.generic.oolite_quiriumCascade = "Cascade! %N! Get out of here!";
this.$commsSettings.pirate.generic.oolite_scoopedCargo = "Ah, [oolite_goodsDescription]. We should have shaken them down for more."; this.$commsSettings.pirate.generic.oolite_scoopedCargo = "Ah, [oolite_goodsDescription]. We should have shaken them down for more.";
this.$commsSettings.generic.generic.oolite_agreeingToDumpCargo = "Have it! But please let us go!"; this.$commsSettings.generic.generic.oolite_agreeingToDumpCargo = "Have it! But please let us go!";