Implemented commsMessageByUnpiloted for legacy scripts and ship AI.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1606 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
7b546c09e3
commit
edf000ec1d
@ -116,11 +116,9 @@ MA 02110-1301, USA.
|
||||
- (void) clearMissionDescriptionForMission:(NSString *)key;
|
||||
|
||||
- (void) commsMessage:(NSString *)valueString;
|
||||
|
||||
#if 0 // Disabled until approved for inclusion.
|
||||
- (void) commsMessageByUnpiloted:(NSString *)valueString; // Same as commsMessage, but can be used by scripts to have
|
||||
// unpiloted ships sending commsMessages, if we want to.
|
||||
#endif
|
||||
- (void) commsMessageByUnpiloted:(NSString *)valueString; // Enabled 02-May-2008 - Nikos. Same as commsMessage, but
|
||||
// can be used by scripts to have unpiloted ships sending
|
||||
// commsMessages, if we want to.
|
||||
|
||||
- (void) consoleMessage3s:(NSString *)valueString;
|
||||
- (void) consoleMessage6s:(NSString *)valueString;
|
||||
|
@ -1153,14 +1153,14 @@ static int scriptRandomSeed = -1; // ensure proper random function
|
||||
}
|
||||
|
||||
|
||||
#if 0 // Disabled until approved for inclusion.
|
||||
// Enabled on 02-May-2008 - Nikos
|
||||
// This method does the same as -commsMessage, (which in fact calls), the difference being that scripts can use this
|
||||
// method to have unpiloted ship entities sending comms messages.
|
||||
- (void) commsMessageByUnpiloted:(NSString *)valueString
|
||||
{
|
||||
[self commsMessage:valueString];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
- (void) consoleMessage3s:(NSString *)valueString
|
||||
{
|
||||
|
@ -687,6 +687,8 @@ BOOL class_masslocks(int some_class);
|
||||
- (void) sendExpandedMessage:(NSString *) message_text toShip:(ShipEntity*) other_ship;
|
||||
- (void) broadcastAIMessage:(NSString *) ai_message;
|
||||
- (void) broadcastMessage:(NSString *) message_text;
|
||||
// Unpiloted ships cannot broadcast messages, unless the unpilotedOverride is set to YES.
|
||||
- (void) broadcastMessage:(NSString *) message_text withUnpilotedOverride:(BOOL) unpilotedOverride;
|
||||
- (void) setCommsMessageColor;
|
||||
- (void) receiveCommsMessage:(NSString *) message_text;
|
||||
|
||||
|
@ -7530,11 +7530,17 @@ static BOOL AuthorityPredicate(Entity *entity, void *parameter)
|
||||
|
||||
|
||||
- (void) broadcastMessage:(NSString *) message_text
|
||||
{
|
||||
[self broadcastMessage:message_text withUnpilotedOverride:NO];
|
||||
}
|
||||
|
||||
|
||||
- (void) broadcastMessage:(NSString *) message_text withUnpilotedOverride:(BOOL) unpilotedOverride
|
||||
{
|
||||
NSString* expandedMessage = [NSString stringWithFormat:@"%@:\n %@", displayName, ExpandDescriptionForCurrentSystem(message_text)];
|
||||
|
||||
if (!crew)
|
||||
return; // nobody to send the signal
|
||||
if (!crew && !unpilotedOverride)
|
||||
return; // nobody to send the signal and no override for unpiloted craft is set
|
||||
|
||||
[self setCommsMessageColor];
|
||||
[self checkScanner];
|
||||
|
@ -124,6 +124,8 @@ MA 02110-1301, USA.
|
||||
- (void) wormholeEntireGroup;
|
||||
|
||||
- (void) commsMessage:(NSString *)valueString;
|
||||
- (void) commsMessageByUnpiloted:(NSString *)valueString;
|
||||
- (void) commsMessage:(NSString *)valueString withUnpilotedOverride:(BOOL)unpilotedOverride;
|
||||
- (void) broadcastDistressMessage;
|
||||
- (void) acceptDistressMessageFrom:(ShipEntity *)other;
|
||||
|
||||
|
@ -799,6 +799,18 @@ WormholeEntity* whole;
|
||||
|
||||
|
||||
- (void) commsMessage:(NSString *)valueString
|
||||
{
|
||||
[self commsMessage:valueString withUnpilotedOverride:NO];
|
||||
}
|
||||
|
||||
|
||||
- (void) commsMessageByUnpiloted:(NSString *)valueString
|
||||
{
|
||||
[self commsMessage:valueString withUnpilotedOverride:YES];
|
||||
}
|
||||
|
||||
|
||||
- (void) commsMessage:(NSString *)valueString withUnpilotedOverride:(BOOL)unpilotedOverride
|
||||
{
|
||||
Random_Seed very_random_seed;
|
||||
very_random_seed.a = rand() & 255;
|
||||
@ -811,7 +823,7 @@ WormholeEntity* whole;
|
||||
|
||||
NSString* expandedMessage = ExpandDescriptionForCurrentSystem(valueString);
|
||||
|
||||
[self broadcastMessage:expandedMessage];
|
||||
[self broadcastMessage:expandedMessage withUnpilotedOverride:unpilotedOverride];
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user