-- Globals local Worldspawn = Ents.FindByClass("worldspawn") local Gamerules = Ents.FindByClass("tf_gamerules") local PlayerManager = Ents.FindByClass("tf_gamerules") local ObjectiveResource = Ents.FindByClass("tf_objective_resource") local Stats = Ents.FindAllByClass("tf_mann_vs_machine_stats") ---- local GameRules = Gamerules local SPECTATOR_MODE_NONE = 0 local SPECTATOR_MODE_BODY = 1 local SPECTATOR_MODE_KILLCAM = 2 local SPECTATOR_MODE_HEADCAM = 3 local SPECTATOR_MODE_FIRSTPERSON = 4 local SPECTATOR_MODE_ENTITY = 5 local SPECTATOR_MODE_NONAME = 6 local SPECTATOR_MODE_FREE = 7 local TF_MINIGUN_STATE_IDLE = 0 local TF_MINIGUN_STATE_WINDUP = 1 local TF_MINIGUN_STATE_FIRE = 2 local TF_MINIGUN_STATE_SPIN = 3 local DMG_NOPUSH = 2048 local TF_COND_REPROGRAMMED_NEUTRAL = 159 local TF_TEAM_UNASSIGNED = 0 --raf i will local TF_TEAM_NONE = 0 local TF_TEAM_SPECTATOR = 1 local TF_TEAM_RED = 2 local TF_TEAM_BLUE = 3 local TF_TEAM_HALLOWEEN = 5 local OBJ_DISPENSER = 0 local OBJ_TELEPORTER = 1 local OBJ_SENTRYGUN = 2 local OBJ_ATTACHMENT_SAPPER = 3 local TELE_MODE_NONE = 0 local TELE_MODE_ENTRANCE = 1 local TELE_MODE_EXIT = 2 local ClassMaxHealthTable = { 125, 125, 200, 175, 150, 300, 175, 125, 125, 200, } local ClassViewHeightTable = { 65, 75, 68, 68, 75, 75, 68, 75, 68, 65, } local CritCondTable = { TF_COND_CRITBOOSTED, TF_COND_CRITBOOSTED_PUMPKIN, TF_COND_CRITBOOSTED_USER_BUFF, TF_COND_CRITBOOSTED_FIRST_BLOOD, TF_COND_CRITBOOSTED_BONUS_TIME, TF_COND_CRITBOOSTED_CTF_CAPTURE, TF_COND_CRITBOOSTED_RAGE_BUFF, TF_COND_CRITBOOSTED_CARD_EFFECT, TF_COND_CRITBOOSTED_RUNE_TEMP, } local InvulnerableCondTable = { TF_COND_INVULNERABLE, TF_COND_INVULNERABLE_HIDE_UNLESS_DAMAGED, TF_COND_INVULNERABLE_USER_BUFF, TF_COND_INVULNERABLE_CARD_EFFECT, } local function GetMaxClassHealth(player) if player:IsPlayer() then return ClassMaxHealthTable[player.m_iClass] elseif not player:IsPlayer() then return 0 elseif player:IsObject() then return player.m_iMaxHealth end end local function GetViewHeight(player) local scale = player.m_flModelScale local normalheight = ClassViewHeightTable[player.m_iClass] return normalheight * scale end local function GetCamera(player) local origin = player:GetAbsOrigin() local height = GetViewHeight(player) return origin + height end local function GetMaxHealth(player) if player:IsPlayer() then local additive = player:GetAttributeValueByClass("add_maxhealth", 0) local multiplicative = player:GetAttributeValue("mult max health", true) local classhp = GetMaxClassHealth(player) if additive == nil then additive = 0 end if multiplicative == nil then multiplicative = 1 end local result = (classhp * multiplicative) + additive if result < 1 then result = 1 end return math.ceil(result) end return player.m_iMaxHealth end local function GetEyeAngles(player) return Vector(player.m_angEyeAngles[1], player.m_angEyeAngles[2], player.m_angEyeAngles[3]) end local function GetVelocity(entity) return Vector(entity.m_vecVelocity[1], entity.m_vecVelocity[2], entity.m_vecVelocity[3]) end local function GetViewModel(player) for _, vm in pairs(ents.FindAllByClass("tf_viewmodel")) do if vm.m_hOwner == player then return vm end end end local function IsSameTeam(ent1, ent2) if ent1.m_iTeamNum == ent2.m_iTeamNum then return true end return false end local function IsMiniBoss(player) if player.m_bIsMiniBoss == 1 then return true end return false end local function IsInvulnerable(player) for _, cond in pairs(InvulnerableCondTable) do if player:InCond(cond) then break return true end end return false end local function IsCritBoosted(player) for _, cond in pairs(CritCondTable) do if player:InCond(cond) then break return true end end return false end local function NextTime(seconds) local globaltime = CurTime() local newtime = globaltime + seconds return newtime end local function GetBuilding(player, buildtype) for _, build in pairs(ents.FindAllByClass("obj_*")) do if build.m_hBuilder == player and build.m_iObjectType == buildtype then break return build end end end