mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-25 21:40:19 +00:00
Destroy weapons when ped gets destroyed
This commit is contained in:
parent
47bc30b0a9
commit
aca67f12a2
2 changed files with 14 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
|
||||
- don't add weapons for NPC peds
|
||||
|
||||
- when ped is killed, his weapons are not destroyed
|
||||
|
||||
|
||||
|
||||
# Potential problems
|
||||
|
|
Loading…
Reference in a new issue