private void ShowArmor(WoundedPedComponent woundedPed) { if (woundedPed.Armor <= 0) { return; } var armorPercent = woundedPed.Armor / 100f; if (armorPercent > 0.7f) { SendMessage($"~g~{_locale.Data.ArmorLooksGreat} ~s~"); } else if (armorPercent > 0.4f) { SendMessage($"~y~{_locale.Data.ScratchesOnArmor} ~s~"); } else if (armorPercent > 0.15f) { SendMessage($"~o~{_locale.Data.DentsOnArmor} ~s~"); } else { SendMessage($"~r~{_locale.Data.ArmorLooksAwful} ~s~"); } }
protected override void ActionForPlayer(WoundedPedComponent pedComponent, int pedEntity) { CreatePain(pedEntity, 25f); CreateInternalBleeding(pedEntity, 2f); Function.Call(Hash._START_SCREEN_EFFECT, "DrugsDrivingIn", 5000, true); SendMessage("You feel like life leaving you", NotifyLevels.WARNING); }
private void RemovePeds() { for (int pedIndex = 0; pedIndex < _npcs.EntitiesCount; pedIndex++) { WoundedPedComponent woundedPed = _npcs.Components1[pedIndex]; if (woundedPed.IsPlayer) { return; } var ped = woundedPed.ThisPed; if (ped.IsAlive && !OutRemoveRange(ped)) { continue; } _world.Data.GswPeds.Remove(ped); woundedPed.ThisPed = null; _ecsWorld.RemoveComponent <PainComponent>(_npcs.Entities[pedIndex], true); _ecsWorld.RemoveEntity(_npcs.Entities[pedIndex]); #if DEBUG ped.CurrentBlip.Remove(); #endif } }
private bool CheckArmorPenetration(WoundedPedComponent woundedPed, int pedEntity) { if (woundedPed.Armor == 0) { return(true); } woundedPed.Armor -= ArmorDamage; if (woundedPed.Armor < 0) { return(true); } if (!CanPenetrateArmor) { return(false); } float armorPercent = woundedPed.Armor / 100f; bool penetration = Random.IsTrueWithProbability(1 - (0.6f + 0.4f * armorPercent)); if (penetration) { SendMessage("Your armor was penetrated", pedEntity, NotifyLevels.WARNING); } return(penetration); }
private void ShowPain(WoundedPedComponent woundedPed, int pedEntity) { var pain = _ecsWorld.GetComponent <PainComponent>(pedEntity); if (pain == null || woundedPed.IsDead) { return; } var painPercent = pain.CurrentPain / woundedPed.MaximalPain; if (painPercent > 3f) { SendMessage($"~s~{_locale.Data.Pain}: ~r~>300%~s~"); } else if (painPercent > 1f) { SendMessage($"~s~{_locale.Data.Pain}: ~r~{painPercent * 100f:0.0}%~s~"); } else if (painPercent > 0.5f) { SendMessage($"~s~{_locale.Data.Pain}: ~o~{painPercent * 100f:0.0}%~s~"); } else if (painPercent > 0.2f) { SendMessage($"~s~{_locale.Data.Pain}: ~y~{painPercent * 100f:0.0}%~s~"); } else if (painPercent > 0f) { SendMessage($"~s~{_locale.Data.Pain}: ~g~{painPercent * 100f:0.0}%~s~"); } }
private void CreateBleeding(WoundedPedComponent woundedPed, int pedEntity, float bleedSeverity, string name) { var mult = _config.Data.WoundConfig.BleedingMultiplier; var entity = _ecsWorld.CreateEntityWith(out BleedingComponent bleedingComponent); bleedingComponent.Entity = pedEntity; bleedingComponent.BleedSeverity = mult * bleedSeverity; bleedingComponent.Name = name; bleedingComponent.CanBeHealed = bleedSeverity <= mult * BleedingComponent.MaxSeverityForHeal; woundedPed.BleedingCount++; if (!bleedingComponent.CanBeHealed) { return; } if (woundedPed.MostDangerBleedingEntity == null || !_ecsWorld.IsEntityExists(woundedPed.MostDangerBleedingEntity.Value)) { woundedPed.MostDangerBleedingEntity = entity; return; } var oldBleeding = _ecsWorld.GetComponent <BleedingComponent>(woundedPed.MostDangerBleedingEntity.Value); if (oldBleeding != null && oldBleeding.BleedSeverity >= bleedingComponent.BleedSeverity) { return; } woundedPed.MostDangerBleedingEntity = entity; }
private void SendWoundInfo(ProcessWoundEvent component, WoundedPedComponent woundedPed) { #if !DEBUG if (_config.Data.PlayerConfig.PlayerEntity != component.Entity) { return; } #endif if (woundedPed.IsDead) { return; } var notification = _ecsWorld.CreateEntityWith <ShowNotificationEvent>(); var message = $"{component.Name}"; if (component.ArterySevered) { message += $"\n{_locale.Data.SeveredArteryMessage}"; } if (component.Crits != null || component.ArterySevered || component.BleedSeverity > _config.Data.WoundConfig.EmergencyBleedingLevel) { notification.Level = NotifyLevels.EMERGENCY; } else { notification.Level = NotifyLevels.ALERT; } notification.StringToShow = message; }
protected override void ExecuteState(WoundedPedComponent woundedPed, int pedEntity) { base.ExecuteState(woundedPed, pedEntity); SendPedToRagdoll(pedEntity, RagdollStates.WAKE_UP); ChangeWalkingAnimation(pedEntity, woundedPed.IsPlayer ? Config.Data.PlayerConfig.NoPainAnim : Config.Data.NpcConfig.NoPainAnim); if (woundedPed.IsMale) { Function.Call(Hash.PLAY_FACIAL_ANIM, woundedPed.ThisPed, "mood_happy_1", "facials@gen_male@base"); } else { Function.Call(Hash.PLAY_FACIAL_ANIM, woundedPed.ThisPed, "mood_happy_1", "facials@gen_female@base"); } if (!woundedPed.IsPlayer) { return; } if (!woundedPed.Crits.HasFlag(CritTypes.ARMS_DAMAGED)) { EcsWorld.CreateEntityWith <AddCameraShakeEvent>().Length = CameraShakeLength.CLEAR; } EcsWorld.CreateEntityWith <ChangeSpecialAbilityEvent>().Lock = false; }
protected override void ExecuteState(WoundedPedComponent woundedPed, int pedEntity) { base.ExecuteState(woundedPed, pedEntity); SwitchAnimationComponent anim; EcsWorld.CreateEntityWith(out anim); anim.PedEntity = pedEntity; anim.AnimationName = woundedPed.IsPlayer ? Config.Data.PlayerConfig.IntensePainAnim : Config.Data.NpcConfig.IntensePainAnim; if (woundedPed.DamagedParts.HasFlag(DamageTypes.ARMS_DAMAGED)) { return; } var backPercent = 1f - woundedPed.PainMeter / woundedPed.MaximalPain; if (woundedPed.IsPlayer) { Function.Call(Hash._SET_CAM_EFFECT, 2); } else { woundedPed.ThisPed.Accuracy = (int)(backPercent * woundedPed.DefaultAccuracy); } }
private void ShowHealth(WoundedPedComponent woundedPed) { var playerConfig = _config.Data.PlayerConfig; var healthPercent = !woundedPed.IsPlayer ? woundedPed.PedHealth / woundedPed.PedMaxHealth : (woundedPed.Health - playerConfig.MinimalHealth) / (playerConfig.MaximalHealth - playerConfig.MinimalHealth); var healthString = (healthPercent * 100f).ToString("0.0"); if (healthPercent >= 0.7f) { SendMessage($"~s~{_locale.Data.Health}: ~g~{healthString}%~s~"); } else if (healthPercent > 0.5f) { SendMessage($"~s~{_locale.Data.Health}: ~y~{healthString}%~s~"); } else if (healthPercent > 0.2f) { SendMessage($"~s~{_locale.Data.Health}: ~o~{healthString}%~s~"); } else if (healthPercent > 0f) { SendMessage($"~s~{_locale.Data.Health}: ~r~{healthString}%~s~"); } else { SendMessage($"~r~{_locale.Data.YouAreDead}~s~"); } }
protected override void ExecuteState(WoundedPedComponent woundedPed, int pedEntity) { base.ExecuteState(woundedPed, pedEntity); SendPedToRagdoll(pedEntity, RagdollStates.PERMANENT); if (woundedPed.IsPlayer && Config.Data.PlayerConfig.CanDropWeapon) { woundedPed.ThisPed.Weapons.Drop(); } else if (!woundedPed.IsPlayer) { woundedPed.ThisPed.Weapons.Drop(); } if (!woundedPed.IsPlayer) { return; } Game.Player.IgnoredByEveryone = true; EcsWorld.CreateEntityWith <ChangeSpecialAbilityEvent>().Lock = true; if (Config.Data.PlayerConfig.PoliceCanForgetYou) { Game.Player.WantedLevel = 0; } if (woundedPed.Crits.HasFlag(CritTypes.NERVES_DAMAGED) || woundedPed.IsDead) { return; } SendMessage(Locale.Data.UnbearablePainMessage, NotifyLevels.WARNING); }
protected override void ActionForPlayer(WoundedPedComponent pedComponent, int pedEntity) { CreatePain(pedEntity, 25f); CreateInternalBleeding(pedEntity, 0.5f); SendMessage(Locale.Data.PlayerStomachCritMessage, NotifyLevels.WARNING); }
private void UpdateMostDangerWound(WoundedPedComponent woundedPed, int pedEntity) { if (woundedPed.ThisPed.IsDead) { return; } float maxBleeding = 0; int? mostDangerEntity = null; for (int i = 0; i < _bleedings.EntitiesCount; i++) { BleedingComponent bleeding = _bleedings.Components1[i]; if (!bleeding.CanBeHealed) { continue; } if (bleeding.Entity != pedEntity) { continue; } if (bleeding.BleedSeverity <= maxBleeding) { continue; } maxBleeding = bleeding.BleedSeverity; mostDangerEntity = _bleedings.Entities[i]; } woundedPed.MostDangerBleedingEntity = mostDangerEntity; }
protected override void ExecuteState(WoundedPedComponent woundedPed, int pedEntity) { base.ExecuteState(woundedPed, pedEntity); RagdollRequestComponent request; EcsWorld.CreateEntityWith(out request); request.PedEntity = pedEntity; request.Enable = true; woundedPed.ThisPed.Weapons.Drop(); if (!woundedPed.IsPlayer) { return; } Game.Player.IgnoredByEveryone = true; if (Config.Data.PlayerConfig.PoliceCanForgetYou) { Game.Player.WantedLevel = 0; } if (!woundedPed.DamagedParts.HasFlag(DamageTypes.NERVES_DAMAGED) && !woundedPed.IsDead) { SendMessage("You can't take this pain anymore!\n" + "You lose consciousness!", NotifyLevels.WARNING); } }
protected override void ExecuteState(WoundedPedComponent woundedPed, int pedEntity) { base.ExecuteState(woundedPed, pedEntity); ChangeMoveSet(pedEntity, woundedPed.IsPlayer ? Config.Data.PlayerConfig.IntensePainSets : Config.Data.NpcConfig.IntensePainSets); if (woundedPed.Crits.Has(CritTypes.ARMS_DAMAGED)) { return; } var pain = EcsWorld.GetComponent <PainComponent>(pedEntity); var backPercent = 1f - pain.CurrentPain / woundedPed.MaximalPain; if (woundedPed.IsPlayer) { EcsWorld.CreateEntityWith <AddCameraShakeEvent>().Length = CameraShakeLength.PERMANENT; EcsWorld.CreateEntityWith <ChangeSpecialAbilityEvent>().Lock = true; } else { woundedPed.ThisPed.Accuracy = (int)(backPercent * woundedPed.DefaultAccuracy); } }
private void ShowHealth(WoundedPedComponent woundedPed) { var healthPercent = !woundedPed.IsPlayer ? (float)woundedPed.ThisPed.Health / woundedPed.ThisPed.MaxHealth : (woundedPed.Health - _config.Data.PlayerConfig.MinimalHealth) / (_config.Data.PlayerConfig.MaximalHealth - _config.Data.PlayerConfig.MinimalHealth); if (healthPercent >= 0.7f) { SendMessage($"~s~{_locale.Data.Health}: ~g~{healthPercent * 100f:0.0}%~s~"); } else if (healthPercent > 0.5f) { SendMessage($"~s~{_locale.Data.Health}: ~y~{healthPercent * 100f:0.0}%~s~"); } else if (healthPercent > 0.2f) { SendMessage($"~s~{_locale.Data.Health}: ~o~{healthPercent * 100f:0.0}%~s~"); } else if (healthPercent > 0f) { SendMessage($"~s~{_locale.Data.Health}: ~r~{healthPercent * 100f:0.0}%~s~"); } else { SendMessage($"~r~{_locale.Data.YouAreDead}~s~"); } }
public static void PlayFacialAnim(WoundedPedComponent woundedPed, string animation) { FacialAnimArguments[0] = woundedPed.ThisPed; FacialAnimArguments[1] = animation; FacialAnimArguments[2] = woundedPed.IsMale ? "facials@gen_male@base" : "facials@gen_female@base"; Function.Call(Hash.PLAY_FACIAL_ANIM, FacialAnimArguments); FacialAnimArguments[0] = null; }
protected override void ActionForNpc(WoundedPedComponent pedComponent, int pedEntity) { CreatePain(pedEntity, 25f); CreateInternalBleeding(pedEntity, 0.5f); SendMessage(pedComponent.IsMale ? Locale.Data.ManStomachCritMessage : Locale.Data.WomanStomachCritMessage); }
protected override void ActionForPlayer(WoundedPedComponent pedComponent, int pedEntity) { CreatePain(pedEntity, 10f); CreateInternalBleeding(pedEntity, 0.5f); Function.Call(Hash._START_SCREEN_EFFECT, "DrugsDrivingIn", 5000, true); Function.Call(Hash.SET_PLAYER_SPRINT, Game.Player, false); SendMessage("It\'s very hard for you to breathe", NotifyLevels.WARNING); }
private void SendPedToRagdoll(WoundedPedComponent pedComponent, int pedEntity) { if (!pedComponent.ThisPed.IsRunning && !pedComponent.ThisPed.IsSprinting) { return; } SendPedToRagdoll(pedEntity, RagdollStates.LEG_DAMAGE); }
protected override void ActionForNpc(WoundedPedComponent pedComponent, int pedEntity) { CreatePain(pedEntity, 25f); CreateInternalBleeding(pedEntity, 0.5f); SendPedToRagdoll(pedEntity, RagdollStates.GUTS_DAMAGE); SendMessage(pedComponent.IsMale ? Locale.Data.ManGutsCritMessage : Locale.Data.WomanGutsCritMessage); }
protected override void ActionForPlayer(WoundedPedComponent pedComponent, int pedEntity) { CreatePain(pedEntity, 25f); CreateInternalBleeding(pedEntity, 0.5f); SendPedToRagdoll(pedEntity, RagdollStates.GUTS_DAMAGE); StartPostFx("DrugsDrivingIn", 5000); SendMessage(Locale.Data.PlayerGutsCritMessage, NotifyLevels.WARNING); }
protected override void ActionForPlayer(WoundedPedComponent pedComponent, int pedEntity) { CreatePain(pedEntity, 10f); CreateInternalBleeding(pedEntity, 2f); Function.Call(Hash._START_SCREEN_EFFECT, "DrugsDrivingIn", 5000, true); Function.Call(Hash.SET_PLAYER_SPRINT, Game.Player, false); SendMessage(Locale.Data.PlayerLungsCritMessage, NotifyLevels.WARNING); }
protected override void ActionForPlayer(WoundedPedComponent pedComponent, int pedEntity) { CreatePain(pedEntity, 25f); CreateInternalBleeding(pedEntity, 2.5f); SendPedToRagdoll(pedEntity, RagdollStates.HEART_DAMAGE); Function.Call(Hash._START_SCREEN_EFFECT, "DrugsDrivingIn", 5000, true); SendMessage(Locale.Data.PlayerHeartCritMessage, NotifyLevels.WARNING); }
protected override void ActionForPlayer(WoundedPedComponent pedComponent, int pedEntity) { CreatePain(pedEntity, 25f); Function.Call(Hash._SET_CAM_EFFECT, 2); pedComponent.ThisPed.Weapons.Drop(); if (!pedComponent.DamagedParts.HasFlag(DamageTypes.NERVES_DAMAGED)) { SendMessage("You feel awful pain in your arm", NotifyLevels.WARNING); } }
protected override void ActionForNpc(WoundedPedComponent pedComponent, int pedEntity) { CreatePain(pedEntity, 10f); CreateInternalBleeding(pedEntity, 0.5f); if (!Config.Data.NpcConfig.ShowEnemyCriticalMessages) { return; } SendMessage($"{(pedComponent.HeShe)} coughs up blood"); }
private void RemoveBleeding(WoundedPedComponent woundedPed, int pedEntity, int bleedingEntity) { _ecsWorld.RemoveEntity(bleedingEntity); if (woundedPed == null) { return; } woundedPed.BleedingCount--; UpdateMostDangerWound(woundedPed, pedEntity); }
protected override void ActionForNpc(WoundedPedComponent pedComponent, int pedEntity) { CreatePain(pedEntity, 25f); CreateInternalBleeding(pedEntity, 0.5f); Function.Call(Hash.CREATE_NM_MESSAGE, true, 1119); Function.Call(Hash.GIVE_PED_NM_MESSAGE, pedComponent.ThisPed); SendMessage(pedComponent.IsMale ? Locale.Data.ManGutsCritMessage : Locale.Data.WomanGutsCritMessage); }
protected override void ExecuteState(WoundedPedComponent woundedPed, int pedEntity) { base.ExecuteState(woundedPed, pedEntity); SwitchAnimationComponent anim; EcsWorld.CreateEntityWith(out anim); anim.PedEntity = pedEntity; anim.AnimationName = woundedPed.IsPlayer ? Config.Data.PlayerConfig.MildPainAnim : Config.Data.NpcConfig.MildPainAnim; }
protected override void ActionForNpc(WoundedPedComponent pedComponent, int pedEntity) { CreatePain(pedEntity, 25f); pedComponent.ThisPed.Accuracy = (int)(0.1f * pedComponent.DefaultAccuracy); pedComponent.ThisPed.Weapons.Drop(); if (!Config.Data.NpcConfig.ShowEnemyCriticalMessages) { return; } SendMessage($"{pedComponent.HisHer} arm looks very bad"); }