Destroy weapons when ped gets destroyed

This commit is contained in:
in0finite 2019-04-25 02:16:46 +02:00
parent 47bc30b0a9
commit aca67f12a2
2 changed files with 14 additions and 2 deletions

View file

@ -107,6 +107,20 @@ namespace SanAndreasUnity.Behaviours {
}
void OnDisable()
{
// destroy all weapons
// we won't call RemoveAllWeapons() because it causes complications - it calls SwitchWeapon(), which
// then calls StopFiring(), which then switches ped state, etc
// no special reason for using AllWeapons
foreach(var w in this.AllWeapons)
{
DestroyWeapon(w);
}
}
void Start ()
{
PlayerModel.onLateUpdate += this.UpdateWeaponTransform;

View file

@ -8,8 +8,6 @@
- don't add weapons for NPC peds
- when ped is killed, his weapons are not destroyed
# Potential problems