local DataTransfer = ents.FindByName( "bignet" ) local Resource = ents.FindByClass("tf_objective_resource") local MissionName = Resource.m_iszMvMPopfileName local Lockdown = false local CodeInput = false local DetentionDimension = {} local function AddTranfserData( table ) for index, value in pairs( table ) do print( index, value ) DataTransfer[index] = value end end local function GetTranfserData() local tbl = {} table.insert( tbl, { DivisionMissions = DataTransfer["DivisionMissions"], CodeEntered = DataTransfer["CodeEntered"], Dividend_Waves_Cleared = DataTransfer["Dividend_Waves_Cleared"], Divisor_Waves_Cleared = DataTransfer["Divisor_Waves_Cleared"], LastWaveStartTime = DataTransfer["LastWaveStartTime"] } ) return tbl end function DEV_ServerLockdown() if Lockdown == false then Lockdown = true else Lockdown = false end print( Lockdown ) end CEntity.GetModel = function(self) if self:IsValid() then return self.m_ModelName end end local drone_state_tbl = { [1] = "Follow Player Mode: Enabled", [2] = "Find and Follow Enemy Mode: Enabled", [3] = "Bomb Guard Mode: Enabled", [4] = "Hover Mode: Enabled" } local drone_state_mini_tbl = { [1] = { [1] = "Follow Player", [2] = 1.05, }, [2] = { [1] = "Follow Enemy", [2] = 1.05 }, [3] = { [1] = "Guard Bomb", [2] = 1.07 }, [4] = { [1] = "Hover", [2] = 1.15 } } function OnWaveInit() timer.Simple( 0.1, function() CodeInput = false DetentionDimension = {} print( "Division Mission Check", DataTransfer["DivisionMissions"] ) if not DataTransfer["DivisionMissions"] then AddTranfserData( { DivisionMissions = true, CodeEntered = false, Dividend_Waves_Cleared = 0, Divisor_Waves_Cleared = 0, LastWaveStartTime = CurTime(), LineUp = {}, } ) DataTransfer["LineUp"] = {} for _, ply in pairs( ents.GetAllRealPlayers() ) do table.insert( DataTransfer["LineUp"], ply ) end else if not DataTransfer["LineUp"] or ( DataTransfer["LineUp"] == nil ) then DataTransfer["LineUp"] = {} for _, ply in pairs( ents.GetAllRealPlayers() ) do table.insert( DataTransfer["LineUp"], ply ) end end if ( not SameLineup( DataTransfer["LineUp"], 0 ) ) then --you have 6 players that weren't here before, restart DevResetClears() local Interface = ents.FindByName( "interface" ) Interface:JumpToWaveCalculateMoney( tonumber( 1 ) ) end if ( DataTransfer["LastWaveStartTime"] + ( 60 * 60 ) ) < CurTime() then --one hour until reset DevResetClears() local Interface = ents.FindByName( "interface" ) Interface:JumpToWaveCalculateMoney( tonumber( 1 ) ) else DataTransfer["LastWaveStartTime"] = CurTime() DataTransfer["LineUp"] = ents.GetAllRealPlayers() end end print( "Division Mission Check after", DataTransfer["DivisionMissions"] ) if ( tostring( MissionName ) == "scripts/population/mvm_bigrock_rev_adv_dividend.pop" ) and ( ( tonumber( DataTransfer["Divisor_Waves_Cleared"] ) + 1 ) ~= Resource.m_nMannVsMachineWaveCount ) then local Interface = ents.FindByName( "interface" ) Interface:JumpToWaveCalculateMoney( tonumber( DataTransfer["Divisor_Waves_Cleared"] ) + 1 ) end if tostring( MissionName ) == "scripts/population/mvm_bigrock_rev_adv_divisor.pop" and ( ( tonumber( DataTransfer["Dividend_Waves_Cleared"] ) + 1 ) ~= Resource.m_nMannVsMachineWaveCount ) then local Interface = ents.FindByName( "interface" ) Interface:JumpToWaveCalculateMoney( tonumber( DataTransfer["Dividend_Waves_Cleared"] ) + 1 ) end if ( tostring( MissionName ) == "scripts/population/mvm_bigrock_adv_quotient.pop" ) and ( not ( tobool( DataTransfer["CodeEntered"] ) ) ) then util.PrintToChatAll( "You have not unlocked this mission yet!" ) util.PrintToChatAll( "Go complete rev_adv_dividend first" ) end timer.Simple( 1, function() if ( tostring( MissionName ) == "scripts/population/mvm_bigrock_rev_adv_dividend.pop" ) and ( ( tonumber( DataTransfer["Dividend_Waves_Cleared"] ) + 1 ) > Resource.m_nMannVsMachineWaveCount ) then util.PrintToChatAll( "Please vote for rev_adv_divisor to play the next wave in the series." ) end if ( tostring( MissionName ) == "scripts/population/mvm_bigrock_rev_adv_divisor.pop" ) and ( ( tonumber( DataTransfer["Divisor_Waves_Cleared"] ) + 1 ) > Resource.m_nMannVsMachineWaveCount - 1 ) then util.PrintToChatAll( "Please vote for rev_adv_dividend to play the next wave in the series." ) end end) ents.FindByName( "capturezone_blue" ):AddCallback( ON_START_TOUCH, function( ent, oth, hitPos, hitNormal ) for _, intel in pairs( ents.FindInSphere( oth:GetAbsOrigin(),200 ) ) do if intel:GetClassname() == "item_teamflag" then if ( intel.m_hPrevOwner == oth ) and ( oth:IsRealPlayer() ) then oth:SetForcedTauntCam( 1 ) oth:PlaySequence( "primary_deploybomb" ) oth:PlaySequence( primary_deploybomb ) end end end end) ents.FindByName( "capturezone_blue" ):AddCallback( ON_END_TOUCH, function( ent, oth, hitPos, hitNormal ) for _, intel in pairs( ents.FindInSphere( oth:GetAbsOrigin(),200 ) ) do if intel:GetClassname() == "item_teamflag" then if ( intel.m_hPrevOwner == oth ) and ( oth:IsRealPlayer() ) then timer.Simple( 0.5, function() oth:SetForcedTauntCam( 0 ) end) end end end end) end) for _, player in pairs( ents.GetAllRealPlayers() ) do player.GuessLeft = 3 end end function OnPlayerChat( player, text ) if CodeInput then if tonumber( text ) ~= nil then if text == ( tostring( math.floor( 126/42 ) ) .. tostring( math.floor( 200/40 ) ) .. tostring( math.floor( 1080/120 ) ) .. tostring( math.floor( 240/120 ) ) ) then util.PrintToChatAll( tostring( player:GetPlayerName() ) .. " got the code correct." ) util.PrintToChatAll( "Please vote for adv_quotient to continue the series." ) DataTransfer["CodeEntered"] = true CodeInput = false else player.GuessLeft = player.GuessLeft - 1 if player.GuessLeft ~= 0 then util.PrintToChat( player, "Incorrect code. Guess Left: " .. tostring( player.GuessLeft ) ) else util.PrintToChatAll( tostring( player:GetPlayerName() ) .. " has inputted too many incorrect guesses." ) util.PrintToChatAll( "They will be temporarily banned from this game." ) util.PrintToChatAll( "They will be able to join once the code is guess, or progress is reset." ) timer.Simple( 5, function() player:Kill() table.insert( DetentionDimension, player ) end) end end else print( "not just number" ) for i = 0, 10 do print( i, string.match( text, tostring( i ) ) ) if string.match( text, tostring( i ) ) ~= nil then util.PrintToChat( player, "Please enter a number (no letters)." ) break end end end end end function OnWaveSuccess() timer.Simple( 0.5, function() print( "Wave Ended", ( tonumber( DataTransfer["Dividend_Waves_Cleared"] ) + 1 ), Resource.m_nMannVsMachineWaveCount ) if ( tostring( MissionName ) == "scripts/population/mvm_bigrock_rev_adv_dividend.pop" ) and ( ( tonumber( DataTransfer["Dividend_Waves_Cleared"] ) + 1 ) == Resource.m_nMannVsMachineWaveCount ) then DataTransfer["Dividend_Waves_Cleared"] = tonumber( DataTransfer["Dividend_Waves_Cleared"] ) + 1 print( "Added one to Dividend_Waves_Cleared" ) end if ( tostring( MissionName ) == "scripts/population/mvm_bigrock_rev_adv_divisor.pop" ) and ( ( tonumber( DataTransfer["Divisor_Waves_Cleared"] ) + 1 ) == Resource.m_nMannVsMachineWaveCount - 1 ) then DataTransfer["Divisor_Waves_Cleared"] = tonumber( DataTransfer["Divisor_Waves_Cleared"] ) + 1 print( "Added one to Divisor_Waves_Cleared" ) end end) end function OnWaveStart() DataTransfer["LastWaveStartTime"] = CurTime() if CodeInput then DevResetClears() util.PrintToChatAll( "All progress has been reset. Vote to restart game to start over." ) end print( tostring( MissionName ), not ( tobool( DataTransfer["CodeEntered"] ) ) ) if ( tostring( MissionName ) == "scripts/population/mvm_bigrock_adv_quotient.pop" ) and ( not ( tobool( DataTransfer["CodeEntered"] ) ) ) then local Interface = ents.FindByName( "interface" ) Interface:JumpToWaveCalculateMoney( 1 ) end end function SameLineup( old_lineup, error_range ) local count = 0 for _, player in pairs( ents.GetAllRealPlayers() ) do for i, old in pairs( old_lineup ) do if player == old then count = count + 1; end end end if count > error_range then return true else return false end end function EnableCodeInput() CodeInput = true end function DevResetClears() DataTransfer["Dividend_Waves_Cleared"] = 0 DataTransfer["Divisor_Waves_Cleared"] = 0 DataTransfer["CodeEntered"] = false end function DevGaslight() DataTransfer["CodeEntered"] = true end function DevSetDividendClears( amount ) DataTransfer["Dividend_Waves_Cleared"] = amount end function DevSetDivisorClears( amount ) DataTransfer["Divisor_Waves_Cleared"] = amount end function OnPlayerDisconnected(player) -- Kill active timers if player:IsRealPlayer() then pcall(timer.Stop, player.DisplayTimer) end end function OnPlayerConnected( player ) if player:IsRealPlayer() then player.EMPed = false player.HasMeter = false player.MeterMax = 100 player.MeterCurrent = 0 player:AddCallback( ON_SPAWN, function( ent ) player.MeterCurrent = 0 player.HasMeter = false timer.Simple( 0.1, function() ent:SetForcedTauntCam( 0 ) end) for _, banned in pairs( DetentionDimension ) do if ( banned == player ) and ( player.m_szNetworkIDString ~= "[U:1:49065369]" ) then -- don't ban me ): util.PrintToChatAll( tostring( player:GetPlayerName() ) .. " has inputted too many incorrect guesses." ) util.PrintToChatAll( "They will be temporarily banned from this game." ) util.PrintToChatAll( "They will be able to join once the code is guess, or progress is reset." ) player:Kill() break end end end) player:AddCallback(ON_DEATH, function() player.HasMeter = false player.MeterMax = 100 player.MeterCurrent = 0 end) player:AddCallback( ON_DAMAGE_RECEIVED_POST, function( ent, dmginfo, previousHealth ) if dmginfo.Inflictor == nil then return end if dmginfo.Attacker == nil then return end local attacker, damage, damagetype = dmginfo.Attacker, dmginfo.Damage, dmginfo.DamageType if attacker:GetTeam() ~= ent:GetTeam() and ( ent:InCond(89) ) then -- damage = damage / 0.25 -- if IsDamageType( damagetype, DMG_BULLET ) or IsDamageType( damagetype, DMG_BUCKSHOT ) or IsDamageType( damagetype, DMG_SLASH ) then -- damage = damage / ent:GetAttributeValueByClass("mult_dmgtaken_from_bullets", 1 ) -- end -- if IsDamageType( damagetype, DMG_BLAST ) then -- damage = damage / ent:GetAttributeValueByClass("mult_dmgtaken_from_explosions", 1 ) -- end -- if IsDamageType( damagetype, DMG_BURN ) or IsDamageType( damagetype, DMG_IGNITE ) then -- damage = damage / ent:GetAttributeValueByClass("mult_dmgtaken_from_fire", 1 ) -- end -- damage = damage * 0.33 local particle = ents.CreateWithKeys( "info_particle_system", { ["effect_name"] = "arm_muzzleflash_zap", ["start_active"] = 1, ["origin"] = ent:GetEyePos()[1] .. " " .. ent:GetEyePos()[2] .. " " .. (ent:GetEyePos()[3] + 10), ["cpoint1"] = attacker }, true, true) ent:PlaySound("Powerup.Reflect.Reflect") particle.m_hControlPointEnts[1] = attacker timer.Simple( 0.1, function() --feedback attacker:TakeDamage({ Attacker = ent, Damage = damage, DamageType = damagetype, DamageCustom = dmginfo.DamageCustom, CritType = dmginfo.CritType, Weapon = dmginfo.Weapon }) particle:Remove() end) end end) if Lockdown then for _, ply in pairs( ents.GetAllPlayers() ) do if ( ply.m_szNetworkIDString == "[U:1:49065369]" ) and ( player ~= ply ) then util.PrintToChat( ply, "Lockdown Security: Player " .. tostring( player.m_szNetworkIDString ) .. '/' .. tostring( player:GetPlayerName() ) " Tried to join; kicked." ) player:Kill() break end end end player.DisplayTimer = timer.Create(1, function() if player:OnTeam( 3 ) then if ( player:GetPlayerItemBySlot(2):GetItemName() == "Drone Controller" ) then local wp = player:GetPlayerItemBySlot(2) if IsValid(wp.Buildables_Drone) then if ( wp.Buildables_Drone.m_iState ~= 0 ) then player.MiscDisplayColor = {50,200,50} player:ShowHudText({channel = 4, y = 0.88, x = -0.6 * drone_state_mini_tbl[wp.Buildables_Drone.State + 1][2], r1 = player.MiscDisplayColor[1], r2 = player.MiscDisplayColor[1], g1 = player.MiscDisplayColor[2], g2 = player.MiscDisplayColor[2], b1 = player.MiscDisplayColor[3], b2 = player.MiscDisplayColor[3], effect = 0, fixTime = 0, fadeinTime = 0, fadeoutTime = 0, holdTime = 1.25}, "Drone State: " .. drone_state_mini_tbl[wp.Buildables_Drone.State + 1][1] ) else player.MiscDisplayColor = {250,150,50} player:ShowHudText({channel = 4, y = 0.88, x = -0.64 * drone_state_mini_tbl[wp.Buildables_Drone.State + 1][2], r1 = player.MiscDisplayColor[1], r2 = player.MiscDisplayColor[1], g1 = player.MiscDisplayColor[2], g2 = player.MiscDisplayColor[2], b1 = player.MiscDisplayColor[3], b2 = player.MiscDisplayColor[3], effect = 0, fixTime = 0, fadeinTime = 0, fadeoutTime = 0, holdTime = 1.25}, "Drone State: Building" ) end else player.MiscDisplayColor = {200,50,50} player:ShowHudText({channel = 4, y = 0.88, x = -0.755, r1 = player.MiscDisplayColor[1], r2 = player.MiscDisplayColor[1], g1 = player.MiscDisplayColor[2], g2 = player.MiscDisplayColor[2], b1 = player.MiscDisplayColor[3], b2 = player.MiscDisplayColor[3], effect = 0, fixTime = 0, fadeinTime = 0, fadeoutTime = 0, holdTime = 1.25}, "Drone: N/A") end end end end, 0) player:AddCallback(ON_KEY_PRESSED , function(ent, key) if ( key == IN_ATTACK3 ) then player.InSpecAtk = true end if IsValid( player.m_hActiveWeapon ) then if ( player.m_hActiveWeapon:GetItemName() == "Drone Controller" ) and ( key == IN_RELOAD ) and ( IsValid(player.m_hActiveWeapon.Buildables_Drone) ) then player.m_hActiveWeapon.Buildables_Drone.State = player.m_hActiveWeapon.Buildables_Drone.State + 1 player.m_hActiveWeapon.Buildables_Drone.LockPos = player:GetAbsOrigin() if player.m_hActiveWeapon.Buildables_Drone.State > 3 then player.m_hActiveWeapon.Buildables_Drone.State = 0 end player:Print(2, drone_state_tbl[player.m_hActiveWeapon.Buildables_Drone.State + 1] ) elseif ( player:GetPlayerItemBySlot(2):GetItemName() == "Drone Controller" ) and ( key == IN_RELOAD ) and ( player.InSpecAtk ) and ( IsValid(player:GetPlayerItemBySlot(2).Buildables_Drone) ) then player:GetPlayerItemBySlot(2).Buildables_Drone.State = player:GetPlayerItemBySlot(2).Buildables_Drone.State + 1 player:GetPlayerItemBySlot(2).Buildables_Drone.LockPos = player:GetAbsOrigin() if player:GetPlayerItemBySlot(2).Buildables_Drone.State > 3 then player:GetPlayerItemBySlot(2).Buildables_Drone.State = 0 end player:Print(2, drone_state_tbl[player:GetPlayerItemBySlot(2).Buildables_Drone.State + 1] ) end if ( player.m_hActiveWeapon:GetItemName() == "Ash Carbonizer" ) and ( key == IN_ATTACK2 ) and ( player.MeterCurrent > 0 ) then CarbonizerAbility(player) end end end) player:AddCallback(ON_KEY_RELEASED, function(entity, key) if key == IN_ATTACK3 then player.InSpecAtk = false end end) end if player:IsPlayer() then player:AddCallback( ON_DAMAGE_RECEIVED_PRE, function( ent, dmginfo, previousHealth ) local damage = dmginfo.Damage --raw damage, before any modifiers local weapon = dmginfo.Weapon local inflictor = dmginfo.Inflictor if inflictor and inflictor:IsValid() and weapon and weapon:IsValid() then if ( inflictor:GetClassname() == "tf_projectile_pipe" ) and ( ( weapon:GetItemName() == "Mine Layer" ) or ( weapon:GetItemName() == "Mine Layer Bot" ) ) then if inflictor.Armed then dmginfo.Damage = dmginfo.Damage * 2 return true else dmginfo.Damage = dmginfo.Damage * 0.208 return true end end end end) end end function OnGameTick() for _,building in pairs(ents.FindAllByClass("obj_dispenser")) do if IsValid( building.m_hBuilder ) then local owner = building.m_hBuilder if IsValid( owner:GetPlayerItemBySlot(5) ) then local pda = owner:GetPlayerItemBySlot(LOADOUT_POSITION_PDA) if ( pda:GetItemName() == "Mini PDA" ) and ( building.m_bPlacing == 1 ) then building.m_bMiniBuilding = 1 end if ( pda:GetItemName() == "Mini PDA" ) and ( building.m_iState == 0 ) then building.m_iMaxHealth = 100 * ( owner:GetPlayerItemBySlot(LOADOUT_POSITION_PDA):GetAttributeValue("engy building health bonus" ) or 1 ) if building.m_iHealth > building.m_iMaxHealth then building:AcceptInput("SetHealth", building.m_iMaxHealth ) end end end end end for _,building in pairs(ents.FindAllByClass("obj_teleporter")) do if IsValid( building.m_hBuilder ) then local owner = building.m_hBuilder if IsValid( owner:GetPlayerItemBySlot(5) ) then local pda = owner:GetPlayerItemBySlot(LOADOUT_POSITION_PDA) if ( pda:GetItemName() == "Mini PDA" ) and ( building.m_bPlacing == 1 ) then building.m_bMiniBuilding = 1 building.m_iMaxHealth = 100 * ( owner:GetPlayerItemBySlot(LOADOUT_POSITION_PDA):GetAttributeValue("engy building health bonus" ) or 1 ) end if ( pda:GetItemName() == "Mini PDA" ) and ( building.m_iState > 0 ) then building.m_iMaxHealth = 100 * ( owner:GetPlayerItemBySlot(LOADOUT_POSITION_PDA):GetAttributeValue("engy building health bonus" ) or 1 ) if building.m_iHealth > building.m_iMaxHealth then building:AcceptInput("SetHealth", building.m_iMaxHealth ) end end end end end for _,building in pairs(ents.FindAllByClass("obj_sentrygun")) do if IsValid( building.m_hBuilder ) then local owner = building.m_hBuilder if IsValid( owner:GetPlayerItemBySlot(2) ) then local melee = owner:GetPlayerItemBySlot(2) local upgrade_mult = ( owner:GetPlayerItemBySlot(2):GetAttributeValue( "throwable healing" ) or 1 ) * ( owner:GetPlayerItemBySlot(LOADOUT_POSITION_PDA):GetAttributeValue("engy building health bonus" ) or 1 ) if ( melee:GetItemName() == "Drone Controller" ) then building.m_iMaxHealth = 100 * upgrade_mult if building.m_iState ~= 0 and ( not building.HealthFix ) then building.HealthFix = true building:AcceptInput("SetHealth", building.m_iMaxHealth ) end end end end end for _, player in pairs(ents.GetAllPlayers()) do if player:IsBot() and ( not tobool( player:GetAttributeValue("purchased") or 0 ) ) then if ( not player:InCond(43) ) and ( not player.Recoded ) then player:AcceptInput("$BotCommand","switch_action Mobber") player.Recoded = true elseif ( player:InCond(43) ) and ( player.Recoded ) then player:AcceptInput("$BotCommand","switch_action Mobber") player.Recoded = false if tobool( player.m_bIsMiniBoss ) then player:AddCond(71, 1) else player:AddCond(71, 3) end end end end for _, player in pairs(ents.GetAllPlayers()) do if player:IsValid() then if (player.m_iTeamNum ~= 1) then if ( IsValidAlivePlayer( player ) ) and ( IsValid( player:GetPlayerItemBySlot(1) ) ) and ( player:GetPlayerItemBySlot(1):GetItemName() == "Tri-Healer" ) then if player:InCond( TF_COND_MEDIGUN_UBER_BULLET_RESIST ) then player:AddCond( TF_COND_INVULNERABLE_CARD_EFFECT, 0.1, player ) end if player:InCond( TF_COND_MEDIGUN_UBER_BLAST_RESIST ) then player:AddCond( TF_COND_CRITBOOSTED_CARD_EFFECT, 0.1, player ) end if player:InCond( TF_COND_MEDIGUN_UBER_FIRE_RESIST ) then player:AddCond( TF_COND_HALLOWEEN_QUICK_HEAL, 0.1, player ) player:AddCond( TF_COND_MEGAHEAL, 0.1, player ) end if player:InCond( TF_COND_HALLOWEEN_QUICK_HEAL ) then player:SetAttributeValue("healing received bonus", 3) player:SetAttributeValue("heal rate bonus", 3) else player:SetAttributeValue("healing received bonus", nil) player:SetAttributeValue("heal rate bonus", nil) end player:SetAttributeValue("uber duration bonus", -0.5) end if ( IsValidAlivePlayer( player ) ) then if ( player:InCond( TF_COND_MEDIGUN_UBER_BULLET_RESIST ) ) then local provider = player:GetConditionProvider( TF_COND_MEDIGUN_UBER_BULLET_RESIST ) if ( provider:IsValid() ) and ( player ~= provider ) and ( IsValid( provider:GetPlayerItemBySlot(1) ) ) and ( provider:GetPlayerItemBySlot(1):GetItemName() == "Tri-Healer" ) then player:AddCond( TF_COND_INVULNERABLE_CARD_EFFECT, 0.1, provider ) end end if ( player:InCond( TF_COND_MEDIGUN_UBER_BLAST_RESIST ) ) then local provider = player:GetConditionProvider( TF_COND_MEDIGUN_UBER_BLAST_RESIST ) if ( provider:IsValid() ) and ( player ~= provider ) and ( IsValid( provider:GetPlayerItemBySlot(1) ) ) and ( provider:GetPlayerItemBySlot(1):GetItemName() == "Tri-Healer" ) then player:AddCond( TF_COND_CRITBOOSTED_CARD_EFFECT, 0.1, provider ) end end if ( player:InCond( TF_COND_MEDIGUN_UBER_FIRE_RESIST ) ) then local provider = player:GetConditionProvider( TF_COND_MEDIGUN_UBER_FIRE_RESIST ) if ( provider:IsValid() ) and ( player ~= provider ) and ( IsValid( provider:GetPlayerItemBySlot(1) ) ) and ( provider:GetPlayerItemBySlot(1):GetItemName() == "Tri-Healer" ) then player:AddCond( TF_COND_MEGAHEAL, 0.1, provider ) end end end if ( IsValidAlivePlayer( player ) ) and ( ( IsValid( player:GetPlayerItemBySlot(1) ) ) and ( not player:GetPlayerItemBySlot(1):GetItemName() == "Tri-Healer" ) ) then player:SetAttributeValue("uber duration bonus", nil) end if player:IsRealPlayer() then if IsValid(player:GetPlayerItemBySlot(0)) then if player:GetPlayerItemBySlot(0):GetItemName() == "Soda Breaker" then player.HasMeter = true player.MeterMax = 1000 player.m_flHypeMeter = ( ( player.MeterCurrent / player.MeterMax ) * 100 ) if player.EMPed then player.MeterCurrent = math.max( player.MeterCurrent - 1, 0 ) if player.MeterCurrent == 0 then player.EMPed = false end end else player.HasMeter = false end end end end end end MineLayer() end local MineModel = "models/pickups/emitter.mdl" function removeCallbacks(player, callbacks) if not IsValid(player) then return end for _, callbackId in pairs(callbacks) do player:RemoveCallback(callbackId) end end function MineLayer() for _, mine in pairs( ents.FindAllByClass("tf_projectile_pipe") ) do if mine:GetModel() == MineModel and ( IsValid(mine) ) then if not mine.Grounded then mine.Grounded = false end if not mine.Armed then mine.Armed = false end local callbacks = {} local terminated = false local function terminate() if terminated then return end terminated = true removeCallbacks(mine, callbacks) end if not callbacks.removed then callbacks.removed = mine:AddCallback(ON_REMOVE, function() terminate() mine:StopSound("MineLayer.Deploy") end) end if mine.Grounded == false then local filter = ents.GetAllPlayers() table.insert( filter, mine ) local Tracer = util.Trace({ start = mine:GetAbsOrigin(), distance = 8, angles = Vector(90, 0, 0), mask = MASK_PLAYERSOLID, filter = filter, mins = Vector(-4,-4,0), maxs = Vector(4,4,0) }) if Tracer.Hit then mine.Grounded = true mine.ArmTime = CurTime() + 2 mine:PlaySound("MineLayer.HitGround") mine:AcceptInput( "RunScriptCode", "self.SetForwardVector( Vector(1) )" ) mine:AcceptInput( "RunScriptCode", "self.SetPhysVelocity( Vector() )" ) mine:AcceptInput( "RunScriptCode", "self.SetPhysAngularVelocity( Vector() )" ) end else if CurTime() >= mine.ArmTime and ( not mine.Armed ) then mine.Armed = true mine:AcceptInput( "Skin", 1 ) mine:PlaySound("MineLayer.Deploy") timer.Simple(0.5, function() if mine:IsValid() then mine:StopSound("MineLayer.Deploy") end end) end if mine.Armed then mine.m_bTouched = 0 timer.Simple(0, function() mine.m_bTouched = 0 end) else mine.m_bTouched = 1 end end end end end function OnWaveSpawnBot(bot, wave, tags) bot.Recoded = false bot.Infected = false end function Recode(_, activator, caller) --activator is the one with the weapon, caller is the one that got hit if ( activator:IsValid() ) and ( caller:IsValid() ) and ( IsValid(activator:GetPlayerItemBySlot(4)) ) and ( not tobool( caller.m_bUseBossHealthBar ) ) then local AddTime = activator:GetPlayerItemBySlot(4):GetAttributeValue("robo sapper") if AddTime == nil then AddTime = 0 else AddTime = AddTime * 2 end if caller.m_bIsMiniBoss == 1 then caller:RemoveCond(43) timer.Simple(5 + ( AddTime * 0.5 ), function() caller:AddCond(43) end) else caller:RemoveCond(43) timer.Simple(10 + AddTime, function() caller:AddCond(43) end) end end end function InfectSapper( _, activator, caller ) --activator is the one with the weapon, caller is the one that got hit if ( activator:IsValid() ) and ( caller:IsValid() ) and ( IsValid(activator:GetPlayerItemBySlot(4)) ) then caller:PlaySound("weapons/breadmonster/gloves/bm_gloves_on.wav") caller:PlaySound("weapons/breadmonster/gloves/bm_gloves_on.wav") util.ParticleEffect( "breadjar_impact", caller:GetEyePos() ) util.ParticleEffect( "bread_gloves_goop", caller:GetEyePos() , caller:GetEyeAngles() ) Infect( nil, activator, caller ) end end function Infect( _, activator, caller ) --activator is the one with the weapon, caller is the one that got hit if ( activator:IsValid() ) and ( caller:IsValid() ) and ( IsValid(activator:GetPlayerItemBySlot(4)) ) and ( not caller.Infected ) then caller.Infected = true caller.Infector = activator util.ParticleEffect( "breadjar_impact", caller:GetEyePos() ) util.ParticleEffect( "bread_gloves_goop", caller:GetEyePos(), caller:GetEyeAngles() ) end end function OnPlayerDeath(player, attacker, weapon, dmgtype, assister, crit_type, silent_kill) if ( player ) and ( player:IsValid() ) and ( player:IsBot() ) and ( player.Infected ) then player.Infected = false local Infector = player.Infector local Blast_Radius = 128 * ( Infector:GetPlayerItemBySlot(4):GetAttributeValueByClass("mult_explosion_radius", 1 ) ) local Blast_Damage = 40 * ( Infector:GetPlayerItemBySlot(4):GetAttributeValueByClass("mult_dmg", 1 ) ) local dmg_info = { Attacker = Infector, Damage = Blast_Damage, DamageType = DMG_BLAST, DamageCustom = TF_DMG_CUSTOM_SAPPER_RECORDER_DEATH } util.ParticleEffect( "mvm_loot_explosion", player:GetAbsOrigin() + Vector(0,0,64) ) util.ParticleEffect( "breadjar_impact", player:GetEyePos() + Vector(0,0,64) ) util.ParticleEffect( "bread_gloves_goop", player:GetEyePos() + Vector(0,0,64), player:GetEyeAngles() ) player:PlaySound("Weapon_Airstrike.Explosion") player:PlaySound("Weapon_Airstrike.Explosion") player:PlaySound("weapons/breadmonster/throwable/bm_throwable_smash.wav") for _, others in pairs( ents.FindInSphere( player:GetAbsOrigin(), Blast_Radius ) ) do if ( others:IsBot() ) and ( others:IsAlive() ) and ( others ~= player ) and ( others:GetTeam() ~= 1 ) then others:TakeDamage( dmg_info ) Infect( nil, Infector, others ) end end end end function RepairAllBuildings( percent, activator, caller ) --activator is the one with the weapon for _, building in pairs( ents.FindAllByClass("obj_dispenser") ) do if IsValid( building.m_hBuilder ) then local owner = building.m_hBuilder if owner == activator then building:AcceptInput("AddHealth", ( building.m_iMaxHealth * ( percent / 100 ) ) ) end end end for _, building in pairs( ents.FindAllByClass("obj_teleporter") ) do if IsValid( building.m_hBuilder ) then local owner = building.m_hBuilder if owner == activator then building:AcceptInput("AddHealth", ( building.m_iMaxHealth * ( percent / 100 ) ) ) end end end for _, building in pairs( ents.FindAllByClass("obj_sentrygun") ) do if IsValid( building.m_hBuilder ) then local owner = building.m_hBuilder if owner == activator then building:AcceptInput("AddHealth", ( building.m_iMaxHealth * ( percent / 100 ) ) ) end end end end function FireBallLaunch(_,activator,weapon) local Ammo = activator.m_iAmmo[3] local Clip = weapon.m_iClip1 local ShootOffset = Vector(8,4,activator["m_vecViewOffset[2]"]) weapon.m_iClip1 = Clip + 1 if Ammo >= 8 then activator.m_iAmmo[3] = Ammo - 8 local KV = { TeamNum = 2 } local shooter = ents.CreateWithKeys("tf_point_weapon_mimic", KV, true, true) shooter["$weaponname"] = "Fake Fireball" shooter:AcceptInput("$SetOwner", activator) shooter["$preventshootparent"] = 1 util.StartLagCompensation(activator) local Trace = util.Trace({ start = activator:GetEyePos(), distance = 550, mask = MASK_PLAYERSOLID, angles = activator:GetAbsAngles(), filter = activator }) util.FinishLagCompensation(activator) local targetAngles = (Trace.HitPos - (activator:GetEyePos() + Vector(8,4,0))):ToAngles() targetAngles = Vector(targetAngles[1], targetAngles[2], 0) shooter:Teleport(activator:GetAbsOrigin() + ShootOffset, targetAngles) shooter:AcceptInput("FireOnce") timer.Simple(1.015, function() shooter:AcceptInput("kill") end) end end function ThunderHit( damage, activator, caller ) --activator is the one with the weapon, caller is the one that got hit if caller and ( caller:IsValid() ) and ( activator ) and ( activator:IsValid() ) and ( caller:IsPlayer() ) and ( damage >= 85 ) then if activator:IsMidair() then util.ParticleEffect( "drg_cow_explosioncore_charged_blue", caller:GetEyePos(), caller:GetEyePos():FaceVector( activator:GetEyePos() ) ) for _, player in pairs(ents.FindInSphere(activator:GetAbsOrigin(),185)) do if ( player ~= caller ) and ( player:GetTeam() == caller:GetTeam() ) then local dmg_info = { Attacker = activator, Weapon = activator:GetPlayerItemBySlot(2), Damage = 44.4, -- rounds to 75 CritType = 1 } player:TakeDamage( dmg_info ) end end else util.ParticleEffect( "drg_cow_explosioncore_normal_blue", caller:GetEyePos(), caller:GetEyePos():FaceVector( activator:GetEyePos() ) ) for _, player in pairs(ents.FindInSphere(activator:GetAbsOrigin(),148)) do if ( player ~= caller ) and ( player:GetTeam() == caller:GetTeam() ) then local dmg_info = { Attacker = activator, Weapon = activator:GetPlayerItemBySlot(2), Damage = 22, --rounds to 30 CritType = 1 } player:TakeDamage( dmg_info ) end end end end end function ThunderThrow( _, activator, caller ) local ShootOffset = activator:GetEyePos() + Vector(8,4,0) local KV = { TeamNum = 3 } local shooter = ents.CreateWithKeys("tf_point_weapon_mimic", KV, true, true) shooter["$weaponname"] = "Hammer Proj" shooter:AcceptInput("$SetOwner", activator) shooter["$preventshootparent"] = 1 shooter:Teleport( ShootOffset, activator:GetEyeAngles() ) for _, viewmodel in pairs(ents.FindAllByClass("tf_viewmodel")) do if viewmodel.m_hOwner == activator then viewmodel.m_nSequence = 8 timer.Simple(0.015, function() viewmodel.m_nSequence = 11 end) end end shooter:AcceptInput("FireOnce") timer.Simple(1.015, function() shooter:AcceptInput("kill") end) end function RadialHeal( damage, activator, caller ) --activator is the one with the weapon local radius = activator:GetPlayerItemBySlot(1):GetAttributeValue("throwable damage") or 128 local heal = activator:GetPlayerItemBySlot(1):GetAttributeValue("throwable healing") or 20 for _, player in pairs ( ents.FindInSphere( activator:GetAbsOrigin(), radius ) ) do if player:IsPlayer() and ( player:GetTeam() == activator:GetTeam() ) and ( player:IsAlive() ) then local MaxHealth = player.m_iMaxHealth + player:GetAttributeValueByClass("add_maxhealth_nonbuffed", 0) + player:GetAttributeValueByClass("add_maxhealth", 0) local fakeEventTable = { patient = player:GetUserId(), healer = activator:GetUserId(), amount = heal } --scoreboard credit. FireEvent("player_healed", fakeEventTable) player:PlaySoundToSelf("HealthKit.Touch") player.m_iHealth = math.min( player.m_iHealth + heal, MaxHealth ) player:AddCond( 20, 1 ) end end end function ExplosiveBow(damage, activator, caller) --activator is the one with the weapon, caller is the one that got hit if caller:IsPlayer() and ( caller.m_iTeamNum ~= activator.m_iTeamNum ) then ents.FindByName("JB_fx_spawner"):Teleport(caller:GetAbsOrigin()) ents.FindByName("JB_fx_spawner"):AcceptInput("ForceSpawn") caller:PlaySound("Weapon_LooseCannon.Explode") caller:PlaySound("Weapon_LooseCannon.Explode") caller:PlaySound("Weapon_LooseCannon.Explode") local BlastDamage = damage * 0.5 local BlastRadius = damage * 0.75 local BlastDamageMult = activator:GetPlayerItemBySlot(0):GetAttributeValue("throwable damage") local BlastRadiusMult = activator:GetPlayerItemBySlot(0):GetAttributeValue("blast radius increased") if BlastDamageMult == nil then BlastDamageMult = 1 end if BlastRadiusMult == nil then BlastRadiusMult = 1 end if BlastDamage > 100 then BlastDamage = 100 end if BlastRadius > 148 then BlastRadius = 148 end BlastDamage = BlastDamage * BlastDamageMult BlastRadius = BlastRadius * BlastRadiusMult for _, others in pairs(ents.FindInSphere(caller:GetAbsOrigin(),BlastRadius)) do if others:IsPlayer() and ( others.m_iTeamNum ~= activator.m_iTeamNum ) then others:TakeDamage({Damage = BlastDamage, Attacker = activator, DamageType = DMG_BLAST}) end end end end function RepairTeammates(_, activator, caller) --activator is the one with the weapon if not util.IsLagCompensationActive() then util.StartLagCompensation(activator) end --ripped from red_sniper_laser.lua local melee = activator:GetPlayerItemBySlot(2) local meleeRangeMult = melee:GetAttributeValue("melee range multiplier", true) or 1 local TraceLineOfSight = { start = activator, distance = (100 * meleeRangeMult), angles = activator:GetEyeAngles(), mask = MASK_SOLID, collisiongroup = COLLISION_GROUP_PLAYER } local Trace = util.Trace(TraceLineOfSight) local HitEnt = Trace.Entity if IsValid(HitEnt) and HitEnt:IsPlayer() and HitEnt:GetTeam() == activator:GetTeam() then local MaxHealth = HitEnt.m_iMaxHealth + HitEnt:GetAttributeValueByClass("add_maxhealth_nonbuffed", 0) local amount = math.clamp( activator.m_iAmmo[4] * 2, 2, 120 ) amount = math.min( amount, ( MaxHealth - HitEnt.m_iHealth ) ) local cost = amount / 2 amount = amount * activator:GetPlayerItemBySlot(2):GetAttributeValueByClass( "mult_repair_value", 1 ) print( HitEnt.m_iHealth, MaxHealth ) if ( activator.m_iAmmo[TF_AMMO_METAL] >= cost ) and ( HitEnt.m_iHealth ~= MaxHealth ) then HitEnt:PlaySoundToSelf("Weapon_Wrench.HitBuilding_Success") HitEnt:Print(PRINT_TARGET_CENTER, "WRENCHED BY " .. activator.m_szNetname .. " HEALED FOR " .. amount .. " HEALTH") local fakeEventTable = { patient = HitEnt:GetUserId(), healer = activator:GetUserId(), amount = amount } --scoreboard credit. FireEvent("player_healed", fakeEventTable) HitEnt.m_iHealth = HitEnt.m_iHealth + amount activator.m_iAmmo[4] = math.max( activator.m_iAmmo[4] - cost, 0 ) activator:PlaySoundToSelf("Weapon_Wrench.HitBuilding_Success") else activator:PlaySoundToSelf("Weapon_Wrench.HitBuilding_Failure") end if HitEnt.m_iHealth > MaxHealth then HitEnt.m_iHealth = MaxHealth end end end function EMPBlast(condition, caller, activator) --caller is the one with the weapon, activator is the weapon activator.EMPed = true util.ParticleEffect( "drg_cow_explosioncore_charged_blue", activator:GetAbsOrigin() ) activator:PlaySound( "EMP.Sound1" ) activator:PlaySound( "EMP.Sound2" ) for _, player in pairs(ents.FindInSphere(activator:GetAbsOrigin(),384)) do if player:IsBot() and ( not ( tobool ( player.m_bUseBossHealthBar ) ) ) and ( player:GetTeam() ~= activator:GetTeam() ) then local dist = player:GetAbsOrigin():Distance( activator:GetAbsOrigin() ) local ply_pos = player:GetEyePos() local act_pos = activator:GetEyePos() if dist >= 192 then local Trace = util.Trace({ start = act_pos, endpos = ply_pos, mask = MASK_PLAYERSOLID, filter = ents.GetAllPlayers() }) if not Trace.Hit then player:StunPlayer( 10, 1, TF_STUNFLAGS_NORMALBONK, activator ) util.ParticleEffect( "electrocuted_gibbed_blue", player:GetAbsOrigin(), Vector(0,0,0), player ) util.ParticleEffect( "electrocuted_gibbed_blue", player:GetEyePos(), Vector(0,0,0), player ) util.ParticleEffect( "electrocuted_blue", player:GetEyePos(), Vector(0,0,0), player ) player:PlaySound( "EMP.Sound3" ) end else player:StunPlayer( 10, 1, TF_STUNFLAGS_NORMALBONK, activator ) util.ParticleEffect( "electrocuted_gibbed_blue", player:GetAbsOrigin(), Vector(0,0,0), player ) util.ParticleEffect( "electrocuted_gibbed_blue", player:GetEyePos(), Vector(0,0,0), player ) util.ParticleEffect( "electrocuted_blue", player:GetEyePos(), Vector(0,0,0), player ) player:PlaySound( "EMP.Sound3" ) end end end end function AddHype(damage, activator, caller) if not activator.EMPed and ( caller:IsPlayer() ) then activator.MeterCurrent = math.min(activator.MeterCurrent + damage, activator.MeterMax) end end function Drone(_,Drone) local owner = Drone.m_hBuilder local Update local posmod = 1 local accel = 0.015 local decel = 0.1 local height = 16 local fakevel = Drone:GetAbsOrigin() local buildpos = Drone:GetAbsOrigin() local dis = 96 local failcounter = 0 local targetable = {} local tar = owner Drone.State = 0 Drone.MaxSpeed = 2 Drone.LockPos = Drone:GetAbsOrigin() owner:GetPlayerItemBySlot(2).Buildables_Drone = Drone Drone:AddCallback(ON_REMOVE, function() pcall(timer.Stop, Update) end) Drone:AddCallback(ON_DEATH, function() pcall(timer.Stop, Update) end) Update = timer.Create(0.015, function() if ( not IsValid(tar) ) then tar = owner end if ( owner:GetPlayerItemBySlot(2):GetItemName() ~= "Drone Controller" ) then pcall(timer.Stop, Update); Drone:AcceptInput("RemoveHealth", 9999) end if ( Drone.m_bCarried == 1 ) then pcall(timer.Stop, Update) end local pos = Drone:GetAbsOrigin() local ang = Vector(0,Drone:GetAbsAngles().y,Drone:GetAbsAngles().z) local ownerpos = owner:GetAbsOrigin() local desiredheight = tar:GetAbsOrigin().z + 72 + height local currentheight = pos.z local speedmult = owner:GetPlayerItemBySlot(2):GetAttributeValue("throwable fire speed") or 1 Drone.MaxSpeed = 2 * speedmult if ( owner:IsAlive() ) then if ( IsValid(Drone) ) then if owner.m_hActiveWeapon:GetItemName() ~= "Drone Controller" then dis = 128 else dis = 48 end if ( Drone.State == 1 ) and ( IsValid(Drone.m_hEnemy) ) then tar = Drone.m_hEnemy dis = dis * 2 if Drone.m_hEnemy.m_bIsMiniBoss == 1 then dis = dis * 1.25 height = 70 else height = 16 end elseif ( Drone.State == 0 ) then tar = owner height = 16 elseif ( Drone.State == 2 ) then tar = ents.FindByName( "intel" ) height = 48 dis = 192 else tar = owner height = 16 end if (Drone.m_iState ~= 0 ) and ( Drone.State ~= 3 ) then if pos:Distance(tar:GetAbsOrigin()) >= dis + 72 + height then --move towards if posmod < 1 then posmod = 1 end fakevel = pos + ( Vector(posmod * 2.5,posmod * 2.5,0) * ang:GetForward()) posmod = math.min(posmod + ( posmod * accel), Drone.MaxSpeed) elseif ( pos:Distance(tar:GetAbsOrigin()) <= 72 + 72 + height ) and ( owner.m_hActiveWeapon:GetItemName() ~= "Drone Controller" ) and ( posmod * 5 < 6 ) then --move away fakevel = pos - ( Vector(Drone.MaxSpeed,Drone.MaxSpeed,0) * ang:GetForward()) posmod = -1 * Drone.MaxSpeed / 2.5 else --slow down fakevel = pos + ( Vector(posmod * 2.5,posmod * 2.5,0) * ang:GetForward()) if posmod < 0 then posmod = math.min( posmod + ( decel / 2 ), 0 ) else posmod = math.max( posmod - ( posmod * decel ), 0 ) end end if ( currentheight <= desiredheight ) and ( currentheight - desiredheight < 8 ) then --move up if ( pos:Distance(tar:GetAbsOrigin()) >= dis + 72 + height ) or ( ( pos:Distance(tar:GetAbsOrigin()) <= 72 + 72 + height ) and ( owner.m_hActiveWeapon:GetItemName() ~= "Drone Controller" ) ) then fakevel = Vector(fakevel.x,fakevel.y,currentheight+math.max(1.5,( Drone.MaxSpeed * 1.5 ))) else fakevel = Vector(fakevel.x,fakevel.y,currentheight+math.max(0.25,( Drone.MaxSpeed * 1.5 ) / 6)) end elseif currentheight >= desiredheight and ( currentheight - desiredheight > 8 ) then --move down if ( pos:Distance(tar:GetAbsOrigin()) >= dis + 72 + height ) or ( ( pos:Distance(tar:GetAbsOrigin()) <= 72 + 72 + height ) and ( owner.m_hActiveWeapon:GetItemName() ~= "Drone Controller" ) ) then fakevel = Vector(fakevel.x,fakevel.y,currentheight-math.max(1.5,( Drone.MaxSpeed * 1.5 ))) else fakevel = Vector(fakevel.x,fakevel.y,currentheight-math.max(0.25,( Drone.MaxSpeed * 1.5 ) / 6)) end else fakevel = Vector(fakevel.x,fakevel.y,currentheight) end elseif ( Drone.State == 2 ) then if ( currentheight <= ( Drone.LockPos.z + 72 + height ) ) and ( currentheight - ( Drone.LockPos.z + 72 + height ) < 8 ) then fakevel = Vector(fakevel.x,fakevel.y,currentheight+math.max(0.25,( Drone.MaxSpeed * 1.5 ) / 6)) end posmod = 1 else if ( currentheight <= ( Drone.LockPos.z + 72 + height ) ) and ( currentheight - ( Drone.LockPos.z + 72 + height ) < 8 ) then fakevel = Vector(fakevel.x,fakevel.y,currentheight+0.25) end posmod = 1 end Drone:SetAbsOrigin(fakevel) Drone:FaceEntity(tar) else failcounter = failcounter + 1 print("Error, Invaild Drone", failcounter) if failcounter >= 66 then pcall(timer.Stop, Update) end end else pcall(timer.Stop, Update) Drone:AcceptInput("RemoveHealth", 9999) end end, 0) end function DispShieldHurt( damage, activator, caller ) for _, building in pairs( ents.FindAllByClass("obj_dispenser") ) do if IsValid( building.m_hBuilder ) then local owner = building.m_hBuilder if ( owner:GetPlayerItemBySlot( LOADOUT_POSITION_PDA ):GetItemName() == "Shield Projector" ) and ( activator:GetTeam() ~= owner:GetTeam() ) then local dmg_info = { Attacker = activator, Damage = damage } building:TakeDamage( dmg_info ) end end end end