Changeset 10689 in orxonox.OLD for branches/adm/src
- Timestamp:
- Jun 13, 2007, 5:51:40 PM (18 years ago)
- Location:
- branches/adm/src/world_entities
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/adm/src/world_entities/WorldEntities.am
r10664 r10689 34 34 world_entities/weapons/spike_thrower.cc \ 35 35 world_entities/weapons/acid_launcher.cc \ 36 world_entities/weapons/bsp_weapon.cc \ 36 37 \ 37 38 world_entities/projectiles/lbolt.cc \ … … 187 188 weapons/spike_thrower.h \ 188 189 weapons/acid_launcher.h \ 190 weapons/bsp_weapon.h \ 189 191 \ 190 192 projectiles/lbolt.h \ -
branches/adm/src/world_entities/npcs/adm_turret.cc
r10688 r10689 139 139 this->bFire = false; 140 140 this->playerVisible = false; 141 142 141 143 } 142 144 … … 151 153 152 154 153 Vector playerPos = this->myTarget->getAbsCoor() ;155 Vector playerPos = this->myTarget->getAbsCoor() + Vector(0, 12, 0); 154 156 Vector ds = playerPos - ( this->cannons->getAbsCoor() ); 155 if ( isActive && ds.len() <= range ) 157 if ( isActive && ds.len() <= range && playerVisible ) 158 { 156 159 this->moveTowards( ds, dt); 160 161 //if target within +/- 2.5 degrees of aim -> fire 162 Vector dv1 = ds; 163 dv1.normalize(); 164 Vector dv2 = this->cannons->getAbsDir().apply( Vector(-1, 0, 0)); 165 dv2.normalize(); 166 float angle = dv1.dot(dv2); 167 if (angle > 0.999) 168 { 169 this->fire(); 170 } 171 } 157 172 else 158 173 this->moveTowards( Vector(0, -1, 0), dt ); … … 212 227 } 213 228 214 bool AdmTurret::isVisible(const WorldEntity myTarget)215 {216 return true;217 }218 219 float AdmTurret::aim(const WorldEntity Target)220 {221 return 0;222 }223 224 229 void AdmTurret::fire() 225 230 { 226 // Projectile* pj = this->getProjectile();227 // if (pj == NULL) return;228 229 //pj->setOwner(this->getOwner());230 //pj->setParent(PNode::getNullParent());231 //pj->setVelocity(this->getAbsDir().apply(Vector( , , )) );232 //pj->setAbsCoor(this->getEmissionPoint());233 //pj->setAbsDir(this->getAbsDir());234 //pj->activate();235 231 } 236 232 … … 245 241 246 242 this->cannons->toList( getOMListNumber() ); 243 244 this->weapon = new BspWeapon(); 245 this->weapon->setParent( this->cannons ); 246 this->weapon->toList( getOMListNumber() ); 247 this->weapon->setAbsCoor( this->cannons->getAbsCoor() ); 248 this->weapon->setAbsDir( this->weapon->getAbsDir() * Quaternion( PI, Vector(0, 1, 0) ) ); 247 249 } 248 250 … … 257 259 this->sensor->toList( getOMListNumber() ); 258 260 } 259 260 261 261 262 void AdmTurret::moveTowards( Vector targetDir, float dt ) … … 336 337 Vector dir = this->myTarget->getAbsCoor() - pos; 337 338 339 338 340 this->playerVisible = true; 339 341 for( ObjectList<BspEntity>::const_iterator bspIterator = BspEntity::objectList().begin(); -
branches/adm/src/world_entities/npcs/adm_turret.h
r10688 r10689 11 11 12 12 #include "world_entity.h" 13 #include "weapons/ light_blaster.h"13 #include "weapons/bsp_weapon.h" 14 14 15 15 class AdmTurret : public WorldEntity … … 37 37 WorldEntity* sensor; 38 38 WorldEntity* myTarget; 39 bool isVisible(const WorldEntity myTarget);40 float aim(const WorldEntity Target);41 39 void fire(); 42 40 … … 58 56 bool playerVisible; 59 57 void updatePlayerVisible(); 58 59 BspWeapon* weapon; 60 60 }; 61 61 -
branches/adm/src/world_entities/weapons/aiming_system.cc
r10013 r10689 112 112 void AimingSystem::hit(float damage, WorldEntity* killer) 113 113 { 114 if( this->owner != killer )114 if( this->owner != killer && killer != this && !killer->isA( AimingSystem::staticClassID() ) ) 115 115 { 116 116 //PRINTF(0)("real hit: %s\n", killer->getClassCName()); … … 127 127 void AimingSystem::tick(float dt) 128 128 { 129 130 131 129 } 132 130
Note: See TracChangeset
for help on using the changeset viewer.