3 static private const float SOUND_CONTACT_SKIP = 0.33;
10 private float m_SoundContactTickTime;
11 private bool m_IsMeleeWeapon =
false;
13 proto native InventoryItemType GetInventoryItemType();
16 proto native
void SwitchOn(
bool onOff);
18 proto native
bool IsOn();
21 proto native
void EnableCollisionsWithCharacter(
bool state);
22 proto native
bool HasCollisionsWithCharacter();
26 proto native
void ThrowPhysically(
DayZPlayer player,
vector force,
bool collideWithCharacters =
true);
31 proto native
void ForceFarBubble(
bool state);
37 if (ConfigIsExisting(
"isMeleeWeapon"))
38 m_IsMeleeWeapon = ConfigGetBool(
"isMeleeWeapon");
47 event bool OnUseFromInventory(Man owner)
56 if (!DescriptionOverride(temp))
57 temp = ConfigGetString(
"descriptionShort");
61 override bool IsInventoryItem()
71 int GetMeleeHeavyMode()
76 int GetMeleeSprintMode()
81 override bool IsMeleeWeapon()
83 return m_IsMeleeWeapon;
86 bool IsMeleeFinisher()
92 void PlayImpactSound(
float weight,
float velocity,
int surfaceHash)
94 if (!m_SoundImpactTable)
98 if (soundBuilder != null)
100 soundBuilder.AddVariable(
"weight", weight);
101 soundBuilder.AddVariable(
"speed", velocity);
104 SoundObject soundObject = soundBuilder.BuildSoundObject();
105 if (soundObject != null)
107 soundObject.SetKind(
WaveKind.WAVEEFFECTEX);
117 string soundImpactType =
"default";
118 if ( ConfigIsExisting(
"soundImpactType") )
119 soundImpactType = ConfigGetString(
"soundImpactType");
121 m_SoundImpactTable =
AnimSoundLookupTableBank.GetInstance().GetImpactTable(soundImpactType +
"_Impact_LookupTable");
140 AnimSoundEvent soundEvent = GetInventoryItemType().GetSoundEvent(
id);
144 SoundObject soundObject = builder.BuildSoundObject();
163 GetWorldBounds(mins, maxs);
164 vector size = maxs - mins;
166 vector add = impact.RelativeVelocityBefore.Normalized() * size.Length();
167 string surfaceImpact;
170 impact.Position + add,
171 impact.Position - add,
175 return surfaceImpact;
178 g_Game.SurfaceUnderObjectExCorrectedLiquid(
this, surface, surfaceImpact, liquid);
180 return surfaceImpact;
200 float impactVelocity = extra.RelativeVelocityBefore.Length();
201 if ( impactVelocity < 0.3 )
204 float tickTime =
g_Game.GetTickTime();
205 if ( m_SoundContactTickTime + SOUND_CONTACT_SKIP > tickTime )
209 if ( surfaceName ==
"" )
213 string infoText =
"Surface: " + surfaceName +
", Weight: " + weight +
", Speed: " + impactVelocity;
215 if ( s_ImpactSoundsInfo.Count() == 10 )
216 s_ImpactSoundsInfo.Remove(9);
218 s_ImpactSoundsInfo.InsertAt(infoText, 0);
221 m_SoundContactTickTime = tickTime;
223 surfaceHash = surfaceName.Hash();
224 return impactVelocity;
228 static void DrawImpacts()
230 DbgUI.Begin(
"Item impact sounds", 10, 200);
232 for (
int i = 0; i < s_ImpactSoundsInfo.Count(); ++i )
234 string line = (i + 1).
ToString() +
". " + s_ImpactSoundsInfo.Get(i);
string GetImpactSurfaceTypeEx(IEntity other, Contact impact, out int liquid)
string GetRuinedMeleeAmmoType()
returns ammo (projectile) used in melee if the item is destroyed. Override higher for specific use
void InitImpactSoundData()
float ProcessImpactSound(IEntity other, Contact extra, float weight, out int surfaceHash)
AbstractWave PlaySound(SoundObject so, SoundObjectBuilder sob)
void PlaySoundByAnimEvent(EAnimSoundEventID id)
float ProcessImpactSoundEx(IEntity other, Contact extra, float weight, out int surfaceHash, out int liquidType)
string GetImpactSurfaceType(IEntity other, Contact impact)
override void OnRightClick()
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
class AnimSoundObjectBuilderBank AnimSoundLookupTableBank()
proto native MeleeCombatData GetMeleeCombatData()
processes melee hit
class AbstractSoundScene SoundObjectBuilder(SoundParams soundParams)
vector GetPosition()
Get the world position of the Effect.