From f306c999c3a1f73c64a90c59b0c87917f0f91619 Mon Sep 17 00:00:00 2001 From: Giles Williams Date: Wed, 28 Jun 2006 16:06:49 +0000 Subject: [PATCH] introducing unpiloted entities (missiles, etc. that HAVE NO CREW and therefore do not communicate!) git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@623 127b21dd-08f5-0310-b4b7-95ae10353056 --- Resources/Config/shipdata.plist | 156 ++++++-------------------------- src/Core/ShipEntity.m | 10 +- 2 files changed, 35 insertions(+), 131 deletions(-) diff --git a/Resources/Config/shipdata.plist b/Resources/Config/shipdata.plist index c6fcc02e..49ea6347 100644 --- a/Resources/Config/shipdata.plist +++ b/Resources/Config/shipdata.plist @@ -532,6 +532,8 @@ CLASS_ROCK smooth + unpiloted + thrust 0.0 weapon_energy @@ -541,52 +543,10 @@ asteroid-alternative - ai_type - dumbAI.plist - bounty - 10 - cargo_type - CARGO_NOT_CARGO - energy_recharge_rate - 0.0 - forward_weapon_type - WEAPON_NONE - has_ecm - - has_escape_pod - - has_scoop - - likely_cargo - 0 - max_cargo - 0 - max_energy - 100 - max_flight_pitch - 0.10000000000000001 - max_flight_roll - 0.10000000000000001 - max_flight_speed - 0.0 - missiles - 0 + like_ship + asteroid model asteroid1.dat - name - Asteroid - roles - asteroid - scanClass - CLASS_ROCK - smooth - - thrust - 0.0 - weapon_energy - 0.0 - weapon_offset_x - 0.0 barrel @@ -622,6 +582,8 @@ cargopod 1t-cargopod thrust 0.0 + unpiloted + weapon_energy 0.0 weapon_offset_x @@ -933,6 +895,8 @@ thrust 0.0 + unpiloted + weapon_energy 0.0 weapon_offset_x @@ -940,52 +904,10 @@ boulder-alternative - ai_type - dumbAI.plist - bounty - 5 - cargo_type - CARGO_NOT_CARGO - energy_recharge_rate - 0.0 - forward_weapon_type - WEAPON_NONE - has_ecm - - has_escape_pod - - has_scoop - - likely_cargo - 0 - max_cargo - 0 - max_energy - 25 - max_flight_pitch - 0.5 - max_flight_roll - 0.5 - max_flight_speed - 5 - missiles - 0 + like_ship + boulder model boulder1.dat - name - Boulder - roles - boulder - scanClass - CLASS_ROCK - smooth - - thrust - 0.0 - weapon_energy - 0.0 - weapon_offset_x - 0.0 buoy @@ -1023,6 +945,8 @@ buoy thrust 100 + unpiloted + weapon_energy 0.0 weapon_offset_x @@ -1071,6 +995,8 @@ thrust 100 + unpiloted + weapon_energy 0.0 weapon_offset_x @@ -1136,6 +1062,8 @@ thrust 0.0 + unpiloted + cobra3-alternate @@ -2449,6 +2377,8 @@ CLASS_MISSILE thrust 250 + unpiloted + weapon_energy 4500 @@ -3278,6 +3208,8 @@ thrust 0.0 + unpiloted + weapon_energy 0.0 weapon_offset_x @@ -3285,50 +3217,10 @@ splinter-alternative - ai_type - dumbAI.plist - bounty - 1 - cargo_type - CARGO_MINERALS - energy_recharge_rate - 0.0 - forward_weapon_type - WEAPON_NONE - has_ecm - - has_escape_pod - - has_scoop - - likely_cargo - 0 - max_cargo - 0 - max_energy - 5 - max_flight_pitch - 1 - max_flight_roll - 1 - max_flight_speed - 10 - missiles - 0 + like_ship + splinter model splinter1.dat - name - Splinter - roles - splinter - smooth - - thrust - 0.0 - weapon_energy - 0.0 - weapon_offset_x - 0.0 strut @@ -3340,6 +3232,8 @@ Strut 10-10-30 roles strut + unpiloted + tharglet @@ -3981,6 +3875,8 @@ CLASS_MISSILE thrust 250 + unpiloted + weapon_energy 4500 diff --git a/src/Core/ShipEntity.m b/src/Core/ShipEntity.m index addc5366..11c9d3d9 100644 --- a/src/Core/ShipEntity.m +++ b/src/Core/ShipEntity.m @@ -1374,6 +1374,14 @@ static NSMutableDictionary* smallOctreeDict = nil; } } + // unpiloted (like missiles asteroids etc.) + if ([shipdict objectForKey:@"unpiloted"]) + { + GLfloat chance = [[shipdict objectForKey:@"unpiloted"] floatValue]; + if (randf() < chance) + [self setCrew:[NSArray array]]; // empty array + } + // debugging flags debug_flag = 0; if ([shipdict objectForKey:@"debug_flag"]) @@ -7370,7 +7378,7 @@ inline BOOL pairOK(NSString* my_role, NSString* their_role) Entity* switcher = [universe entityForUniversalID:switcher_id]; int rescuer_id = [(NSString*)[tokens objectAtIndex:2] intValue]; Entity* rescuer = [universe entityForUniversalID:rescuer_id]; - if ((switcher_id == primaryAggressor)&&(switcher_id == primaryTarget)&&(switcher)&&(rescuer)&&(rescuer->isShip)&&(thanked_ship_id != rescuer_id)&&(scan_class != CLASS_THARGOID)) + if ((switcher_id == primaryAggressor)&&(switcher_id == primaryTarget)&&(switcher)&&(rescuer)&&(rescuer->isShip)&&(thanked_ship_id != rescuer_id)&&(scan_class != CLASS_THARGOID)&&(crew != nil)&&([crew count] > 0)) { if (scan_class == CLASS_POLICE) [self sendExpandedMessage:@"[police-thanks-for-assist]" toShip:(ShipEntity*)rescuer];