local ROOT = getroottable() IncludeScript("nopey_lib/nopey_lib", ROOT) IncludeScript("NavAreaBuildPath", ROOT) ::nopey_mas <- { function OnGameEvent_recalculate_holidays(_) { if(GetRoundState() == 3) { clean_up_table() } } function OnGameEvent_player_spawn(params) { local hPlayer = GetPlayerFromUserID(params.userid) if (hPlayer.IsFakeClient()) { CreateTimer(function() { foreach ( tag in nopey_mas.bot_tag_list.keys() ) if ( hPlayer.HasBotTag(tag) ) { nopey_mas.bot_tag_list[tag](hPlayer) return } }, 0.2) } } function OnGameEvent_player_death(params) { local hPlayer = GetPlayerFromUserID(params.userid) local index = terminate_scope_on_death_list.find(hPlayer) if (index != null) { hPlayer.TerminateScriptScope() terminate_scope_on_death_list.remove(index) } } function equalizer_speed_boost_mod(hPlayer, min_mod= 1, max_mod = 1.6) { local flOwnerHealthRatio = hPlayer.GetHealth() * 1.0 / hPlayer.GetMaxHealth(); local mod = 0.0 if ( flOwnerHealthRatio > 0.8 ) mod = 1.0; else if ( flOwnerHealthRatio > 0.6 ) mod = 1.1; else if ( flOwnerHealthRatio > 0.4 ) mod = 1.2; else if ( flOwnerHealthRatio > 0.2 ) mod = 1.4; else mod = 1.6; return remap_val_clamped(mod, 1, 1.6, min_mod, max_mod) } function apply_mods_to_player(hPlayer) { local scope = hPlayer.GetScriptScope() local speed_boost_mod = equalizer_speed_boost_mod(hPlayer, 1, 10) if (scope.current_move_speed_mod != speed_boost_mod) { printl(speed_boost_mod) scope.current_move_speed_mod = speed_boost_mod hPlayer.GetActiveWeapon().AddAttribute("mult_player_movespeed_active", speed_boost_mod, 0) hPlayer.AddCond(64) hPlayer.RemoveCond(64) } } function tag_delayed_hold_attack(hPlayer) { CreateTimer(@() hPlayer.AddBotAttribute(ALWAYS_FIRE_WEAPON), 5) } function tag_addcond(hPlayer) { local tags = {} hPlayer.GetAllBotTags(tags) foreach (tag in tags.values()) { try { local cond_num = tag.tointeger() hPlayer.AddCond(cond_num) return } catch(_) {} } } function tag_equalizer_speed_boost( hPlayer ) { hPlayer.ValidateScriptScope() hPlayer.GetScriptScope().hPlayer <- hPlayer // hPlayer.GetScriptScope().base_move_speed_mod <- hPlayer.GetCustomAttribute("mult_player_movespeed", 1) hPlayer.GetScriptScope().current_move_speed_mod <- 0 hPlayer.GetScriptScope().Think <- function() { nopey_mas.apply_mods_to_player(hPlayer) return 0.1 } AddThinkToEnt(hPlayer, "Think") nopey_mas.terminate_scope_on_death_list.append(hPlayer) } function force_path(is_left) { EntFire("bombpath_choose_relay","kill") foreach ( relay in path_clear ) { EntFire(relay, "Trigger") } foreach ( relay in nopey_mas.paths[is_left ? "right" : "left"] ) //??? { EntFire(relay, "Trigger", "", 0.1) } } bot_tag_list = {} terminate_scope_on_death_list = [] paths = { "left" : ["bombpath_left_relay"], "right" : ["bombpath_right_relay"] } path_clear = ["bombpath_clearall_relay", "bombpath_arrows_clear_relay"] function init() { bot_tag_list = { "bot_delayed_hold_attack" : tag_delayed_hold_attack, "bot_addcond" : tag_addcond, "bot_equalizer_speed_boost" : tag_equalizer_speed_boost, } } function clean_up_table() { foreach (hPlayer in terminate_scope_on_death_list) { hPlayer.TerminateScriptScope() } delete ::nopey_mas } } nopey_mas.init() __CollectGameEventCallbacks(nopey_mas)