Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve some section of d1_canals_05 #255

Merged
merged 1 commit into from
Aug 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 23 additions & 13 deletions gamemode/gametypes/hl2/mapscripts/d1_canals_05.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ end

local MAPSCRIPT = {}
MAPSCRIPT.PlayersLocked = false

MAPSCRIPT.DefaultLoadout = {
Weapons = {"weapon_lambda_medkit", "weapon_crowbar", "weapon_pistol", "weapon_smg1"},
Ammo = {
Expand All @@ -17,19 +16,27 @@ MAPSCRIPT.DefaultLoadout = {

MAPSCRIPT.InputFilters = {}
MAPSCRIPT.EntityFilterByClass = {}

MAPSCRIPT.EntityFilterByName = {
["global_newgame_entmaker"] = true,
["relay_rockfall_start"] = true -- Don't do that, its trivial.
}

local function FreezeEntitiesAt(pos, extent)
local foundEnts = ents.FindInBox(pos - extent, pos + extent)
for _, v in pairs(foundEnts) do
local physObj = v:GetPhysicsObject()
if IsValid(physObj) then
physObj:EnableMotion(false)
end
end
end

function MAPSCRIPT:PostInit()
if SERVER then
local checkpoint1 = GAMEMODE:CreateCheckpoint(Vector(4149.820313, 3446.334229, -466.530853), Angle(0, -66, 0))
checkpoint1:SetVisiblePos(Vector(4240.543945, 3220.031982, -473.430939))
local checkpointTrigger1 = ents.Create("trigger_once")
checkpointTrigger1:SetupTrigger(Vector(4236.846191, 3261.946289, -474.814972), Angle(0, 0, 0), Vector(-100, -100, 0), Vector(100, 100, 180))

checkpointTrigger1.OnTrigger = function(_, activator)
GAMEMODE:SetPlayerCheckpoint(checkpoint1, activator)
end
Expand All @@ -38,21 +45,24 @@ function MAPSCRIPT:PostInit()
checkpoint2:SetVisiblePos(Vector(6758.199219, 1572.104248, -447.968750))
local checkpointTrigger2 = ents.Create("trigger_once")
checkpointTrigger2:SetupTrigger(Vector(6770.862793, 1569.191040, -447.968750), Angle(0, 0, 0), Vector(-100, -100, 0), Vector(100, 100, 180))

checkpointTrigger2.OnTrigger = function(_, activator)
GAMEMODE:SetPlayerCheckpoint(checkpoint2, activator)
end

ents.WaitForEntityByName("rotate_guncave_exit_wheel", function(ent)
ent:Fire("Unlock")
ent:Fire("AddOutput", "OnPressed relay_airboat_gateopen,Trigger")
ent:Fire("AddOutput", "OnPressed ss_arlene_opengate,Kill") -- In case the player opens it dont play the scene.
end)
end
end
ents.WaitForEntityByName(
"rotate_guncave_exit_wheel",
function(ent)
ent:Fire("Unlock")
ent:Fire("AddOutput", "OnPressed relay_airboat_gateopen,Trigger")
ent:Fire("AddOutput", "OnPressed ss_arlene_opengate,Kill") -- In case the player opens it dont play the scene.
end
)

function MAPSCRIPT:PostPlayerSpawn(ply)
--DbgPrint("PostPlayerSpawn")
-- Disable motion of some entities, they are odd to walk on in multiplayer.
FreezeEntitiesAt(Vector(4172.168457, 5346.647461, -124.435822), Vector(10, 10, 10))
FreezeEntitiesAt(Vector(4397.086914, 5241.035645, -121.793793), Vector(10, 10, 10))
FreezeEntitiesAt(Vector(4246.002441, 4931.557129, -121.530907), Vector(10, 10, 10))
end
end

return MAPSCRIPT