148 lines
3.6 KiB
Lua
148 lines
3.6 KiB
Lua
GM.Name = "Feedc0de's coop Mode"
|
|
GM.Author = "0xFEEDC0DE64"
|
|
GM.Email = "daniel@brunner.ninja"
|
|
GM.Website = "brunner.ninja"
|
|
|
|
DeriveGamemode("sandbox")
|
|
|
|
include( "levels.lua" )
|
|
|
|
function ChangeRandomLevel(ply,com,arg)
|
|
local randomLevel = GetRandomLevel()
|
|
print("Changing to random level " .. randomLevel)
|
|
RunConsoleCommand( "changelevel", randomLevel )
|
|
end
|
|
|
|
function NextRandomLevel(ply,com,arg)
|
|
local randomLevel = GetRandomLevel()
|
|
print("Setting nextlevel to random " .. randomLevel)
|
|
RunConsoleCommand( "nextlevel", randomLevel )
|
|
end
|
|
|
|
if (SERVER) then
|
|
concommand.Add("randomlevel", ChangeRandomLevel)
|
|
concommand.Add("randomnextlevel", NextRandomLevel)
|
|
end
|
|
|
|
hook.Add( "Initialize", "SetupRandomLevels", function ()
|
|
print("hatschi2")
|
|
timer.Simple( 3600, ChangeRandomLevel )
|
|
NextRandomLevel()
|
|
timer.Simple( 0, NextRandomLevel )
|
|
end)
|
|
|
|
-- timer.Simple(
|
|
-- 1,
|
|
-- function()
|
|
-- function HideThings(name)
|
|
-- if (name == "CHudDamageIndicator" or name == "CHudHintDisplay") then
|
|
-- return false
|
|
-- end
|
|
-- end
|
|
-- hook.Add("HUDShouldDraw", "HideThings", HideThings)
|
|
-- end
|
|
-- )
|
|
|
|
function GM:IsSpawnpointSuitable(ply, spawnpointent, bMakeSuitable)
|
|
local Pos = spawnpointent:GetPos()
|
|
|
|
-- Note that we're searching the default hull size here for a player in the way of our spawning.
|
|
-- This seems pretty rough, seeing as our player's hull could be different.. but it should do the job
|
|
-- ( HL2DM kills everything within a 128 unit radius )
|
|
local Ents = ents.FindInBox(Pos + Vector(-16, -16, 0), Pos + Vector(16, 16, 72))
|
|
|
|
if (ply:Team() == TEAM_SPECTATOR or ply:Team() == TEAM_UNASSIGNED) then
|
|
return true
|
|
end
|
|
|
|
local Blockers = 0
|
|
|
|
for k, v in pairs(Ents) do
|
|
if (IsValid(v) and v:GetClass() == "player" and v:Alive()) then
|
|
Blockers = Blockers + 1
|
|
|
|
if (bMakeSuitable) then
|
|
v:SetVelocity(v:GetPos() + Vector(100, 100, 0))
|
|
end
|
|
end
|
|
end
|
|
|
|
if (bMakeSuitable) then
|
|
return true
|
|
end
|
|
if (Blockers > 0) then
|
|
return false
|
|
end
|
|
return true
|
|
end
|
|
|
|
function GM:PlayerLoadout(ply)
|
|
if (not striponspawn) then
|
|
ply:Give("weapon_fists")
|
|
end
|
|
end
|
|
|
|
hook.Add( "SpawnMenuOpen", "DisallowSpawnMenu", function ()
|
|
return LocalPlayer():IsAdmin()
|
|
end)
|
|
|
|
hook.Add( "ContextMenuOpen", "DisallowSpawnMenu", function ()
|
|
return LocalPlayer():IsAdmin()
|
|
end)
|
|
|
|
function GM:PlayerNoClip(ply, desiredState)
|
|
if desiredState then
|
|
return ply:IsAdmin()
|
|
else
|
|
return true
|
|
end
|
|
end
|
|
|
|
function GM:PlayerDeathSound()
|
|
return true
|
|
end
|
|
|
|
function GM:DrawDeathNotice(x, y)
|
|
return false
|
|
end
|
|
|
|
function GM:PlayerSpawnVehicle(ply, model, name, table)
|
|
return ply:IsAdmin()
|
|
end
|
|
|
|
function GM:PlayerSpawnSWEP(ply, weapon, info)
|
|
return ply:IsAdmin()
|
|
end
|
|
|
|
function GM:PlayerSpawnSENT(ply, class)
|
|
return ply:IsAdmin()
|
|
end
|
|
|
|
function GM:PlayerSpawnRagdoll(ply, model)
|
|
return ply:IsAdmin()
|
|
end
|
|
|
|
function GM:PlayerSpawnProp(ply, model)
|
|
return ply:IsAdmin()
|
|
end
|
|
|
|
function GM:PlayerSpawnObject(ply, model, skin)
|
|
return ply:IsAdmin()
|
|
end
|
|
|
|
function GM:PlayerSpawnNPC(ply, npc_type, weapon)
|
|
return ply:IsAdmin()
|
|
end
|
|
|
|
function GM:PlayerSpawnEffect(ply, model)
|
|
return ply:IsAdmin()
|
|
end
|
|
|
|
function GM:PlayerGiveSWEP(ply, weapon, swep)
|
|
return ply:IsAdmin()
|
|
end
|
|
|
|
--function GM:HUDAmmoPickedUp( item, amount )
|
|
-- return false;
|
|
--end
|