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

Refactor checkpoints of hl2 gametype #248

Draft
wants to merge 27 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5ddfd3f
Add VisiblePos to checkpoint data, format file
ZehMatt Jul 22, 2023
bc4ffca
Refactor d1_canals_01 checkpoints
ZehMatt Jul 22, 2023
a5fcbbf
Refactor d1_canals_01a checkpoints
ZehMatt Jul 22, 2023
f587a46
Refactor d1_canals_02 checkpoints
ZehMatt Jul 22, 2023
68d0d20
Refactor d1_canals_03 checkpoints
ZehMatt Jul 22, 2023
8461a1e
Refactor d1_canals_05 checkpoints
ZehMatt Jul 22, 2023
7e91777
Refactor d2_prison_01 checkpoints
ZehMatt Jul 22, 2023
f98d70b
Refactor d2_prison_02 checkpoints
ZehMatt Jul 22, 2023
b058314
Refactor d2_prison_03 checkpoints
ZehMatt Jul 22, 2023
76c890b
Refactor d2_prison_04 checkpoints
ZehMatt Jul 22, 2023
8c2d54f
Refactor d2_prison_05 checkpoints
ZehMatt Jul 22, 2023
78860e7
Refactor d3_c17_01 checkpoints
ZehMatt Jul 22, 2023
6fe6870
Refactor d3_c17_03 checkpoints
ZehMatt Jul 22, 2023
055a788
Refactor d3_c17_04 checkpoints
ZehMatt Jul 22, 2023
d1bb644
Refactor d3_c17_05 checkpoints
ZehMatt Jul 22, 2023
04e23d3
Refactor d3_c17_06a checkpoints
ZehMatt Jul 22, 2023
62acf2b
Refactor d3_c17_06b checkpoints
ZehMatt Jul 22, 2023
23afaa5
Refactor d3_c17_08 checkpoints
ZehMatt Jul 22, 2023
9594d62
Refactor d3_c17_09 checkpoints
ZehMatt Jul 22, 2023
d07c335
Refactor d3_c17_10a checkpoints
ZehMatt Jul 22, 2023
e81bd41
Refactor d3_c17_11 checkpoints
ZehMatt Jul 22, 2023
dc99086
Refactor d3_c17_12 checkpoints
ZehMatt Jul 22, 2023
4ef632b
Refactor d3_c17_12b checkpoints
ZehMatt Jul 22, 2023
e4a545f
Refactor d3_c17_13 checkpoints
ZehMatt Jul 22, 2023
bc4de85
Refactor d3_citadel_01 checkpoints
ZehMatt Jul 22, 2023
5f1c36b
Refactor d1_town_01 checkpoints
ZehMatt Jul 22, 2023
5b3826f
Refactor d1_town_04 checkpoints
ZehMatt Jul 22, 2023
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
118 changes: 66 additions & 52 deletions gamemode/gametypes/hl2/mapscripts/d1_canals_01.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"},
Ammo = {},
Expand All @@ -18,7 +17,6 @@ MAPSCRIPT.InputFilters = {
}

MAPSCRIPT.EntityFilterByClass = {}

MAPSCRIPT.EntityFilterByName = {
["start_item_template"] = true
}
Expand All @@ -28,6 +26,50 @@ MAPSCRIPT.ImportantPlayerNPCNames = {
["boxcar_vort"] = true
}

MAPSCRIPT.Checkpoints = {
{
Pos = Vector(650.433105, -6424.663086, 540.031250),
Ang = Angle(0, 0, 0),
VisiblePos = Vector(619.656433, -6512.142578, 540.031250),
Trigger = {
Pos = Vector(614.625732, -6519.078613, 540.031250),
Mins = Vector(-100, -100, 0),
Maxs = Vector(100, 100, 180)
}
},
{
Pos = Vector(877.780457, 2621.807617, -55.060749),
Ang = Angle(0, 180, 0),
VisiblePos = Vector(853.600281, 2638.468018, 73.964828),
Trigger = {
Pos = Vector(855.660400, 2638.366943, 30),
Mins = Vector(-100, -100, 0),
Maxs = Vector(100, 100, 180)
}
},
-- Boxcar checkpoint
{
Pos = Vector(447.302185, -2656.709961, 576.031250),
Ang = Angle(0, 180, 0),
VisiblePos = Vector(853.600281, 2638.468018, 73.964828),
Trigger = {
Pos = Vector(447.302185, -2656.709961, 576.031250),
Mins = Vector(-50, -50, 0),
Maxs = Vector(50, 50, 180)
}
},
{
Pos = Vector(473.498352, -3530.257324, 256.031250),
Ang = Angle(0, 90, 0),
VisiblePos = Vector(853.600281, 2638.468018, 73.964828),
Trigger = {
Pos = Vector(544.810791, -3423.548584, 322.719330),
Mins = Vector(-70, -70, -50),
Maxs = Vector(70, 70, 100)
}
},
}

function MAPSCRIPT:PostInit()
if SERVER then
local jumpBox = ents.Create("prop_physics")
Expand All @@ -37,63 +79,35 @@ function MAPSCRIPT:PostInit()
jumpBox:Spawn()
jumpBox:SetHealth(1000)
local phys = jumpBox:GetPhysicsObject()

if IsValid(phys) then
phys:SetMass(200)
end

GAMEMODE:WaitForInput("boxcar_human", "StopScripting", function()
-- No longer mission relevant.
ents.WaitForEntityByName("boxcar_human", function(ent)
GAMEMODE:UnregisterMissionCriticalNPC(ent)
end)

ents.WaitForEntityByName("boxcar_vort", function(ent)
GAMEMODE:UnregisterMissionCriticalNPC(ent)
end)
end)

local checkpoint1 = GAMEMODE:CreateCheckpoint(Vector(650.433105, -6424.663086, 540.031250))
checkpoint1:SetVisiblePos(Vector(619.656433, -6512.142578, 540.031250))
local checkpointTrigger1 = ents.Create("trigger_once")
checkpointTrigger1:SetupTrigger(Vector(614.625732, -6519.078613, 540.031250), Angle(0, 0, 0), Vector(-100, -100, 0), Vector(100, 100, 180))

checkpointTrigger1.OnTrigger = function(_, activator)
GAMEMODE:SetPlayerCheckpoint(checkpoint1, activator)
end

-- Boxcar checkpoint
local checkpoint2 = GAMEMODE:CreateCheckpoint(Vector(877.780457, 2621.807617, -55.060749), Angle(0, 180, 0))
checkpoint2:SetVisiblePos(Vector(853.600281, 2638.468018, 73.964828))
local checkpointTrigger2 = ents.Create("trigger_once")
checkpointTrigger2:SetupTrigger(Vector(855.660400, 2638.366943, 30), Angle(0, 0, 0), Vector(-100, -100, 0), Vector(100, 100, 180))

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

-- 447.302185 -2656.709961 576.031250
local checkpoint3 = GAMEMODE:CreateCheckpoint(Vector(447.302185, -2656.709961, 576.031250), Angle(0, 180, 0))
local checkpointTrigger3 = ents.Create("trigger_once")
checkpointTrigger3:SetupTrigger(Vector(447.302185, -2656.709961, 576.031250), Angle(0, 0, 0), Vector(-50, -50, 0), Vector(50, 50, 180))

checkpointTrigger3.OnTrigger = function(_, activator)
GAMEMODE:SetPlayerCheckpoint(checkpoint3, activator)
end

-- 544.810791 -3423.548584 322.719330
local checkpoint4 = GAMEMODE:CreateCheckpoint(Vector(473.498352, -3530.257324, 256.031250), Angle(0, 90, 0))
local checkpointTrigger4 = ents.Create("trigger_once")
checkpointTrigger4:SetupTrigger(Vector(544.810791, -3423.548584, 322.719330), Angle(0, 0, 0), Vector(-70, -70, -50), Vector(70, 70, 100))

checkpointTrigger4.OnTrigger = function(_, activator)
GAMEMODE:SetPlayerCheckpoint(checkpoint4, activator)
end
GAMEMODE:WaitForInput(
"boxcar_human",
"StopScripting",
function()
-- No longer mission relevant.
ents.WaitForEntityByName(
"boxcar_human",
function(ent)
GAMEMODE:UnregisterMissionCriticalNPC(ent)
end
)

ents.WaitForEntityByName(
"boxcar_vort",
function(ent)
GAMEMODE:UnregisterMissionCriticalNPC(ent)
end
)
end
)
end
end

function MAPSCRIPT:PostPlayerSpawn(ply)
--DbgPrint("PostPlayerSpawn")
end

return MAPSCRIPT
return MAPSCRIPT
--DbgPrint("PostPlayerSpawn")
139 changes: 75 additions & 64 deletions gamemode/gametypes/hl2/mapscripts/d1_canals_01a.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ end
local DbgPrint = GetLogging("MapScript")
local MAPSCRIPT = {}
MAPSCRIPT.PlayersLocked = false

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

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

MAPSCRIPT.EntityFilterByName = {
["spawnitems_template"] = true
}

MAPSCRIPT.Checkpoints = {
{
Pos = Vector(-1183.380615, 6344.419922, -59.326172),
Ang = Angle(0, -180, 0),
Trigger = {
Pos = Vector(-1183.380615, 6344.419922, 6.326172),
Mins = Vector(-100, -100, 0),
Maxs = Vector(100, 100, 180)
}
},
{
Pos = Vector(-3002.406494, 7870.711426, 12.031250),
Ang = Angle(0, 90, 0),
Trigger = {
Pos = Vector(-3002.406494, 7870.711426, 48.031250),
Mins = Vector(-100, -100, 0),
Maxs = Vector(100, 100, 180)
}
},
{
Pos = Vector(2104.908447, 5759.881348, -95.968750),
Ang = Angle(0, 45, 0),
Trigger = {
Pos = Vector(2104.908447, 5759.881348, -95.968750),
Mins = Vector(-100, -100, 0),
Maxs = Vector(100, 100, 180)
}
},
}

function MAPSCRIPT:PostInit()
if SERVER then
local checkpoint1 = GAMEMODE:CreateCheckpoint(Vector(-1183.380615, 6344.419922, -59.326172), Angle(0, -180, 0))
local checkpointTrigger1 = ents.Create("trigger_once")
checkpointTrigger1:SetupTrigger(Vector(-1183.380615, 6344.419922, 6.326172), Angle(0, 0, 0), Vector(-100, -100, 0), Vector(100, 100, 180))

checkpointTrigger1.OnTrigger = function(_, activator)
GAMEMODE:SetPlayerCheckpoint(checkpoint1, activator)
end

local checkpoint2 = GAMEMODE:CreateCheckpoint(Vector(-3002.406494, 7870.711426, 12.031250), Angle(0, 90, 0))
local checkpointTrigger2 = ents.Create("trigger_once")
checkpointTrigger2:SetupTrigger(Vector(-3002.406494, 7870.711426, 48.031250), Angle(0, 0, 0), Vector(-100, -100, 0), Vector(100, 100, 180))

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

local checkpoint3 = GAMEMODE:CreateCheckpoint(Vector(2104.908447, 5759.881348, -95.968750), Angle(0, 45, 0))
local checkpointTrigger3 = ents.Create("trigger_once")
checkpointTrigger3:SetupTrigger(Vector(2104.908447, 5759.881348, -95.968750), Angle(0, 0, 0), Vector(-100, -100, 0), Vector(100, 100, 180))

checkpointTrigger3.OnTrigger = function(_, activator)
GAMEMODE:SetPlayerCheckpoint(checkpoint3, activator)
end

local npcMaker1 = ents.Create("npc_maker")
npcMaker1:SetPos(Vector(-2174.593262, 9086.971680, 288.031250))
npcMaker1:SetAngles(Angle(0, 180, 0))
Expand All @@ -71,45 +75,52 @@ function MAPSCRIPT:PostInit()
npcMaker2:SetKeyValue("Radius", "200")
npcMaker2:SetName("lambda_npc_maker2")
npcMaker2:Spawn()

-- gallery_destgroup_1
ents.WaitForEntityByName("gallery_destgroup_1", function(ent)
ent:SetPos(Vector(-47.880901, 6160.045898, -58.842937))
end, true)
ents.WaitForEntityByName(
"gallery_destgroup_1",
function(ent)
ent:SetPos(Vector(-47.880901, 6160.045898, -58.842937))
end, true
)

-- room3_cop
-- Lets not wait for the explosion, thats boring.
ents.WaitForEntityByName("room3_cop", function(ent)
ent:Fire("AddOutput", "OnDeath gallerycop_maker2,Enable")
ent:Fire("AddOutput", "OnDeath gallerycop_maker3,Enable")
end)

ents.WaitForEntityByName("massacre_initiate_trigger", function(ent)
ent:Fire("AddOutput", "OnTrigger gallery_start_relay,Trigger,,0.0")
ent:Fire("AddOutput", "OnTrigger gallerycop_maker1,Enable,,0.0")
ent:Fire("AddOutput", "OnTrigger lambda_npc_maker2,Enable,,0.0")
end)
ents.WaitForEntityByName(
"room3_cop",
function(ent)
ent:Fire("AddOutput", "OnDeath gallerycop_maker2,Enable")
ent:Fire("AddOutput", "OnDeath gallerycop_maker3,Enable")
end
)

ents.WaitForEntityByName(
"massacre_initiate_trigger",
function(ent)
ent:Fire("AddOutput", "OnTrigger gallery_start_relay,Trigger,,0.0")
ent:Fire("AddOutput", "OnTrigger gallerycop_maker1,Enable,,0.0")
ent:Fire("AddOutput", "OnTrigger lambda_npc_maker2,Enable,,0.0")
end
)

-- -2849.247314 8805.366211 47.039879
local trigger2 = ents.Create("trigger_once")
trigger2:SetupTrigger(Vector(-2849.247314, 8805.366211, 47.039879), Angle(0, 0, 0), Vector(-150, -150, 0), Vector(150, 150, 180))

trigger2.OnTrigger = function()
npcMaker1:Fire("Enable")
npcMaker2:Fire("Enable")
end

local BridgePositions = {Vector(-2809.293701, 6795.291992, 144.031250), Vector(-2875.369141, 6793.270996, 144.031250), Vector(-2960.664307, 6790.913574, 144.031250), Vector(-3056.151855, 6790.148438, 144.031250), Vector(-3138.704102, 6790.096191, 144.031250)}

local function SendNPCToBridge(npc)
local bridgePos = table.Random(BridgePositions)

util.RunDelayed(function()
if not IsValid(npc) then return end
npc:SetLastPosition(bridgePos)
npc:SetSchedule(SCHED_FORCED_GO_RUN)
DbgPrint("Sending NPC to Bridge")
end, CurTime() + 1)
util.RunDelayed(
function()
if not IsValid(npc) then return end
npc:SetLastPosition(bridgePos)
npc:SetSchedule(SCHED_FORCED_GO_RUN)
DbgPrint("Sending NPC to Bridge")
end, CurTime() + 1
)
end

-- -2956.739746 6570.918945 -95.968781
Expand All @@ -126,7 +137,6 @@ function MAPSCRIPT:PostInit()
--npcMaker4:SetKeyValue("Radius", "300")
npcMaker3:SetName("lambda_npc_maker3")
npcMaker3:Spawn()

npcMaker3.OnSpawnNPC = function(s, ent)
SendNPCToBridge(ent)
end
Expand All @@ -145,7 +155,6 @@ function MAPSCRIPT:PostInit()
--npcMaker5:SetKeyValue("Radius", "300")
npcMaker4:SetName("lambda_npc_maker4")
npcMaker4:Spawn()

npcMaker4.OnSpawnNPC = function(s, ent)
SendNPCToBridge(ent)
end
Expand All @@ -156,11 +165,9 @@ function MAPSCRIPT:PostInit()
bridgeKillTrigger:SetKeyValue("targetname", "lambda_bridge_killbox")
bridgeKillTrigger:SetKeyValue("StartDisabled", "1")
bridgeKillTrigger:SetKeyValue("spawnflags", SF_TRIGGER_ALLOW_NPCS)

bridgeKillTrigger.OnTrigger = function(ent)
DbgPrint("Killing all bridge NPCs")
local t = ent:GetTouchingObjects()

for _, v in pairs(t) do
DbgPrint("Killing: " .. tostring(v))
local world = game.GetWorld()
Expand All @@ -178,7 +185,6 @@ function MAPSCRIPT:PostInit()
prop:AddEffects(EF_NODRAW)
prop:Spawn()
local phys = prop:GetPhysicsObject()

if IsValid(phys) then
phys:EnableMotion(false)
end
Expand All @@ -187,25 +193,30 @@ function MAPSCRIPT:PostInit()
-- -2620.882813 5306.772949 -45.723671
local trigger3 = ents.Create("trigger_once")
trigger3:SetupTrigger(Vector(-2620.882813, 5306.772949, -45.723671), Angle(0, 0, 0), Vector(-150, -150, 0), Vector(150, 150, 180))

trigger3.OnTrigger = function()
npcMaker3:Fire("Enable")
npcMaker4:Fire("Enable")
end

ents.WaitForEntityByName("mud_bridge_collapse_relay", function(ent)
ent:Fire("AddOutput", "OnTrigger lambda_bridge_killbox,Enable,,0")
end)
ents.WaitForEntityByName(
"mud_bridge_collapse_relay",
function(ent)
ent:Fire("AddOutput", "OnTrigger lambda_bridge_killbox,Enable,,0")
end
)

ents.WaitForEntityByName("mud_bridge_barrels", function(ent)
ent:Fire("AddOutput", "OnBreak lambda_npc_maker3,Kill,,0")
ent:Fire("AddOutput", "OnBreak lambda_npc_maker4,Kill,,0")
end)
ents.WaitForEntityByName(
"mud_bridge_barrels",
function(ent)
ent:Fire("AddOutput", "OnBreak lambda_npc_maker3,Kill,,0")
ent:Fire("AddOutput", "OnBreak lambda_npc_maker4,Kill,,0")
end
)
end
end

function MAPSCRIPT:PostPlayerSpawn(ply)
--DbgPrint("PostPlayerSpawn")
end

return MAPSCRIPT
return MAPSCRIPT
--DbgPrint("PostPlayerSpawn")
Loading