Skip to content

Commit

Permalink
Merge pull request #292 from GMLambda/ep2-part
Browse files Browse the repository at this point in the history
Episode 2
  • Loading branch information
ZehMatt authored Aug 16, 2024
2 parents 22d8d30 + 9b80ff3 commit 1156ec1
Show file tree
Hide file tree
Showing 118 changed files with 2,424 additions and 397 deletions.
Binary file added content/models/Advisor_ep2.dx80.vtx
Binary file not shown.
Binary file added content/models/Advisor_ep2.dx90.vtx
Binary file not shown.
Binary file added content/models/Advisor_ep2.mdl
Binary file not shown.
Binary file added content/models/Advisor_ep2.vvd
Binary file not shown.
Binary file added content/models/Lamarr_ep2.ani
Binary file not shown.
Binary file added content/models/Lamarr_ep2.dx80.vtx
Binary file not shown.
Binary file added content/models/Lamarr_ep2.dx90.vtx
Binary file not shown.
Binary file added content/models/Lamarr_ep2.mdl
Binary file not shown.
Binary file added content/models/Lamarr_ep2.phy
Binary file not shown.
Binary file added content/models/Lamarr_ep2.vvd
Binary file not shown.
Binary file added content/models/advisor_ep2_animations.ani
Binary file not shown.
Binary file added content/models/advisor_ep2_animations.mdl
Binary file not shown.
Binary file added content/models/combine_dropship_animatiep1.ani
Binary file not shown.
Binary file added content/models/combine_dropship_animatiep1.mdl
Binary file not shown.
Binary file added content/models/combine_dropship_animatiep2.ani
Binary file not shown.
Binary file added content/models/combine_dropship_animatiep2.mdl
Binary file not shown.
Binary file added content/models/combine_dropship_animatihl2.ani
Binary file not shown.
Binary file added content/models/combine_dropship_animatihl2.mdl
Binary file not shown.
Binary file added content/models/combine_dropship_animations.mdl
Binary file not shown.
Binary file added content/models/eli_anep1.ani
Binary file not shown.
Binary file added content/models/eli_anep1.mdl
Binary file not shown.
Binary file added content/models/eli_anep2.ani
Binary file not shown.
Binary file added content/models/eli_anep2.mdl
Binary file not shown.
Binary file added content/models/eli_anhl2.ani
Binary file not shown.
Binary file added content/models/eli_anhl2.mdl
Binary file not shown.
Binary file added content/models/eli_anims.mdl
Binary file not shown.
Binary file added content/models/eli_gestuep1.ani
Binary file not shown.
Binary file added content/models/eli_gestuep1.mdl
Binary file not shown.
Binary file added content/models/eli_gestuep2.ani
Binary file not shown.
Binary file added content/models/eli_gestuep2.mdl
Binary file not shown.
Binary file added content/models/eli_gestuhl2.ani
Binary file not shown.
Binary file added content/models/eli_gestuhl2.mdl
Binary file not shown.
Binary file added content/models/eli_gestures.mdl
Binary file not shown.
Binary file added content/models/eli_postuep1.ani
Binary file not shown.
Binary file added content/models/eli_postuep1.mdl
Binary file not shown.
Binary file added content/models/eli_postuep2.ani
Binary file not shown.
Binary file added content/models/eli_postuep2.mdl
Binary file not shown.
Binary file added content/models/eli_postuhl2.ani
Binary file not shown.
Binary file added content/models/eli_postuhl2.mdl
Binary file not shown.
Binary file added content/models/eli_postures.mdl
Binary file not shown.
Binary file added content/models/kleiner_animatiep1.ani
Binary file not shown.
Binary file added content/models/kleiner_animatiep1.mdl
Binary file not shown.
Binary file added content/models/kleiner_animatiep2.ani
Binary file not shown.
Binary file added content/models/kleiner_animatiep2.mdl
Binary file not shown.
Binary file added content/models/kleiner_animatihl2.ani
Binary file not shown.
Binary file added content/models/kleiner_animatihl2.mdl
Binary file not shown.
Binary file added content/models/kleiner_animations.mdl
Binary file not shown.
Binary file added content/models/kleiner_gestuep1.ani
Binary file not shown.
Binary file added content/models/kleiner_gestuep1.mdl
Binary file not shown.
Binary file added content/models/kleiner_gestuep2.ani
Binary file not shown.
Binary file added content/models/kleiner_gestuep2.mdl
Binary file not shown.
Binary file added content/models/kleiner_gestuhl2.ani
Binary file not shown.
Binary file added content/models/kleiner_gestuhl2.mdl
Binary file not shown.
Binary file added content/models/kleiner_gestures.mdl
Binary file not shown.
Binary file added content/models/kleiner_postuep1.ani
Binary file not shown.
Binary file added content/models/kleiner_postuep1.mdl
Binary file not shown.
Binary file added content/models/kleiner_postuep2.ani
Binary file not shown.
Binary file added content/models/kleiner_postuep2.mdl
Binary file not shown.
Binary file added content/models/kleiner_postuhl2.ani
Binary file not shown.
Binary file added content/models/kleiner_postuhl2.mdl
Binary file not shown.
Binary file added content/models/kleiner_postures.mdl
Binary file not shown.
5 changes: 2 additions & 3 deletions entities/entities/env_zoom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,16 @@ end

function ENT:AcceptInput(fn, data, activator, caller)
DbgPrint(self, fn, data, activator, caller)
BaseClass.AcceptInput(self, fn, data, activator, caller)
return BaseClass.AcceptInput(self, fn, data, activator, caller)
end

function ENT:KeyValue(key, val)
BaseClass.KeyValue(self, key, val)

if key:iequals("rate") then
self.Rate = val
elseif key:iequals("fov") then
self.FOV = val
end
return BaseClass.KeyValue(self, key, val)
end

function ENT:ZoomPlayer(ply)
Expand Down
6 changes: 6 additions & 0 deletions entities/entities/lambda_checkpoint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,20 @@ function ENT:Think()
end
end

-- TODO: Remove all instances, use SetRenderPos
function ENT:SetVisiblePos(pos)
self:SetNWVector("VisiblePos", pos)
end

ENT.SetRenderPos = ENT.SetVisiblePos

-- TODO: Remove all instances, use GetRenderPos
function ENT:GetVisiblePos()
return self:GetNWVector("VisiblePos", self:GetPos())
end

ENT.GetRenderPos = ENT.GetVisiblePos

function ENT:SetDynamicCheckpoint(dynamic)
self:SetNWBool("DynamicCheckpoint", dynamic)
end
Expand Down
8 changes: 8 additions & 0 deletions entities/entities/lambda_entity.lua
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,14 @@ function ENT:SetupNWVar(key, dtType, data)
end
end

function ENT:OnRestore()
-- Adjust the Get/Set functions, functions can not be serialized.
for k, v in pairs(self.DTVarTable) do
v.Get = DTVAR_GET[v.Type]
v.Set = DTVAR_SET[v.Type]
end
end

function ENT:GetNWVar(key, fallback)
if self.DTVarTable == nil then return fallback end
local dtVar = self.DTVarTable[key]
Expand Down
55 changes: 45 additions & 10 deletions entities/entities/lambda_trigger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,14 @@ if SERVER then
self:SetupOutput("OnStartTouchAll")
self:SetupOutput("OnEndTouch")
self:SetupOutput("OnEndTouchAll")
self:SetupOutput("OnTouching")
self:SetupOutput("OnNotTouching")
self:SetInputFunction("Enable", self.Enable)
self:SetInputFunction("Disable", self.Disable)
self:SetInputFunction("Toggle", self.Toggle)
self:SetInputFunction("TouchTest", self.TouchTest)
self:SetInputFunction("StartTouch", self.InputStartTouch)
self:SetInputFunction("EndTouch", self.InputEndTouch)

self:SetupNWVar("Disabled", "bool", {
Default = false,
Expand Down Expand Up @@ -121,6 +126,8 @@ if SERVER then
self.DisabledTouchingObjects = {}
self.TouchingObjects = {}
self.LastTouch = CurTime()
self.PendingStartTouch = false

self:AddDebugOverlays(bit.bor(OVERLAY_PIVOT_BIT, OVERLAY_BBOX_BIT, OVERLAY_NAME_BIT))
end

Expand Down Expand Up @@ -316,6 +323,27 @@ if SERVER then
end
end

function ENT:TouchTest()
DbgPrint(self, "ENT:TouchTest")
if table.Count(self.TouchingObjects) == 0 then
self:FireOutputs("OnNotTouching", nil, nil)
else
self:FireOutputs("OnTouching", nil, nil)
end
end

function ENT:InputStartTouch(data, activator, caller)
DbgPrint(self, "ENT:InputStartTouch")
if not IsValid(caller) then return end
self:StartTouch(caller)
end

function ENT:InputEndTouch(data, activator, caller)
DbgPrint(self, "ENT:InputEndTouch")
if not IsValid(caller) then return end
self:EndTouch(caller)
end

function ENT:GetTimeout()
local timeout = self:GetNWVar("Timeout", 0)
if timeout ~= 0 then return timeout end
Expand Down Expand Up @@ -458,7 +486,8 @@ if SERVER then
--DbgPrint(self, "OnTriggerEvents: " .. #self.OnTriggerEvents)
local timeoutEvent = false

if self:GetNWVar("WaitForTeam") == true then
local isTeamWait = self:GetNWVar("WaitForTeam")
if isTeamWait == true then
--DbgPrint("Waiting")
if self.TeamInside == false then
if self.NextTimeout == 0 then
Expand Down Expand Up @@ -486,6 +515,15 @@ if SERVER then
self.OnTrigger(self, ent)
end

if isTeamWait and self.PendingStartTouch == true then
DbgPrint(self, "Firing pending StartTouch")

-- We also have to fire StartTouch because if teamwait is set it will not fire it in StartTouch.
self:FireOutputs("OnStartTouch", nil, ent)

self.PendingStartTouch = false
end

self:FireOutputs("OnTrigger", nil, ent)

if waitTime < 0 then
Expand Down Expand Up @@ -518,21 +556,15 @@ if SERVER then
function ENT:TeleportAllToTrigger()
local missingEnts = {}

for _, v in pairs(ents.GetAll()) do
for _, v in pairs(util.GetAllPlayers()) do
if not self:IsEntityTouching(v) and self:PassesTriggerFilters(v) then
local isAlive = true

if v:IsPlayer() then
isAlive = v:Alive()
end

if isAlive then
if v:Alive() then
table.insert(missingEnts, v)
end
end
end

-- Teleport missing objects into the box
-- Teleport missing players into the box.
local centerPos = Vector(0, 0, 0)
local numEntries = 0

Expand Down Expand Up @@ -633,6 +665,9 @@ if SERVER then
if waitForTeam == false or (waitForTeam == true and self.TeamInside == true) then
DbgPrint(self, CurTime() .. ", OnStartTouch")
self:FireOutputs("OnStartTouch", nil, ent)
else
DbgPrint(self, "Delaying StartTouch until condition is met")
self.PendingStartTouch = true
end

if table.Count(self.TouchingObjects) == 1 then
Expand Down
128 changes: 128 additions & 0 deletions entities/entities/lambda_vehicle_companion.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
local DbgPrint = GetLogging("Vehicle")

ENT.Base = "lambda_entity"
ENT.Type = "point"
DEFINE_BASECLASS("lambda_entity")

function ENT:PreInitialize()
BaseClass.PreInitialize(self)
DbgPrint(self, "PreInitialize")
self:SetInputFunction("OnPlayerVehicleEnter", self.InputOnPlayerVehicleEnter)
self:SetInputFunction("OnPlayerVehicleExit", self.InputOnPlayerVehicleExit)
self:SetupNWVar(
"CompanionName",
"string",
{
Default = "",
KeyValue = "CompanionName"
}
)
end

function ENT:Initialize()
BaseClass.Initialize(self)
DbgPrint(self, "Initialize")
end

local function IsEntityInVehicle(ent)
if not IsValid(ent) then
return false
end

if ent:IsPlayer() then
return ent:InVehicle()
end

if ent:IsNPC() then
-- This is a bit akward.
local parent = ent:GetParent()
if IsValid(parent) and parent:IsVehicle() then
return true
end
end

return false
end

local function IsEntityBusy(ent)
if not IsValid(ent) then
return false
end

if ent:IsNPC() then
local npcState = ent:GetNPCState()
if npcState == NPC_STATE_SCRIPT or npcState == NPC_STATE_DEAD or npcState == NPC_STATE_PLAYDEAD then
return true
end
end

return false
end

function ENT:InputOnPlayerVehicleEnter(data, activator, caller)
DbgPrint(self, "InputOnPlayerVehicleEnter", tostring(data), tostring(activator), tostring(caller))

local passenger = GAMEMODE:VehicleGetPassenger(caller)
if IsValid(passenger) then
-- Already holds a passenger.
DbgPrint("Vehicle already has a passenger")
return
end

local companionName = self:GetNWVar("CompanionName")
local closest = nil
local closestDist = 999999
for _, v in pairs(ents.FindByName(companionName)) do
local dist = v:GetPos():Distance(caller:GetPos())
if dist < closestDist then
closest = v
closestDist = dist
end
end

if not IsValid(closest) then
DbgPrint("Unable to find companion '" .. companionName .. "'")
return
end

if IsEntityInVehicle(closest) then
DbgPrint("Companion is already in a vehicle")
return
end

if IsEntityBusy(closest) then
DbgPrint("Companion is busy")
return
end

local oldName = activator:GetName()
local newName = "lambda_vehicle_companion_" .. tostring(activator:EntIndex())
caller:SetName(newName)
DbgPrint("Requesting '" .. companionName .. "' to enter vehicle")
closest:Input("EnterVehicle", activator, self, newName)
caller:SetName(oldName)
end

function ENT:InputOnPlayerVehicleExit(data, activator, caller)
DbgPrint(self, "InputOnPlayerVehicleExit", tostring(data), tostring(activator), tostring(caller))
if not IsValid(caller) or not IsValid(activator) then
return
end

-- Check if the vehicle has a NPC companion.
local passenger = GAMEMODE:VehicleGetPassenger(caller)
if not IsValid(passenger) then
return
end

DbgPrint("Requesting companion to leave vehicle.")
passenger:Input("ExitVehicle", activator, self)
end

function ENT:UpdateTransmitState()
return TRANSMIT_NEVER
end

function ENT:OnRemove()
DbgPrint(self, "OnRemove")
end
9 changes: 4 additions & 5 deletions entities/entities/lambda_vehicle_tracker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,16 @@ function ENT:Initialize()
end

self:DrawShadow(false)
--self:AddEffects(EF_NODRAW)
end

function ENT:AttachToVehicle(vehicle)
self:SetModel(vehicle:GetModel())
self:SetPos(vehicle:GetPos())
self:SetAngles(vehicle:GetAngles())
self:SetParent(vehicle)
--self:AddEffects(EF_NODRAW)
self:DrawShadow(false)
self.Vehicle = vehicle
self.Player = vehicle.LambdaPlayer
self.Player = GAMEMODE:VehicleGetPlayerOwner(vehicle)
self:SetNWEntity("LambdaVehicleOwner", self.Player)
self:SetNWBool("LambdaVehicleTaken", IsValid(self.Player))
end
Expand All @@ -50,8 +48,9 @@ if SERVER then
return
end

if self.Player ~= vehicle.LambdaPlayer then
self.Player = vehicle.LambdaPlayer
local vehicleOwner = GAMEMODE:VehicleGetPlayerOwner(vehicle)
if self.Player ~= vehicleOwner then
self.Player = vehicleOwner
self:SetNWEntity("LambdaVehicleOwner", self.Player)
self:SetNWBool("LambdaVehicleTaken", IsValid(self.Player))
DbgPrint("Owner changed")
Expand Down
2 changes: 2 additions & 0 deletions entities/entities/logic_auto.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ end
function ENT:Enable()
self:SetNWVar("Disabled", false)
self:NextThink(CurTime())
return true
end

function ENT:Disable()
self:SetNWVar("Disabled", true)
return true
end

function ENT:UpdateTransmitState()
Expand Down
12 changes: 10 additions & 2 deletions entities/entities/npc_template_maker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,16 @@ function ENT:MakeNPCInLine()
self:UpdateScaling()
end

function ENT:MakeMultipleNPCS()
Error("MakeMultipleNPCS not implemented")
function ENT:MakeMultipleNPCS(data)
local numNpcs = tonumber(data)
local inRadius = self.DestinationGroup ~= nil and self.Radius > 0.1
for i = 1, numNpcs do
if inRadius then
self:MakeNPCInRadius()
else
self:MakeNPC()
end
end
end

function ENT:ChangeDestinationGroup(data)
Expand Down
4 changes: 3 additions & 1 deletion entities/entities/player_speedmod.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ function ENT:AcceptInput(inputName, activator, called, data)
local speed = tonumber(data)

for _, v in pairs(util.GetAllPlayers()) do
v:Flashlight(false)
if v:FlashlightIsOn() then
v:Flashlight(false)
end
v:SetLaggedMovementValue(speed)
end

Expand Down
Loading

0 comments on commit 1156ec1

Please sign in to comment.