v1.2.3.b2 - Part 2
## GENERAL - Added a css_entity admin command to check whether an entity with a given index/handle exists (prints the designer name to chat or console). - Added a TakeDamage post-hook (OnTakeDamagePost) alongside the existing pre-hook, so skills can now react after damage has actually been applied, not just before. - Added CreateMolotovProjectile (new CMolotovProjectile_CreateFunc signature) and CreateTrackedChicken entity helpers. - Added a weapon_mp7 → weapon_mp5sd fallback mapping. - Added class for KillfeedIcons ## SKILL IMPROVEMENTS - Aimbot: -- Only forces a headshot hitgroup once (skips if it's already a head or an invalid hitgroup), and now restores the original hitgroup value in the new post-damage hook instead of leaving it overwritten. - Tripwire: -- Reduced the default wire width from 1.5 to 0.7. ## NEW SKILLS: - Berserker: You deal more damage and move faster as your health gets lower. - Blast Shot: Press Attack2 with the MP5 to fire an HE grenade. - Demon Eye: You deal damage to every enemy you are looking at. - Fire Rain: Throw a decoy to call down a rain of Molotovs. - Flashlight: Click [css_useSkill] to turn the flashlight on or off; its light can blind enemies. - Healing Chicken: Your chickens heal you while you are nearby. - Jetkick: Select a player to jetkick - every shot they fire knocks them backwards until disabled. - Last Gasp: After you die, you deal damage to the enemy who killed you. - Take Ammo: Click [css_useSkill] to take the active weapon's magazine from a random enemy. - Team Teleport: Press [css_useSkill] to teleport to the teammate you're looking at.
This commit is contained in:
parent
203a0c3986
commit
8038a4d646
57 changed files with 3663 additions and 553 deletions
|
|
@ -79,6 +79,7 @@ namespace src.player
|
|||
|
||||
Instance.HookUserMessage(208, PlayerMakeSound);
|
||||
VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(OnTakeDamage, HookMode.Pre);
|
||||
VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(OnTakeDamagePost, HookMode.Post);
|
||||
|
||||
Instance.RegisterEventHandler<EventBulletImpact>(BulletImpact);
|
||||
|
||||
|
|
@ -94,6 +95,7 @@ namespace src.player
|
|||
public static void Unload()
|
||||
{
|
||||
TryUnhook(() => VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Unhook(OnTakeDamage, HookMode.Pre));
|
||||
TryUnhook(() => VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Unhook(OnTakeDamagePost, HookMode.Post));
|
||||
TryUnhook(() => VirtualFunctions.CBaseTrigger_StartTouchFunc.Unhook(OnTriggerEnter, HookMode.Post));
|
||||
TryUnhook(() => VirtualFunctions.CBaseTrigger_EndTouchFunc.Unhook(OnTriggerExit, HookMode.Pre));
|
||||
TryUnhook(() => VirtualFunctions.CCSPlayer_ItemServices_CanAcquireFunc.Unhook(OnWeaponCanAcquire, HookMode.Pre));
|
||||
|
|
@ -133,7 +135,7 @@ namespace src.player
|
|||
}
|
||||
}
|
||||
|
||||
private static void DispatchOnTakeDamage(DynamicHook h)
|
||||
private static void DispatchOnTakeDamage(DynamicHook h, bool post = false)
|
||||
{
|
||||
object[] args = [h];
|
||||
var seen = new HashSet<Skills>();
|
||||
|
|
@ -149,26 +151,26 @@ namespace src.player
|
|||
continue;
|
||||
}
|
||||
|
||||
InvokeOnTakeDamage(p.Skill, h, args);
|
||||
InvokeOnTakeDamage(p.Skill, h, args, post);
|
||||
}
|
||||
|
||||
if (deferred == null) return;
|
||||
foreach (var skill in deferred)
|
||||
InvokeOnTakeDamage(skill, h, args);
|
||||
InvokeOnTakeDamage(skill, h, args, post);
|
||||
}
|
||||
|
||||
private static void InvokeOnTakeDamage(Skills skill, DynamicHook h, object[] args)
|
||||
private static void InvokeOnTakeDamage(Skills skill, DynamicHook h, object[] args, bool post)
|
||||
{
|
||||
if (Config.LoadedConfig.DebugMode != true)
|
||||
{
|
||||
InvokeSkill(skill, "OnTakeDamage", args);
|
||||
InvokeSkill(skill, post ? "OnTakeDamagePost" : "OnTakeDamage", args);
|
||||
return;
|
||||
}
|
||||
|
||||
var info = h.GetParam<CTakeDamageInfo>(1);
|
||||
float before = info == null ? 0f : info.Damage;
|
||||
|
||||
InvokeSkill(skill, "OnTakeDamage", args);
|
||||
InvokeSkill(skill, post ? "OnTakeDamagePost" : "OnTakeDamage", args);
|
||||
|
||||
float after = info == null ? 0f : info.Damage;
|
||||
if (Math.Abs(before - after) > 0.01f)
|
||||
|
|
@ -345,6 +347,33 @@ namespace src.player
|
|||
}
|
||||
}
|
||||
|
||||
private static HookResult WeaponDrop(DynamicHook hook)
|
||||
{
|
||||
lock (setLock)
|
||||
{
|
||||
CCSPlayerController player = hook.GetParam<CCSPlayerController>(0);
|
||||
if (player == null || !player.IsValid)
|
||||
return HookResult.Continue;
|
||||
|
||||
var activeSkills = Instance.SkillPlayer
|
||||
.Where(p => !p.IsDrawing)
|
||||
.Select(p => p.Skill.ToString())
|
||||
.Distinct();
|
||||
|
||||
bool block = false;
|
||||
foreach (string skillName in activeSkills)
|
||||
{
|
||||
bool? result = (bool?)Instance.SkillAction(skillName, "WeaponDrop", [hook, player]);
|
||||
if (result == true)
|
||||
{
|
||||
block = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return block ? HookResult.Handled : HookResult.Continue;
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly Dictionary<Skills, string> _skillNames =
|
||||
Enum.GetValues<Skills>().ToDictionary(s => s, s => s.ToString());
|
||||
private static readonly HashSet<Skills> _activeSkillsSet = [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue