mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-04-20 16:32:30 +03:00
Shadow Walker: Fixed bug that replaced custom weapons with crowbars upon loading a saved game
This commit is contained in:
parent
f39b752adc
commit
4368e27adf
22
sp/game/mod_episodic/scripts/weapon_custommelee.txt
Normal file
22
sp/game/mod_episodic/scripts/weapon_custommelee.txt
Normal file
@ -0,0 +1,22 @@
|
||||
// Custom melee weapon - used by npc_shadow_walker for weapon model overrides
|
||||
WeaponData
|
||||
{
|
||||
// This will be replaced in code
|
||||
"playermodel" "models/weapons/w_crowbar.mdl"
|
||||
|
||||
"anim_prefix" "crowbar"
|
||||
|
||||
"clip_size" "-1"
|
||||
"primary_ammo" "None"
|
||||
"secondary_ammo" "None"
|
||||
|
||||
"weight" "0"
|
||||
"item_flags" "0"
|
||||
|
||||
// Sounds for the weapon. There is a max of 16 sounds per category (i.e. max 16 "single_shot" sounds)
|
||||
SoundData
|
||||
{
|
||||
"melee_hit_world" "Weapon_Crowbar.Melee_HitWorld"
|
||||
}
|
||||
|
||||
}
|
24
sp/game/mod_episodic/scripts/weapon_manifest.txt
Normal file
24
sp/game/mod_episodic/scripts/weapon_manifest.txt
Normal file
@ -0,0 +1,24 @@
|
||||
weapon_manifest
|
||||
{
|
||||
"file" "scripts/weapon_357.txt"
|
||||
"file" "scripts/weapon_alyxgun.txt"
|
||||
"file" "scripts/weapon_annabelle.txt"
|
||||
"file" "scripts/weapon_ar2.txt"
|
||||
"file" "scripts/weapon_bugbait.txt"
|
||||
"file" "scripts/weapon_citizenpackage.txt"
|
||||
"file" "scripts/weapon_citizensuitcase.txt"
|
||||
"file" "scripts/weapon_crossbow.txt"
|
||||
"file" "scripts/weapon_crowbar.txt"
|
||||
"file" "scripts/weapon_cubemap.txt"
|
||||
"file" "scripts/weapon_frag.txt"
|
||||
"file" "scripts/weapon_physcannon.txt"
|
||||
"file" "scripts/weapon_physgun.txt"
|
||||
"file" "scripts/weapon_pistol.txt"
|
||||
"file" "scripts/weapon_rpg.txt"
|
||||
"file" "scripts/weapon_shotgun.txt"
|
||||
"file" "scripts/weapon_smg1.txt"
|
||||
"file" "scripts/weapon_stunstick.txt"
|
||||
|
||||
// Custom
|
||||
"file" "scripts/weapon_custommelee.txt"
|
||||
}
|
@ -127,12 +127,13 @@ void CNPC_ShadowWalker::FixupWeapon()
|
||||
// If no weapons supplied, give a crowbar
|
||||
CBaseCombatWeapon *pWeapon = GetActiveWeapon();
|
||||
if (pWeapon == NULL) {
|
||||
CWeaponCustomMelee * pMeleeWeapon = (CWeaponCustomMelee *)CREATE_UNSAVED_ENTITY(CWeaponCustomMelee, "weapon_crowbar");
|
||||
CWeaponCustomMelee *pMeleeWeapon = (CWeaponCustomMelee*)CreateEntityByName("weapon_custommelee");
|
||||
|
||||
// Apply weapon model override
|
||||
if (&m_iszWeaponModelName && m_iszWeaponModelName != MAKE_STRING("")) {
|
||||
pMeleeWeapon->m_iszWeaponModelName = this->m_iszWeaponModelName;
|
||||
}
|
||||
// Default custom weapon model
|
||||
else {
|
||||
pMeleeWeapon->m_iszWeaponModelName = MAKE_STRING("models/props_canal/mattpipe.mdl");
|
||||
}
|
||||
|
@ -40,19 +40,19 @@ class CNPC_ShadowWalker : public CAI_CustomNPCBase
|
||||
DECLARE_CLASS(CNPC_ShadowWalker, CAI_CustomNPCBase);
|
||||
|
||||
public:
|
||||
void Precache(void);
|
||||
void Spawn(void);
|
||||
Class_T Classify(void);
|
||||
virtual int SelectFailSchedule(int failedSchedule, int failedTask, AI_TaskFailureCode_t taskFailCode);
|
||||
virtual int SelectScheduleRetrieveItem();
|
||||
virtual int SelectScheduleWander();
|
||||
virtual int SelectSchedule();
|
||||
virtual int SelectIdleSchedule();
|
||||
virtual int SelectAlertSchedule();
|
||||
virtual int SelectCombatSchedule();
|
||||
virtual float GetSequenceGroundSpeed(CStudioHdr *pStudioHdr, int iSequence);
|
||||
virtual Activity NPC_TranslateActivity(Activity eNewActivity);
|
||||
virtual int TranslateSchedule(int scheduleType);
|
||||
void Precache(void);
|
||||
void Spawn(void);
|
||||
Class_T Classify(void);
|
||||
virtual int SelectFailSchedule(int failedSchedule, int failedTask, AI_TaskFailureCode_t taskFailCode);
|
||||
virtual int SelectScheduleRetrieveItem();
|
||||
virtual int SelectScheduleWander();
|
||||
virtual int SelectSchedule();
|
||||
virtual int SelectIdleSchedule();
|
||||
virtual int SelectAlertSchedule();
|
||||
virtual int SelectCombatSchedule();
|
||||
virtual float GetSequenceGroundSpeed(CStudioHdr *pStudioHdr, int iSequence);
|
||||
virtual Activity NPC_TranslateActivity(Activity eNewActivity);
|
||||
virtual int TranslateSchedule(int scheduleType);
|
||||
|
||||
// Sounds
|
||||
virtual void PlaySound(string_t soundname, bool optional);
|
||||
@ -64,42 +64,42 @@ public:
|
||||
virtual void LostEnemySound(void) { PlaySound(m_iszLostEnemySound, false); };
|
||||
virtual void FoundEnemySound(void);
|
||||
|
||||
void Activate();
|
||||
void FixupWeapon();
|
||||
void Activate();
|
||||
void FixupWeapon();
|
||||
|
||||
// Inputs
|
||||
virtual void InputSetSpeedModifier(inputdata_t &inputdata);
|
||||
virtual void InputEnableOpenDoors(inputdata_t &inputdata);
|
||||
virtual void InputDisableOpenDoors(inputdata_t &inputdata);
|
||||
virtual void InputEnablePickupWeapons(inputdata_t &inputdata);
|
||||
virtual void InputDisablePickupWeapons(inputdata_t &inputdata);
|
||||
virtual void InputSetSpeedModifier(inputdata_t &inputdata);
|
||||
virtual void InputEnableOpenDoors(inputdata_t &inputdata);
|
||||
virtual void InputDisableOpenDoors(inputdata_t &inputdata);
|
||||
virtual void InputEnablePickupWeapons(inputdata_t &inputdata);
|
||||
virtual void InputDisablePickupWeapons(inputdata_t &inputdata);
|
||||
|
||||
DECLARE_DATADESC();
|
||||
|
||||
string_t m_iszWeaponModelName; // Path/filename of model to override weapon model.
|
||||
string_t m_iszWeaponModelName; // Path/filename of model to override weapon model.
|
||||
|
||||
string_t m_iszFearSound; // Path/filename of WAV file to play.
|
||||
string_t m_iszDeathSound; // Path/filename of WAV file to play.
|
||||
string_t m_iszIdleSound; // Path/filename of WAV file to play.
|
||||
string_t m_iszPainSound; // Path/filename of WAV file to play.
|
||||
string_t m_iszAlertSound; // Path/filename of WAV file to play.
|
||||
string_t m_iszLostEnemySound; // Path/filename of WAV file to play.
|
||||
string_t m_iszFoundEnemySound; // Path/filename of WAV file to play.
|
||||
string_t m_iszFearSound; // Path/filename of WAV file to play.
|
||||
string_t m_iszDeathSound; // Path/filename of WAV file to play.
|
||||
string_t m_iszIdleSound; // Path/filename of WAV file to play.
|
||||
string_t m_iszPainSound; // Path/filename of WAV file to play.
|
||||
string_t m_iszAlertSound; // Path/filename of WAV file to play.
|
||||
string_t m_iszLostEnemySound; // Path/filename of WAV file to play.
|
||||
string_t m_iszFoundEnemySound; // Path/filename of WAV file to play.
|
||||
|
||||
DEFINE_CUSTOM_AI;
|
||||
|
||||
private:
|
||||
bool HasRangedWeapon();
|
||||
void PrecacheNPCSoundScript(string_t* SoundName, string_t defaultSoundName);
|
||||
bool HasRangedWeapon();
|
||||
void PrecacheNPCSoundScript(string_t* SoundName, string_t defaultSoundName);
|
||||
|
||||
|
||||
bool m_bUseBothSquadSlots; // If true use two squad slots, if false use one squad slot
|
||||
bool m_bCannotOpenDoors; // If true, this NPC cannot open doors. The condition is reversed because originally it could.
|
||||
bool m_bCanPickupWeapons; // If true, this NPC is able to pick up weapons off of the ground just like npc_citizen.
|
||||
bool m_bWanderToggle; // Boolean to toggle wandering / standing every think cycle
|
||||
float m_flNextSoundTime; // Next time at which this NPC is allowed to play an NPC sound
|
||||
float m_flNextFoundEnemySoundTime; // Next time at which this NPC is allowed to play an NPC sound
|
||||
float m_flSpeedModifier; // Modifier to apply to move distance
|
||||
bool m_bUseBothSquadSlots; // If true use two squad slots, if false use one squad slot
|
||||
bool m_bCannotOpenDoors; // If true, this NPC cannot open doors. The condition is reversed because originally it could.
|
||||
bool m_bCanPickupWeapons; // If true, this NPC is able to pick up weapons off of the ground just like npc_citizen.
|
||||
bool m_bWanderToggle; // Boolean to toggle wandering / standing every think cycle
|
||||
float m_flNextSoundTime; // Next time at which this NPC is allowed to play an NPC sound
|
||||
float m_flNextFoundEnemySoundTime; // Next time at which this NPC is allowed to play an NPC sound
|
||||
float m_flSpeedModifier; // Modifier to apply to move distance
|
||||
};
|
||||
|
||||
|
||||
|
@ -15,14 +15,21 @@ class CWeaponCustomMelee : public CWeaponCrowbar
|
||||
DECLARE_CLASS(CWeaponCustomMelee, CWeaponCrowbar);
|
||||
|
||||
const char *GetWorldModel() const { return m_iszWeaponModelName.ToCStr(); }
|
||||
void SetPickupTouch(void) { /* do nothing */ }
|
||||
virtual void Drop(const Vector &vecVelocity);
|
||||
public:
|
||||
string_t m_iszWeaponModelName;
|
||||
|
||||
DECLARE_DATADESC();
|
||||
|
||||
};
|
||||
|
||||
void CWeaponCustomMelee::Drop(const Vector &vecVelocity)
|
||||
{
|
||||
BaseClass::Drop(vecVelocity);
|
||||
AddSpawnFlags(SF_WEAPON_NO_PLAYER_PICKUP);
|
||||
}
|
||||
|
||||
LINK_ENTITY_TO_CLASS(weapon_custommelee, CWeaponCustomMelee);
|
||||
|
||||
BEGIN_DATADESC(CWeaponCustomMelee)
|
||||
DEFINE_FIELD(m_iszWeaponModelName, FIELD_STRING)
|
||||
DEFINE_FIELD(m_iszWeaponModelName, FIELD_STRING)
|
||||
END_DATADESC()
|
||||
|
Loading…
x
Reference in New Issue
Block a user