Whitelisted setPrimaryRole: for AIs, and made setStateTo: a normal method.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2734 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2009-11-11 15:24:34 +00:00
parent d176e1cf90
commit 07902c2b70
5 changed files with 15 additions and 6 deletions

View File

@ -192,6 +192,8 @@
"checkAegis",
"checkEnergy",
"setThrustFactorTo:",
"setStateTo:",
"debugMessage:",
// StationEntity.m/stubs in ShipEntityAI.m
"increaseAlertLevel",
@ -208,9 +210,7 @@
"launchShipWithRole:",
"launchIndependentShipWithRole:",
"abortAllDockings",
// Simulated method
"setStateTo:",
"setPrimaryRole:",
// ShipEntity.m
"fireECM",

View File

@ -489,8 +489,7 @@ static void GenerateGraphVizForStateMachine(NSDictionary *stateMachine, NSString
}
else
{
if ([selectorStr isEqual:@"setStateTo:"]) [self setState:dataString];
else if ([selectorStr isEqual:@"debugMessage:"])
if ([selectorStr isEqual:@"debugMessage:"])
{
OOLog(@"ai.takeAction.debugMessage", @"DEBUG: AI MESSAGE from %@: %@", ownerDesc, dataString);
}

View File

@ -3958,6 +3958,7 @@ static GLfloat scripted_color[4] = { 0.0, 0.0, 0.0, 0.0}; // to be defined by s
}
// Exposed to AI.
- (void)setPrimaryRole:(NSString *)role
{
if (![role isEqual:primaryRole])

View File

@ -66,6 +66,8 @@ MA 02110-1301, USA.
// Methods used only by AI.
- (void) setStateTo:(NSString *)state;
- (void) pauseAI:(NSString *)intervalString;
- (void) randomPauseAI:(NSString *)intervalString;
@ -250,6 +252,7 @@ MA 02110-1301, USA.
@implementation ShipEntity (AI)
- (void) setAITo:(NSString *)aiString
{
[[self getAI] setStateMachine:aiString];
@ -323,6 +326,12 @@ MA 02110-1301, USA.
@implementation ShipEntity (PureAI)
- (void) setStateTo:(NSString *)state
{
[[self getAI] setState:state];
}
- (void) pauseAI:(NSString *)intervalString
{
[shipAI setNextThinkTime:[UNIVERSE getTime] + [intervalString doubleValue]];

View File

@ -104,7 +104,7 @@ enum
kShip_displayName, // name displayed on screen, string, read-only
kShip_roles, // roles, array, read-only
kShip_roleProbabilities, // roles and probabilities, dictionary, read-only
kShip_primaryRole, // Primary role, string, read-only
kShip_primaryRole, // Primary role, string, read/write
kShip_AI, // AI state machine name, string, read/write
kShip_AIState, // AI state machine state, string, read/write
kShip_fuel, // fuel, float, read/write