diff --git a/addons/sourcemod/plugins/optional/l4d_return_thrown_items.smx b/addons/sourcemod/plugins/optional/l4d_return_thrown_items.smx new file mode 100644 index 000000000..b9a25caa6 Binary files /dev/null and b/addons/sourcemod/plugins/optional/l4d_return_thrown_items.smx differ diff --git a/addons/sourcemod/scripting/l4d_return_thrown_items.sp b/addons/sourcemod/scripting/l4d_return_thrown_items.sp new file mode 100644 index 000000000..4d2c7623c --- /dev/null +++ b/addons/sourcemod/scripting/l4d_return_thrown_items.sp @@ -0,0 +1,140 @@ +#pragma semicolon 1 +#pragma newdecls required + +#include +#include +#include +#include + +#define PLUGIN_VERSION "1.0" + +public Plugin myinfo = +{ + name = "[L4D & 2] Return Thrown Items", + author = "Forgetest", + description = "Return pills/adrenalines thrown through shoving key if not successfully given.", + version = PLUGIN_VERSION, + url = "https://github.com/Target5150/MoYu_Server_Stupid_Plugins", +} + +methodmap CountdownTimer { + public bool HasStarted() { + return this.m_timestamp > 0.0; + } + public bool IsElasped() { + return GetGameTime() >= this.m_timestamp; + } + property float m_duration { + public get() { return LoadFromAddress(view_as
(this) + view_as
(4), NumberType_Int32); } + } + property float m_timestamp { + public get() { return LoadFromAddress(view_as
(this) + view_as
(8), NumberType_Int32); } + } +} + +public void OnMapStart() +{ + for (int i = 1; i <= MaxClients; ++i) + { + if (IsClientInGame(i)) OnClientPutInServer(i); + } +} + +public void OnClientPutInServer(int client) +{ + SDKHook(client, SDKHook_WeaponDropPost, SDK_OnWeaponDrop_Post); +} + +void SDK_OnWeaponDrop_Post(int client, int weapon) +{ + if (GetClientTeam(client) == 3) + return; + + if (weapon <= 0 || !IsWeaponGiveable(weapon)) + return; + + // NOTE: Next weapon giving think defaults to 0.5s later, but the drop timer lasts 5.0s long. + // TODO: Make a cvar in case? Detour `CTerrorWeapon::GiveThink` for arruracy? + CreateTimer(1.0, Timer_CheckWeaponGiving, EntIndexToEntRef(weapon), TIMER_FLAG_NO_MAPCHANGE); +} + +Action Timer_CheckWeaponGiving(Handle timer, int ref) +{ + int weapon = EntRefToEntIndex(ref); + if (weapon == -1) + return Plugin_Stop; + + CheckWeaponGiving(weapon); + + return Plugin_Stop; +} + +bool CheckWeaponGiving(int weapon) +{ + CountdownTimer ct = GetWeaponDropTimer(weapon); + if (!ct.HasStarted() || ct.IsElasped()) // don't bother if not dropping + return false; + + if (GetEntPropEnt(weapon, Prop_Send, "m_hOwner") != -1) // somebody has grabbed it + return false; + + int owner = GetWeaponDroppingPlayer(weapon); + if (owner == -1 || !IsClientInGame(owner)) + return false; + + // yeah if empty, actually doesn't matter though, but yeah it feels good :) + EquipPlayerWeaponIfEmpty(owner, weapon); + + return true; +} + +void EquipPlayerWeaponIfEmpty(int client, int weapon) +{ + char cls[32]; + GetEntityClassname(weapon, cls, sizeof(cls)); + + int slot = L4D2_GetIntWeaponAttribute(cls, L4D2IWA_Bucket); + if (GetPlayerWeaponSlot(client, slot) == -1) + { + EquipPlayerWeapon(client, weapon); + } +} + +bool IsWeaponGiveable(int weapon) +{ + char cls[32]; + GetEntityClassname(weapon, cls, sizeof(cls)); + + int slot = L4D2_GetIntWeaponAttribute(cls, L4D2IWA_Bucket); + return slot == 4; +} + +CountdownTimer GetWeaponDropTimer(int weapon) +{ + static int s_iOffs_m_dropTimer = -1; + if (s_iOffs_m_dropTimer == -1) + s_iOffs_m_dropTimer = L4D_IsEngineLeft4Dead1() ? + FindSendPropInfo("CTerrorWeapon", "m_flVsLastSwingTime") + 20 : FindSendPropInfo("CTerrorWeapon", "m_nUpgradedPrimaryAmmoLoaded") + 16; + + return view_as(GetEntityAddress(weapon) + view_as
(s_iOffs_m_dropTimer)); +} + +int GetWeaponDroppingPlayer(int weapon) +{ + static int s_iOffs_m_hDroppingPlayer = -1; + if (s_iOffs_m_hDroppingPlayer == -1) + s_iOffs_m_hDroppingPlayer = L4D_IsEngineLeft4Dead1() ? + FindSendPropInfo("CTerrorWeapon", "m_flVsLastSwingTime") + 16 : FindSendPropInfo("CTerrorWeapon", "m_nUpgradedPrimaryAmmoLoaded") + 8; + + return GetEntDataEnt2(weapon, s_iOffs_m_hDroppingPlayer); +} + +// int GetWeaponDropTarget(int weapon) +// { +// static int s_iOffs_m_hDropTarget = -1; +// if (s_iOffs_m_hDropTarget == -1) +// s_iOffs_m_hDropTarget = L4D_IsEngineLeft4Dead1() ? +// FindSendPropInfo("CTerrorWeapon", "m_flVsLastSwingTime") + 12 : FindSendPropInfo("CTerrorWeapon", "m_nUpgradedPrimaryAmmoLoaded") + 12; + +// return GetEntDataEnt2(weapon, s_iOffs_m_hDropTarget); +// } diff --git a/cfg/cfgogl/zonemod/mapinfo.txt b/cfg/cfgogl/zonemod/mapinfo.txt index c040efbcd..adb00b865 100644 --- a/cfg/cfgogl/zonemod/mapinfo.txt +++ b/cfg/cfgogl/zonemod/mapinfo.txt @@ -1080,6 +1080,11 @@ "min" "34" "max" "63" } + "may spawn in water" + { + "min" "70" + "max" "72" + } "Late spawns" { "min" "78" @@ -1678,6 +1683,10 @@ "start_extra_dist" "203.035721" "end_point" "696.980591 8058.962891 0.031250" "end_dist" "164.379135" + "ItemLimits" + { + "pain_pills" "3" + } "tank_ban_flow" { "1" @@ -1703,6 +1712,10 @@ "start_extra_dist" "123.117989" "end_point" "-697.423767 -182.836334 214.806290" "end_dist" "1754.263794" + "ItemLimits" + { + "pain_pills" "4" + } } //======================================================================= diff --git a/cfg/cfgogl/zonemod/shared_settings.cfg b/cfg/cfgogl/zonemod/shared_settings.cfg index e65d800ce..372c411b3 100644 --- a/cfg/cfgogl/zonemod/shared_settings.cfg +++ b/cfg/cfgogl/zonemod/shared_settings.cfg @@ -161,6 +161,7 @@ spit_block_square dcr_m2_streets -65 1538 48 1586 //dead center rebirth , map2 , // [l4d2_ledgeblock.smx] ledge_block_square hf01_theforest -456.402832 -4714.641113 -345.698212 -4595.220215 // At the final ladder at the end +ledge_block_square l4d_dbd2dc_undead_center -4952 8024 -4408 8840 // Block 4 banners could cause hang on them // [l4d2_godframes_control.smx + l4d2_getup_fixes.smx] confogl_addcvar gfc_hittable_override 1 diff --git a/cfg/generalfixes.cfg b/cfg/generalfixes.cfg index 41c004e29..f79a3fae7 100644 --- a/cfg/generalfixes.cfg +++ b/cfg/generalfixes.cfg @@ -68,6 +68,7 @@ sm plugins load fixes/l4d_fix_rotated_physblocker.smx sm plugins load fixes/firebulletsfix.smx sm plugins load fixes/l4d_fix_stagger_dir.smx sm plugins load fixes/l4d2_fix_rocket_pull.smx +sm plugins load optional/l4d_return_thrown_items.smx sm plugins load fixes/l4d_use_priority.smx // 修复E键问题 diff --git a/cfg/stripper/zonemod/maps/cdta_01detour.cfg b/cfg/stripper/zonemod/maps/cdta_01detour.cfg index e85648ed0..7be279978 100644 --- a/cfg/stripper/zonemod/maps/cdta_01detour.cfg +++ b/cfg/stripper/zonemod/maps/cdta_01detour.cfg @@ -332,6 +332,15 @@ add: "initialstate" "1" "BlockType" "0" } +{ + "classname" "env_player_blocker" + "BlockType" "0" + "initialstate" "1" + "maxs" "40 40 80" + "mins" "-40 -40 -80" + "targetname" "eb_fix_tree05" + "origin" "-720 3776 144" +} ; --- Block a perma stuck spot in some rocks in the valley { "classname" "env_physics_blocker" @@ -579,6 +588,19 @@ add: ; ===================================================== +; --- fix a broken Si ladder under the hill +; --- 修复一个山下的假爬梯 +add: +{ + "model" "*4" + "normal.z" "0.20" + "normal.y" "-0.97" + "normal.x" "0.00" + "team" "2" + "classname" "func_simpleladder" + "origin" "1.00 -6.00 0.00" + "angles" "0.00 0.00 0.00" +} ; ############ MAP SOUND AND GFX CHANGES ############ ; ===================================================== ; == SOUND REMOVAL == diff --git a/cfg/stripper/zonemod/maps/dkr_m2_carnival.cfg b/cfg/stripper/zonemod/maps/dkr_m2_carnival.cfg index 2d965aef5..022089e32 100644 --- a/cfg/stripper/zonemod/maps/dkr_m2_carnival.cfg +++ b/cfg/stripper/zonemod/maps/dkr_m2_carnival.cfg @@ -19,3 +19,16 @@ modify: "OnVersus" "directorBeginScriptwitch_glow0-1" } } + +; --- block a hang spot on wire hole +; --- 电线杆有挂边,需要加一个空气墙 +add: +{ + "classname" "env_player_blocker" + "BlockType" "1" + "initialstate" "1" + "maxs" "24 64 800" + "mins" "-24 -64 -2" + "origin" "2912 6016 312" +; "targetname" "eb_fix01" +} diff --git a/cfg/stripper/zonemod/maps/l4d2_stadium3_city1.cfg b/cfg/stripper/zonemod/maps/l4d2_stadium3_city1.cfg index 55991e09a..ebacecd38 100644 --- a/cfg/stripper/zonemod/maps/l4d2_stadium3_city1.cfg +++ b/cfg/stripper/zonemod/maps/l4d2_stadium3_city1.cfg @@ -85,3 +85,16 @@ modify: "OnTrigger" "sound_alarm,Kill,,10,-1" } } + +; ################ ITEM SPAWN CHANGES ############### +; ===================================================== +; == PILL / ITEM / WEAPON SPAWNS == +; == Remove or change pill, item & weapon spawns == +; ===================================================== + +; ---- remove too radom pills 移除过于随机的药 +filter: +{ + "hammerid" "338911" + "classname" "weapon_item_spawn" +} diff --git a/cfg/stripper/zonemod/maps/l4d2_vs_stadium2_riverwalk.cfg b/cfg/stripper/zonemod/maps/l4d2_vs_stadium2_riverwalk.cfg index 8007a1880..26267cb2e 100644 --- a/cfg/stripper/zonemod/maps/l4d2_vs_stadium2_riverwalk.cfg +++ b/cfg/stripper/zonemod/maps/l4d2_vs_stadium2_riverwalk.cfg @@ -58,7 +58,8 @@ add: ; == Block players getting outside / under the map == ; ===================================================== -; --- fix a Si stuck spot 修复一个特感卡住点 +; --- fix a Si stuck spot before the river +; --- 修复一个特感卡住点(水前) add: { "classname" "prop_dynamic" @@ -70,4 +71,53 @@ add: "disableshadows" "1" } +; --- fix 2 Si stuck spots before the event +; --- 修复4个特感卡住点(机关点前) +{ + "classname" "env_player_blocker" + "BlockType" "0" + "initialstate" "1" + "maxs" "32 32 300" + "mins" "-32 -32 -80" + "targetname" "eb_fix01" + "origin" "-2224 5088 -192" +} +{ + "classname" "env_player_blocker" + "BlockType" "0" + "initialstate" "1" + "maxs" "32 32 20" + "mins" "-32 -32 -40" + "targetname" "eb_fix02" + "origin" "-304 4904 -192" +} +add: +{ + "model" "*102" + "normal.z" "0.00" + "normal.y" "-1.00" + "normal.x" "0.00" + "team" "2" + "classname" "func_simpleladder" + "origin" "4978.50 5694.50 -20.00" + "angles" "0.00 90.00 0.00" +} +{ + "classname" "prop_dynamic" + "origin" "504 5248 -232" + "angles" "0 285 0" + "solid" "6" + "rendercolor" "255 255 255" + "model" "models/props_fortifications/sandbags_line2.mdl" + "disableshadows" "1" +} +{ + "classname" "prop_dynamic" + "origin" "432 5240 -208" + "angles" "0 195 90" + "solid" "6" + "rendercolor" "255 255 255" + "model" "models/props_highway/plywood_01.mdl" + "disableshadows" "1" +} diff --git a/cfg/stripper/zonemod/maps/l4d_dbd2dc_the_mall.cfg b/cfg/stripper/zonemod/maps/l4d_dbd2dc_the_mall.cfg index 51b8dce90..e72045a72 100644 --- a/cfg/stripper/zonemod/maps/l4d_dbd2dc_the_mall.cfg +++ b/cfg/stripper/zonemod/maps/l4d_dbd2dc_the_mall.cfg @@ -2643,6 +2643,22 @@ add: ; ####### MISCELLANEOUS / MAP SPECIFIC CHANGES ###### ; ===================================================== -; == BLANK HEADER == -; == Blank description == +; == NAVIGATION == +; == make distance score work right == ; ===================================================== + +; --- fix 79%-81% nav flow scores +; --- 修复79%-81%导航流分数 +add: +{ + "classname" "logic_auto" + "OnMapSpawn" "shortcut_blocker,BlockNav,,1,-1" +} +{ + "classname" "script_nav_blocker" + "origin" "1320 2992 -500" + "extent" "32 32 32" + "targetname" "shortcut_blocker" + "teamToBlock" "-1" + "affectsFlow" "2" +} diff --git a/cfg/stripper/zonemod/maps/uf3_harbor.cfg b/cfg/stripper/zonemod/maps/uf3_harbor.cfg index b65679ebe..0536794c1 100644 --- a/cfg/stripper/zonemod/maps/uf3_harbor.cfg +++ b/cfg/stripper/zonemod/maps/uf3_harbor.cfg @@ -45,6 +45,14 @@ filter: "hammerid" "5131385" } +; --- Remove start + end saferoom heath cabinets +; --- 移除起点终点的药箱 +filter: +{ + "hammerid" "5219688" + "classname" "prop_health_cabinet" +} + ; Add Pill Spawns add: { @@ -931,7 +939,7 @@ add: } ; ===================================================== -; ================= block & fix 空气墙增删 +; ================= block & fix 空气墙修补 ; ===================================================== add: @@ -988,19 +996,45 @@ add: "origin" "-920 -5296 0" "angles" "0 255 0" "model" "models/props_foliage/urban_hedge_256_128_high.mdl" + "disableshadows" "1" } { - "classname" "prop_dynamic" - "solid" "6" - "origin" "-944 -8160 0" - "angles" "0 270 0" - "model" "models/props_exteriors/wood_stairs_120.mdl" + "classname" "env_player_blocker" + "BlockType" "0" + "initialstate" "1" + "maxs" "680 40 80" + "mins" "-680 -40 -80" + "targetname" "eb_fix06" + "origin" "304 -9648 16" +} + +; ===================================================== +; ================= add Si ladders 添加爬行痕迹 +; ===================================================== + +add: +; --- start saferoom roof 出门屋顶 +; --- added an infected ladder at back of saferoom +{ + "model" "*50" + "normal.z" "0.00" + "normal.y" "-0.00" + "normal.x" "-1.00" + "team" "2" + "classname" "func_simpleladder" + "origin" "-1726.00 -1196.00 8.00" + "angles" "0.00 360.00 0.00" } + +; --- bush in park 公园的草垛里 +add: { - "classname" "prop_dynamic" - "solid" "6" - "origin" "16 -10416 0" - "angles" "0 0 0" - "model" "models/props_misc/fairground_tent_closed.mdl" - "rendercolor" "167 31 31" -} \ No newline at end of file + "model" "*101" + "normal.z" "0.00" + "normal.y" "0.00" + "normal.x" "1.00" + "team" "2" + "classname" "func_simpleladder" + "origin" "830.00 -1242.00 -84.00" + "angles" "0.00 0.00 0.00" +} diff --git a/cfg/stripper/zonemod/maps/x1m2_path.cfg b/cfg/stripper/zonemod/maps/x1m2_path.cfg index f68a7461f..d59e670b4 100644 --- a/cfg/stripper/zonemod/maps/x1m2_path.cfg +++ b/cfg/stripper/zonemod/maps/x1m2_path.cfg @@ -18,6 +18,17 @@ filter: "classname" "trigger_auto_crouch" } +; Remove pills from start safe room +filter: +{ + "hammerid" "58296" + "classname" "weapon_item_spawn" +} +{ + "hammerid" "58294" + "classname" "weapon_item_spawn" +} + ; Remove pills from end safe room filter: {