DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ SnapOnObject()

void SnapOnObject ( EntityAI victim)
protected

См. определение в файле TrapBase.c строка 225

226 {
227 if ( g_Game.IsServer() )
228 {
229 if ( m_Timer )
230 {
231 m_Timer.Stop();
232 }
233
234 RefreshState();
235
236 if (m_DamagePlayers > 0)
237 {
238 if (victim)
239 {
240 if ( victim.IsInherited(SurvivorBase))
241 {
242 victim.DecreaseHealth("", "", m_DamagePlayers);
243 }
244 else if (victim.IsInherited(DayZCreatureAI))
245 {
246 victim.DecreaseHealth("", "", m_DamageOthers);
247 }
248 else if (victim.IsInherited(ItemBase))
249 {
250 ItemBase victim_item = ItemBase.Cast(victim);
251 float damage_coef = 1;
252
253 if (victim_item.HasQuantity() && victim_item.GetQuantityMax() != 0 && victim_item.GetQuantity() > 0)
254 {
255 damage_coef = victim_item.GetQuantityMax() / victim_item.GetQuantity(); // Lower quantity increases damage exposure
256 }
257
258 if (damage_coef > 0)
259 {
260 int item_size_x = 1;
261 int item_size_y = 1;
262 g_Game.GetInventoryItemSize(victim_item, item_size_x, item_size_y);
263
264 float add_damage = 300 * damage_coef / Math.Clamp(item_size_x * item_size_y, 1, int.MAX);
265 victim_item.DecreaseHealth("", "", add_damage);
266 }
267 }
268 }
269 }
270
271 Synch(victim);
272 }
273
274 OnSteppedOn(victim);
275 }
DayZGame g_Game
Определения DayZGame.c:4074
ref Timer m_Timer
Определения DayZGame.c:723
const int MAX
Определения EnConvert.c:27
void Synch(EntityAI victim)
keeping "step" here for consistency only
Определения TrapBase.c:290
void RefreshState()
Определения TrapBase.c:330
void OnSteppedOn(EntityAI victim)
Определения TrapBase.c:282
float m_DamagePlayers
Определения TrapBase.c:20
float m_DamageOthers
Определения TrapBase.c:21
do not process rotations !
Определения DayZAnimal.c:656
Определения EnMath.c:7
Определения SurvivorBase.c:7
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.

Перекрестные ссылки Math::Clamp(), g_Game, m_DamageOthers, m_DamagePlayers, m_Timer, MAX, TrapBase::OnSteppedOn(), RefreshState() и Synch().

Используется в OnItemLocationChanged() и OnRPC().