mirror of
https://github.com/Pinsplash/halflife2chaos.git
synced 2024-10-30 07:42:31 +01:00
dropships now have a random crate type and fixed dropship gun bug
closes #8
This commit is contained in:
parent
aaaf533f6c
commit
ea21c72518
@ -6187,12 +6187,11 @@ CAI_BaseNPC *CChaosEffect::ChaosSpawnNPC(const char *className, string_t strActu
|
|||||||
pNPC->SetAbsOrigin(vecOrigin);
|
pNPC->SetAbsOrigin(vecOrigin);
|
||||||
pNPC->SetAbsAngles(vecAngles);
|
pNPC->SetAbsAngles(vecAngles);
|
||||||
pNPC->m_bEvil = bEvil;
|
pNPC->m_bEvil = bEvil;
|
||||||
if (FStrEq(className, "npc_alyx")){ pNPC->KeyValue("ShouldHaveEMP", "1"); }
|
if (FStrEq(className, "npc_alyx")) pNPC->KeyValue("ShouldHaveEMP", "1");
|
||||||
if (FStrEq(className, "npc_combinedropship")){ pNPC->KeyValue("CrateType", "1"); }//TODO: random crate type
|
if (FStrEq(className, "npc_cscanner")) pNPC->KeyValue("ShouldInspect", "1");
|
||||||
if (FStrEq(className, "npc_cscanner")){ pNPC->KeyValue("ShouldInspect", "1"); }
|
if (FStrEq(className, "npc_sniper")) pNPC->AddSpawnFlags(65536);
|
||||||
if (FStrEq(className, "npc_sniper")){ pNPC->AddSpawnFlags(65536); }
|
if (FStrEq(className, "npc_strider")) pNPC->AddSpawnFlags(65536);
|
||||||
if (FStrEq(className, "npc_strider")){ pNPC->AddSpawnFlags(65536); }
|
if (FStrEq(className, "npc_vortigaunt")) pNPC->KeyValue("ArmorRechargeEnabled", "1");
|
||||||
if (FStrEq(className, "npc_vortigaunt")){ pNPC->KeyValue("ArmorRechargeEnabled", "1"); }
|
|
||||||
if (FStrEq(className, "npc_apcdriver"))
|
if (FStrEq(className, "npc_apcdriver"))
|
||||||
{
|
{
|
||||||
pNPC->KeyValue("vehicle", "apc");
|
pNPC->KeyValue("vehicle", "apc");
|
||||||
@ -6230,65 +6229,104 @@ CAI_BaseNPC *CChaosEffect::ChaosSpawnNPC(const char *className, string_t strActu
|
|||||||
if (random->RandomInt(0, 1) == 1)//ammo resupplier
|
if (random->RandomInt(0, 1) == 1)//ammo resupplier
|
||||||
{
|
{
|
||||||
float nRandom = random->RandomInt(0, 10);
|
float nRandom = random->RandomInt(0, 10);
|
||||||
if (nRandom == 0){ pNPC->KeyValue("ammosupply", "AR2"); }
|
if (nRandom == 0) pNPC->KeyValue("ammosupply", "AR2");
|
||||||
if (nRandom == 1){ pNPC->KeyValue("ammosupply", "Pistol"); }
|
if (nRandom == 1) pNPC->KeyValue("ammosupply", "Pistol");
|
||||||
if (nRandom == 2){ pNPC->KeyValue("ammosupply", "SMG1"); }
|
if (nRandom == 2) pNPC->KeyValue("ammosupply", "SMG1");
|
||||||
if (nRandom == 3){ pNPC->KeyValue("ammosupply", "357"); }
|
if (nRandom == 3) pNPC->KeyValue("ammosupply", "357");
|
||||||
if (nRandom == 4){ pNPC->KeyValue("ammosupply", "XBowBolt"); }
|
if (nRandom == 4) pNPC->KeyValue("ammosupply", "XBowBolt");
|
||||||
if (nRandom == 5){ pNPC->KeyValue("ammosupply", "Buckshot"); }
|
if (nRandom == 5) pNPC->KeyValue("ammosupply", "Buckshot");
|
||||||
if (nRandom == 6){ pNPC->KeyValue("ammosupply", "RPG_Round"); }
|
if (nRandom == 6) pNPC->KeyValue("ammosupply", "RPG_Round");
|
||||||
if (nRandom == 7){ pNPC->KeyValue("ammosupply", "SMG1_Grenade"); }
|
if (nRandom == 7) pNPC->KeyValue("ammosupply", "SMG1_Grenade");
|
||||||
if (nRandom == 8){ pNPC->KeyValue("ammosupply", "Grenade"); }
|
if (nRandom == 8) pNPC->KeyValue("ammosupply", "Grenade");
|
||||||
if (nRandom == 9){ pNPC->KeyValue("ammosupply", "Battery"); }
|
if (nRandom == 9) pNPC->KeyValue("ammosupply", "Battery");
|
||||||
if (nRandom == 10){ pNPC->KeyValue("ammosupply", "AR2AltFire"); }
|
if (nRandom == 10) pNPC->KeyValue("ammosupply", "AR2AltFire");
|
||||||
pNPC->AddSpawnFlags(524288);
|
pNPC->AddSpawnFlags(524288);
|
||||||
pNPC->KeyValue("ammoamount", "100");
|
pNPC->KeyValue("ammoamount", "100");
|
||||||
}
|
}
|
||||||
float nRandom = random->RandomInt(0, 6);//weapon
|
int nRandom = random->RandomInt(0, 6);//weapon
|
||||||
if (nRandom == 0){ pNPC->KeyValue("additionalequipment", "weapon_ar2"); }
|
if (nRandom == 0) pNPC->KeyValue("additionalequipment", "weapon_ar2");
|
||||||
if (nRandom == 1){ pNPC->KeyValue("additionalequipment", "weapon_citizenpackage"); }
|
if (nRandom == 1) pNPC->KeyValue("additionalequipment", "weapon_citizenpackage");
|
||||||
if (nRandom == 2){ pNPC->KeyValue("additionalequipment", "weapon_citizensuitcase"); }
|
if (nRandom == 2) pNPC->KeyValue("additionalequipment", "weapon_citizensuitcase");
|
||||||
if (nRandom == 3){ pNPC->KeyValue("additionalequipment", "weapon_crowbar"); }
|
if (nRandom == 3) pNPC->KeyValue("additionalequipment", "weapon_crowbar");
|
||||||
if (nRandom == 4){ pNPC->KeyValue("additionalequipment", "weapon_rpg"); }
|
if (nRandom == 4) pNPC->KeyValue("additionalequipment", "weapon_rpg");
|
||||||
if (nRandom == 5){ pNPC->KeyValue("additionalequipment", "weapon_shotgun"); }
|
if (nRandom == 5) pNPC->KeyValue("additionalequipment", "weapon_shotgun");
|
||||||
if (nRandom == 6){ pNPC->KeyValue("additionalequipment", "weapon_smg1"); }
|
if (nRandom == 6) pNPC->KeyValue("additionalequipment", "weapon_smg1");
|
||||||
|
|
||||||
nRandom = random->RandomInt(0, 3);//clothing
|
nRandom = random->RandomInt(0, 3);//clothing
|
||||||
if (nRandom == 0){ pNPC->KeyValue("citizentype", "0"); }
|
if (nRandom == 0) pNPC->KeyValue("citizentype", "0");
|
||||||
if (nRandom == 1){ pNPC->KeyValue("citizentype", "1"); }
|
if (nRandom == 1) pNPC->KeyValue("citizentype", "1");
|
||||||
if (nRandom == 2){ pNPC->KeyValue("citizentype", "2"); }
|
if (nRandom == 2) pNPC->KeyValue("citizentype", "2");
|
||||||
if (nRandom == 3){ pNPC->KeyValue("citizentype", "3"); }
|
if (nRandom == 3) pNPC->KeyValue("citizentype", "3");
|
||||||
|
|
||||||
pNPC->KeyValue("expressiontype", "0");
|
pNPC->KeyValue("expressiontype", "0");
|
||||||
}
|
}
|
||||||
if (FStrEq(className, "npc_combine_s"))
|
if (FStrEq(className, "npc_combine_s"))
|
||||||
{
|
{
|
||||||
pNPC->KeyValue("NumGrenades", "100");
|
pNPC->KeyValue("NumGrenades", "100");
|
||||||
float nRandom = random->RandomInt(0, 2);//model/elite status
|
int nRandom = random->RandomInt(0, 2);//model/elite status
|
||||||
if (nRandom == 0){ pNPC->KeyValue("model", "models/combine_soldier.mdl"); }
|
if (nRandom == 0) pNPC->KeyValue("model", "models/combine_soldier.mdl");
|
||||||
if (nRandom == 1){ pNPC->KeyValue("model", "models/combine_super_soldier.mdl"); }
|
if (nRandom == 1) pNPC->KeyValue("model", "models/combine_super_soldier.mdl");
|
||||||
if (nRandom == 2){ pNPC->KeyValue("model", "models/combine_soldier_prisonguard.mdl"); }
|
if (nRandom == 2) pNPC->KeyValue("model", "models/combine_soldier_prisonguard.mdl");
|
||||||
|
|
||||||
nRandom = random->RandomInt(0, 2);//weapon
|
nRandom = random->RandomInt(0, 2);//weapon
|
||||||
if (nRandom == 0){ pNPC->KeyValue("additionalequipment", "weapon_ar2"); }
|
if (nRandom == 0) pNPC->KeyValue("additionalequipment", "weapon_ar2");
|
||||||
if (nRandom == 1){ pNPC->KeyValue("additionalequipment", "weapon_shotgun"); }
|
if (nRandom == 1) pNPC->KeyValue("additionalequipment", "weapon_shotgun");
|
||||||
if (nRandom == 2){ pNPC->KeyValue("additionalequipment", "weapon_smg1"); }
|
if (nRandom == 2) pNPC->KeyValue("additionalequipment", "weapon_smg1");
|
||||||
|
}
|
||||||
|
if (FStrEq(className, "npc_combinedropship"))
|
||||||
|
{
|
||||||
|
int nRandom = 1;// random->RandomInt(-3, 1);//cargo type. avoid 0 cause that does nothing
|
||||||
|
Msg("crate type %i\n", nRandom);
|
||||||
|
if (nRandom == -3) pNPC->KeyValue("CrateType", "-3");//jeep
|
||||||
|
if (nRandom == -2)//apc
|
||||||
|
{
|
||||||
|
pNPC->KeyValue("CrateType", "-2");
|
||||||
|
ChaosSpawnVehicle("prop_vehicle_apc", strActualName, SPAWNTYPE_VEHICLE, "models/combine_apc.mdl", "chaos_dropship_apc", "scripts/vehicles/apc_npc.txt");
|
||||||
|
pNPC->KeyValue("APCVehicleName", "chaos_dropship_apc");
|
||||||
|
variant_t emptyVariant;
|
||||||
|
g_EventQueue.AddEvent("combinedropship", "DropAPC", emptyVariant, 1, pNPC, pNPC);
|
||||||
|
}
|
||||||
|
if (nRandom == -1)//strider
|
||||||
|
{
|
||||||
|
pNPC->KeyValue("CrateType", "-1");
|
||||||
|
variant_t emptyVariant;
|
||||||
|
g_EventQueue.AddEvent("combinedropship", "DropStrider", emptyVariant, 1, pNPC, pNPC);
|
||||||
|
}
|
||||||
|
if (nRandom == 0) pNPC->KeyValue("CrateType", "2");//nothing
|
||||||
|
if (nRandom == 1)//soldier crate
|
||||||
|
{
|
||||||
|
pNPC->KeyValue("CrateType", "1");
|
||||||
|
pNPC->KeyValue("GunRange", "2000");
|
||||||
|
//soldiers are spawned in CNPC_CombineDropship::SpawnTroop
|
||||||
|
CBaseEntity *pTarget = CreateEntityByName("info_target");
|
||||||
|
pTarget->KeyValue("targetname", "dropship_target");
|
||||||
|
pTarget->SetAbsOrigin(vecOrigin);
|
||||||
|
pTarget->SetAbsAngles(vecAngles);
|
||||||
|
DispatchSpawn(pTarget);
|
||||||
|
pNPC->KeyValue("LandTarget", "dropship_target");
|
||||||
|
variant_t variant;
|
||||||
|
variant.SetInt(6);
|
||||||
|
if (random->RandomInt(0, 1))
|
||||||
|
g_EventQueue.AddEvent("combinedropship", "LandLeaveCrate", variant, 1, pNPC, pNPC);
|
||||||
|
else
|
||||||
|
g_EventQueue.AddEvent("combinedropship", "LandTakeCrate", variant, 1, pNPC, pNPC);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (FStrEq(className, "npc_metropolice"))
|
if (FStrEq(className, "npc_metropolice"))
|
||||||
{
|
{
|
||||||
pNPC->KeyValue("manhacks", "100");
|
pNPC->KeyValue("manhacks", "100");
|
||||||
|
|
||||||
float nRandom = random->RandomInt(0, 2);//weapon
|
int nRandom = random->RandomInt(0, 2);//weapon
|
||||||
if (nRandom == 0){ pNPC->KeyValue("additionalequipment", "weapon_smg1"); }
|
if (nRandom == 0) pNPC->KeyValue("additionalequipment", "weapon_smg1");
|
||||||
if (nRandom == 1){ pNPC->KeyValue("additionalequipment", "weapon_pistol"); }
|
if (nRandom == 1) pNPC->KeyValue("additionalequipment", "weapon_pistol");
|
||||||
if (nRandom == 2){ pNPC->KeyValue("additionalequipment", "weapon_stunstick"); }
|
if (nRandom == 2) pNPC->KeyValue("additionalequipment", "weapon_stunstick");
|
||||||
}
|
}
|
||||||
if (FStrEq(className, "npc_stalker"))
|
if (FStrEq(className, "npc_stalker"))
|
||||||
{
|
{
|
||||||
float nRandom = random->RandomInt(0, 2);
|
int nRandom = random->RandomInt(0, 2);
|
||||||
if (nRandom == 0){ pNPC->KeyValue("BeamPower", "0"); }
|
if (nRandom == 0) pNPC->KeyValue("BeamPower", "0");
|
||||||
if (nRandom == 1){ pNPC->KeyValue("BeamPower", "1"); }
|
if (nRandom == 1) pNPC->KeyValue("BeamPower", "1");
|
||||||
if (nRandom == 2){ pNPC->KeyValue("BeamPower", "2"); }
|
if (nRandom == 2) pNPC->KeyValue("BeamPower", "2");
|
||||||
}
|
}
|
||||||
if (FStrEq(className, "npc_turret_ceiling"))
|
if (FStrEq(className, "npc_turret_ceiling"))
|
||||||
{
|
{
|
||||||
|
@ -385,12 +385,10 @@ void CNPC_CombineDropship::PopulatePoseParameters( void )
|
|||||||
{
|
{
|
||||||
if (!m_sbStaticPoseParamsLoaded)
|
if (!m_sbStaticPoseParamsLoaded)
|
||||||
{
|
{
|
||||||
m_poseBody_Accel = LookupPoseParameter( "body_accel");
|
m_poseBody_Accel = LookupPoseParameter("body_accel");
|
||||||
m_poseBody_Sway = LookupPoseParameter( "body_sway" );
|
m_poseBody_Sway = LookupPoseParameter("body_sway");
|
||||||
m_poseCargo_Body_Accel = LookupPoseParameter( "cargo_body_accel" );
|
m_poseCargo_Body_Accel = LookupPoseParameter("cargo_body_accel");
|
||||||
m_poseCargo_Body_Sway = LookupPoseParameter( "cargo_body_sway" );
|
m_poseCargo_Body_Sway = LookupPoseParameter("cargo_body_sway");
|
||||||
m_poseWeapon_Pitch = LookupPoseParameter( "weapon_pitch" );
|
|
||||||
m_poseWeapon_Yaw = LookupPoseParameter( "weapon_yaw" );
|
|
||||||
|
|
||||||
m_sbStaticPoseParamsLoaded = true;
|
m_sbStaticPoseParamsLoaded = true;
|
||||||
}
|
}
|
||||||
@ -2390,7 +2388,7 @@ void CNPC_CombineDropship::SpawnTroop( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Are we fully unloaded? If so, take off. Otherwise, tell the next troop to exit.
|
// Are we fully unloaded? If so, take off. Otherwise, tell the next troop to exit.
|
||||||
if ( m_iCurrentTroopExiting >= m_soldiersToDrop || m_sNPCTemplateData[m_iCurrentTroopExiting] == NULL_STRING )
|
if ((m_iCurrentTroopExiting >= m_soldiersToDrop || m_sNPCTemplateData[m_iCurrentTroopExiting] == NULL_STRING) && !m_bChaosSpawned)
|
||||||
{
|
{
|
||||||
// We're done, take off.
|
// We're done, take off.
|
||||||
m_flTimeTakeOff = gpGlobals->curtime + 0.5;
|
m_flTimeTakeOff = gpGlobals->curtime + 0.5;
|
||||||
@ -2445,7 +2443,29 @@ void CNPC_CombineDropship::SpawnTroop( void )
|
|||||||
|
|
||||||
// Spawn the templated NPC
|
// Spawn the templated NPC
|
||||||
CBaseEntity *pEntity = NULL;
|
CBaseEntity *pEntity = NULL;
|
||||||
MapEntity_ParseEntity( pEntity, STRING(m_sNPCTemplateData[m_iCurrentTroopExiting]), NULL );
|
if (m_bChaosSpawned)
|
||||||
|
{
|
||||||
|
//make them on the fly, since using the template system requires the given entity to be in the BSP, apparently
|
||||||
|
pEntity = CreateEntityByName("npc_combine_s");
|
||||||
|
pEntity->KeyValue("NumGrenades", "100");
|
||||||
|
int nRandom = random->RandomInt(0, 2);//model/elite status
|
||||||
|
if (nRandom == 0) pEntity->KeyValue("model", "models/combine_soldier.mdl");
|
||||||
|
if (nRandom == 1) pEntity->KeyValue("model", "models/combine_super_soldier.mdl");
|
||||||
|
if (nRandom == 2) pEntity->KeyValue("model", "models/combine_soldier_prisonguard.mdl");
|
||||||
|
nRandom = random->RandomInt(0, 2);//weapon
|
||||||
|
if (nRandom == 0) pEntity->KeyValue("additionalequipment", "weapon_ar2");
|
||||||
|
if (nRandom == 1) pEntity->KeyValue("additionalequipment", "weapon_shotgun");
|
||||||
|
if (nRandom == 2) pEntity->KeyValue("additionalequipment", "weapon_smg1");
|
||||||
|
g_iChaosSpawnCount++;
|
||||||
|
char szName[2048];
|
||||||
|
Q_snprintf(szName, sizeof(szName), "chaos_dropship_soldier%i", g_iChaosSpawnCount);
|
||||||
|
pEntity->KeyValue("targetname", szName);
|
||||||
|
pEntity->CBaseEntity::KeyValue("chaosid", g_iChaosSpawnCount);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MapEntity_ParseEntity(pEntity, STRING(m_sNPCTemplateData[m_iCurrentTroopExiting]), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
// Increment troop count
|
// Increment troop count
|
||||||
m_iCurrentTroopExiting++;
|
m_iCurrentTroopExiting++;
|
||||||
@ -2821,7 +2841,9 @@ void CNPC_CombineDropship::DoCombatStuff( void )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CNPC_CombineDropship::UpdateContainerGunFacing( Vector &vecMuzzle, Vector &vecToTarget, Vector &vecAimDir, float *flTargetRange )
|
void CNPC_CombineDropship::UpdateContainerGunFacing( Vector &vecMuzzle, Vector &vecToTarget, Vector &vecAimDir, float *flTargetRange )
|
||||||
{
|
{
|
||||||
Assert( m_hContainer );
|
Assert(m_hContainer);
|
||||||
|
m_poseWeapon_Pitch = m_hContainer->LookupPoseParameter("weapon_pitch");
|
||||||
|
m_poseWeapon_Yaw = m_hContainer->LookupPoseParameter("weapon_yaw");
|
||||||
|
|
||||||
// Get the desired aim vector
|
// Get the desired aim vector
|
||||||
vecToTarget = GetEnemy()->WorldSpaceCenter( );
|
vecToTarget = GetEnemy()->WorldSpaceCenter( );
|
||||||
|
Loading…
Reference in New Issue
Block a user