From 652387ca9ec3f458b4568a81ed98cf4f30ff7cb4 Mon Sep 17 00:00:00 2001 From: zaCade Date: Sun, 12 Aug 2018 16:43:30 +0200 Subject: [PATCH] ItemSpawn: Clean up filters. --- ItemSpawn/scripting/ItemSpawn.sp | 72 +++++++++++++++++++---- ItemSpawn/scripting/items/balrog.inc | 10 ++-- ItemSpawn/scripting/items/whiteknight.inc | 18 +++--- 3 files changed, 73 insertions(+), 27 deletions(-) diff --git a/ItemSpawn/scripting/ItemSpawn.sp b/ItemSpawn/scripting/ItemSpawn.sp index 2badfa3e..02033f23 100644 --- a/ItemSpawn/scripting/ItemSpawn.sp +++ b/ItemSpawn/scripting/ItemSpawn.sp @@ -202,22 +202,68 @@ public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast) // filter_activator_class nodamage. int iNoDamageFilter = CreateEntityByName("filter_activator_class"); - DispatchKeyFormat(iNoDamageFilter, "targetname", "item_spawn_nodamage"); + DispatchKeyFormat(iNoDamageFilter, "targetname", "item_filter_nodamage"); DispatchKeyFormat(iNoDamageFilter, "Negated", "0"); DispatchKeyFormat(iNoDamageFilter, "filterclass", "light"); SpawnAndActivate(iNoDamageFilter); - // filter_activator_team humans. - int iHumanFilter = CreateEntityByName("filter_activator_team"); - DispatchKeyFormat(iHumanFilter, "targetname", "item_spawn_human_filter"); - DispatchKeyFormat(iHumanFilter, "Negated", "0"); - DispatchKeyFormat(iHumanFilter, "filterteam", "3"); - SpawnAndActivate(iHumanFilter); + // filter_activator_team human. + int iHumanFilter1 = CreateEntityByName("filter_activator_team"); + DispatchKeyFormat(iHumanFilter1, "targetname", "item_filter_human"); + DispatchKeyFormat(iHumanFilter1, "Negated", "0"); + DispatchKeyFormat(iHumanFilter1, "filterteam", "3"); + SpawnAndActivate(iHumanFilter1); - // filter_activator_team zombies. - int iZombieFilter = CreateEntityByName("filter_activator_team"); - DispatchKeyFormat(iZombieFilter, "targetname", "item_spawn_zombie_filter"); - DispatchKeyFormat(iZombieFilter, "Negated", "0"); - DispatchKeyFormat(iZombieFilter, "filterteam", "2"); - SpawnAndActivate(iZombieFilter); + // filter_activator_team human ignored. + int iHumanFilter2 = CreateEntityByName("filter_activator_team"); + DispatchKeyFormat(iHumanFilter2, "targetname", "item_filter_human_ignored"); + DispatchKeyFormat(iHumanFilter2, "Negated", "1"); + DispatchKeyFormat(iHumanFilter2, "filterteam", "3"); + SpawnAndActivate(iHumanFilter2); + + // filter_damage_type human items. + int iHumanFilter3 = CreateEntityByName("filter_damage_type"); + DispatchKeyFormat(iHumanFilter3, "targetname", "item_filter_human_items"); + DispatchKeyFormat(iHumanFilter3, "Negated", "0"); + DispatchKeyFormat(iHumanFilter3, "damagetype", "512"); + SpawnAndActivate(iHumanFilter3); + + // filter_multi humans. + int iHumanFilter4 = CreateEntityByName("filter_multi"); + DispatchKeyFormat(iHumanFilter4, "targetname", "item_filter_humans"); + DispatchKeyFormat(iHumanFilter4, "Negated", "0"); + DispatchKeyFormat(iHumanFilter4, "filtertype", "1"); + DispatchKeyFormat(iHumanFilter4, "filter01", "item_filter_human"); + DispatchKeyFormat(iHumanFilter4, "filter02", "item_filter_human_items"); + SpawnAndActivate(iHumanFilter4); + + // filter_activator_team zombie. + int iZombieFilter1 = CreateEntityByName("filter_activator_team"); + DispatchKeyFormat(iZombieFilter1, "targetname", "item_filter_zombie"); + DispatchKeyFormat(iZombieFilter1, "Negated", "0"); + DispatchKeyFormat(iZombieFilter1, "filterteam", "2"); + SpawnAndActivate(iZombieFilter1); + + // filter_activator_team zombie ignored. + int iZombieFilter2 = CreateEntityByName("filter_activator_team"); + DispatchKeyFormat(iZombieFilter2, "targetname", "item_filter_zombie_ignored"); + DispatchKeyFormat(iZombieFilter2, "Negated", "1"); + DispatchKeyFormat(iZombieFilter2, "filterteam", "2"); + SpawnAndActivate(iZombieFilter2); + + // filter_damage_type zombie items. + int iZombieFilter3 = CreateEntityByName("filter_damage_type"); + DispatchKeyFormat(iZombieFilter3, "targetname", "item_filter_zombie_items"); + DispatchKeyFormat(iZombieFilter3, "Negated", "0"); + DispatchKeyFormat(iZombieFilter3, "damagetype", "128"); + SpawnAndActivate(iZombieFilter3); + + // filter_multi zombies. + int iHumanFilter4 = CreateEntityByName("filter_multi"); + DispatchKeyFormat(iHumanFilter4, "targetname", "item_filter_zombies"); + DispatchKeyFormat(iHumanFilter4, "Negated", "0"); + DispatchKeyFormat(iHumanFilter4, "filtertype", "1"); + DispatchKeyFormat(iHumanFilter4, "filter01", "item_filter_zombie"); + DispatchKeyFormat(iHumanFilter4, "filter02", "item_filter_zombie_items"); + SpawnAndActivate(iHumanFilter4); } diff --git a/ItemSpawn/scripting/items/balrog.inc b/ItemSpawn/scripting/items/balrog.inc index 8b642000..1d9d9899 100644 --- a/ItemSpawn/scripting/items/balrog.inc +++ b/ItemSpawn/scripting/items/balrog.inc @@ -84,7 +84,7 @@ public void SpawnBalrog(float fOrigin[3]) // trigger_once strip. int iTriggerStrip = CreateEntityAtOrigin("trigger_once", fOrigin); DispatchKeyFormat(iTriggerStrip, "targetname", "item_balrog_strip_%d", g_iCounter); - DispatchKeyFormat(iTriggerStrip, "filtername", "item_spawn_zombie_filter"); + DispatchKeyFormat(iTriggerStrip, "filtername", "item_filter_zombie"); DispatchKeyFormat(iTriggerStrip, "spawnflags", "1"); DispatchKeyFormat(iTriggerStrip, "startdisabled", "1"); DispatchKeyFormat(iTriggerStrip, "OnStartTouch", "item_spawn_weaponstrip,StripWeaponsAndSuit,,0,1"); @@ -103,7 +103,7 @@ public void SpawnBalrog(float fOrigin[3]) // trigger_hurt walk. int iTriggerWalk = CreateEntityAtOrigin("trigger_hurt", fOriginTemp); DispatchKeyFormat(iTriggerWalk, "targetname", "item_balrog_walk_%d", g_iCounter); - DispatchKeyFormat(iTriggerWalk, "filtername", "item_spawn_human_filter"); + DispatchKeyFormat(iTriggerWalk, "filtername", "item_filter_zombie_ignored"); DispatchKeyFormat(iTriggerWalk, "spawnflags", "9"); DispatchKeyFormat(iTriggerWalk, "startdisabled", "1"); DispatchKeyFormat(iTriggerWalk, "damagetype", "128"); @@ -125,7 +125,7 @@ public void SpawnBalrog(float fOrigin[3]) // trigger_hurt roar. int iTriggerRoar = CreateEntityAtOrigin("trigger_hurt", fOriginTemp); DispatchKeyFormat(iTriggerRoar, "targetname", "item_balrog_roar_%d", g_iCounter); - DispatchKeyFormat(iTriggerRoar, "filtername", "item_spawn_zombie_filter"); + DispatchKeyFormat(iTriggerRoar, "filtername", "item_filter_zombie"); DispatchKeyFormat(iTriggerRoar, "spawnflags", "1"); DispatchKeyFormat(iTriggerRoar, "startdisabled", "1"); DispatchKeyFormat(iTriggerRoar, "damagetype", "0"); @@ -153,7 +153,7 @@ public void SpawnBalrog(float fOrigin[3]) // trigger_hurt attack. int iTriggerAttack = CreateEntityAtOrigin("trigger_hurt", fOriginTemp); DispatchKeyFormat(iTriggerAttack, "targetname", "item_balrog_attack_%d", g_iCounter); - DispatchKeyFormat(iTriggerAttack, "filtername", "item_spawn_human_filter"); + DispatchKeyFormat(iTriggerAttack, "filtername", "item_filter_zombie_ignored"); DispatchKeyFormat(iTriggerAttack, "spawnflags", "9"); DispatchKeyFormat(iTriggerAttack, "startdisabled", "1"); DispatchKeyFormat(iTriggerAttack, "damagetype", "128"); @@ -301,7 +301,7 @@ public void SpawnBalrog(float fOrigin[3]) DispatchKeyFormat(iHealth, "disablereceiveshadows", "1"); DispatchKeyFormat(iHealth, "damagetype", "0"); DispatchKeyFormat(iHealth, "damagetoenablemotion", "0"); - DispatchKeyFormat(iHealth, "damagefilter", "item_spawn_human_filter"); + DispatchKeyFormat(iHealth, "damagefilter", "item_filter_humans"); DispatchKeyFormat(iHealth, "OnBreak", "item_balrog_knife_%d,Kill,,0,1", g_iCounter); DispatchKeyFormat(iHealth, "OnBreak", "item_balrog_strip_%d,Kill,,0,1", g_iCounter); DispatchKeyFormat(iHealth, "OnBreak", "item_balrog_walk_%d,Kill,,0,1", g_iCounter); diff --git a/ItemSpawn/scripting/items/whiteknight.inc b/ItemSpawn/scripting/items/whiteknight.inc index 884e2e1f..d6038f2f 100644 --- a/ItemSpawn/scripting/items/whiteknight.inc +++ b/ItemSpawn/scripting/items/whiteknight.inc @@ -82,7 +82,7 @@ public void SpawnWhiteKnight(float fOrigin[3]) // trigger_once strip. int iTriggerStrip = CreateEntityAtOrigin("trigger_once", fOrigin); DispatchKeyFormat(iTriggerStrip, "targetname", "item_knight_strip_%d", g_iCounter); - DispatchKeyFormat(iTriggerStrip, "filtername", "item_spawn_human_filter"); + DispatchKeyFormat(iTriggerStrip, "filtername", "item_filter_human"); DispatchKeyFormat(iTriggerStrip, "spawnflags", "1"); DispatchKeyFormat(iTriggerStrip, "startdisabled", "1"); DispatchKeyFormat(iTriggerStrip, "OnStartTouch", "item_spawn_weaponstrip,StripWeaponsAndSuit,,0,1"); @@ -101,7 +101,7 @@ public void SpawnWhiteKnight(float fOrigin[3]) // trigger_push attack. int iTriggerAttack1 = CreateEntityAtOrigin("trigger_push", fOriginTemp); DispatchKeyFormat(iTriggerAttack1, "targetname", "item_knight_attack_1_%d", g_iCounter); - DispatchKeyFormat(iTriggerAttack1, "filtername", "item_spawn_zombie_filter"); + DispatchKeyFormat(iTriggerAttack1, "filtername", "item_filter_zombie"); DispatchKeyFormat(iTriggerAttack1, "spawnflags", "1"); DispatchKeyFormat(iTriggerAttack1, "startdisabled", "1"); DispatchKeyFormat(iTriggerAttack1, "pushdir", "-45 0 0"); @@ -116,7 +116,7 @@ public void SpawnWhiteKnight(float fOrigin[3]) // trigger_push attack. int iTriggerAttack2 = CreateEntityAtOrigin("trigger_push", fOriginTemp); DispatchKeyFormat(iTriggerAttack2, "targetname", "item_knight_attack_2_%d", g_iCounter); - DispatchKeyFormat(iTriggerAttack2, "filtername", "item_spawn_zombie_filter"); + DispatchKeyFormat(iTriggerAttack2, "filtername", "item_filter_zombie"); DispatchKeyFormat(iTriggerAttack2, "spawnflags", "1"); DispatchKeyFormat(iTriggerAttack2, "startdisabled", "1"); DispatchKeyFormat(iTriggerAttack2, "pushdir", "-45 0 0"); @@ -136,7 +136,7 @@ public void SpawnWhiteKnight(float fOrigin[3]) // trigger_hurt attack. int iTriggerAttack3 = CreateEntityAtOrigin("trigger_hurt", fOriginTemp); DispatchKeyFormat(iTriggerAttack3, "targetname", "item_knight_attack_3_%d", g_iCounter); - DispatchKeyFormat(iTriggerAttack3, "filtername", "item_spawn_zombie_filter"); + DispatchKeyFormat(iTriggerAttack3, "filtername", "item_filter_human_ignored"); DispatchKeyFormat(iTriggerAttack3, "spawnflags", "9"); DispatchKeyFormat(iTriggerAttack3, "startdisabled", "1"); DispatchKeyFormat(iTriggerAttack3, "damagetype", "512"); @@ -158,7 +158,7 @@ public void SpawnWhiteKnight(float fOrigin[3]) // trigger_hurt nuke. int iTriggerNuke = CreateEntityAtOrigin("trigger_hurt", fOriginTemp); DispatchKeyFormat(iTriggerNuke, "targetname", "item_knight_nuke_%d", g_iCounter); - DispatchKeyFormat(iTriggerNuke, "filtername", "item_spawn_zombie_filter"); + DispatchKeyFormat(iTriggerNuke, "filtername", "item_filter_human_ignored"); DispatchKeyFormat(iTriggerNuke, "spawnflags", "9"); DispatchKeyFormat(iTriggerNuke, "startdisabled", "1"); DispatchKeyFormat(iTriggerNuke, "damagetype", "512"); @@ -303,8 +303,8 @@ public void SpawnWhiteKnight(float fOrigin[3]) DispatchKeyFormat(iCompareShield, "OnEqualTo", "item_knight_shield_compare_%d,SetCompareValue,-1,0,-1", g_iCounter); DispatchKeyFormat(iCompareShield, "OnEqualTo", "item_knight_model_%d,SetAnimation,dog_defense,0,-1", g_iCounter); DispatchKeyFormat(iCompareShield, "OnEqualTo", "item_knight_model_%d,SetDefaultAnimation,dog_defense,0,-1", g_iCounter); - DispatchKeyFormat(iCompareShield, "OnEqualTo", "item_knight_health_%d,SetDamageFilter,item_spawn_nodamage,0,-1", g_iCounter); - DispatchKeyFormat(iCompareShield, "OnEqualTo", "item_knight_health_%d,SetDamageFilter,item_spawn_zombie_filter,2,-1", g_iCounter); + DispatchKeyFormat(iCompareShield, "OnEqualTo", "item_knight_health_%d,SetDamageFilter,item_filter_nodamage,0,-1", g_iCounter); + DispatchKeyFormat(iCompareShield, "OnEqualTo", "item_knight_health_%d,SetDamageFilter,item_filter_zombies,2,-1", g_iCounter); DispatchKeyFormat(iCompareShield, "OnEqualTo", "item_knight_walk_%d,Trigger,,2,-1", g_iCounter); SpawnAndActivate(iCompareShield); ParentToEntity(iCompareShield, iKnife); @@ -500,7 +500,7 @@ public void SpawnWhiteKnight(float fOrigin[3]) DispatchKeyFormat(iHealth, "disablereceiveshadows", "1"); DispatchKeyFormat(iHealth, "damagetype", "0"); DispatchKeyFormat(iHealth, "damagetoenablemotion", "0"); - DispatchKeyFormat(iHealth, "damagefilter", "item_spawn_zombie_filter"); + DispatchKeyFormat(iHealth, "damagefilter", "item_filter_zombies"); DispatchKeyFormat(iHealth, "OnBreak", "item_knight_knife_%d,Kill,,0,1", g_iCounter); DispatchKeyFormat(iHealth, "OnBreak", "item_knight_strip_%d,Kill,,0,1", g_iCounter); DispatchKeyFormat(iHealth, "OnBreak", "item_knight_attack_1_%d,Kill,,0,1", g_iCounter); @@ -531,7 +531,7 @@ public void SpawnWhiteKnight(float fOrigin[3]) DispatchKeyFormat(iHealth, "OnBreak", "item_knight_model_%d,SetAnimation,dog_die,0,1", g_iCounter); DispatchKeyFormat(iHealth, "OnBreak", "item_knight_model_%d,SetDefaultAnimation,dog_die_loop,0,1", g_iCounter); DispatchKeyFormat(iHealth, "OnPlayerUse", "item_knight_attack_branch_%d,Toggle,,0,-1", g_iCounter); - DispatchKeyFormat(iHealth, "OnUser1", "!activator,SetDamageFilter,item_spawn_human_filter,0,-1"); + DispatchKeyFormat(iHealth, "OnUser1", "!activator,SetDamageFilter,item_filter_zombie_ignored,0,-1"); DispatchKeyFormat(iHealth, "OnUser1", "!activator,AddOutput,rendermode 10,0,-1"); DispatchKeyFormat(iHealth, "OnUser1", "!activator,AddOutput,renderfx 6,0,-1"); DispatchKeyFormat(iHealth, "OnUser1", "!self,FireUser1,,1,-1");