Skip to content
Merged
Show file tree
Hide file tree
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: 14 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
path: ${{ github.repository }}

- name: Checkout world-portals
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
repository: AmyJeanes/world-portals
ref: dev
Expand All @@ -46,16 +46,8 @@ jobs:
env:
combined: ${{ github.workspace }}/combined

- name: Create gma file
run: |
wget -O /tmp/fastgmad.zip "https://github.com/WilliamVenner/fastgmad/releases/download/v0.2.0/fastgmad_linux.zip"
unzip /tmp/fastgmad.zip -d /tmp/fastgmad
chmod +x /tmp/fastgmad/fastgmad
mkdir -p /tmp/addon
/tmp/fastgmad/fastgmad create -folder . -out /tmp/addon/addon.gma
working-directory: ${{ github.workspace }}/combined

- name: Set workshop addon id
id: workshop_id
if: (github.event_name == 'push' && contains(fromJSON('["refs/heads/dev"]'), github.ref)) || github.event.inputs.publish == 'true'
run: |
if [[ "${{ github.event.inputs.addon }}" == "beta" || "${{ github.ref }}" == "refs/heads/dev" ]]; then
Expand All @@ -66,15 +58,15 @@ jobs:
fi

echo "Publishing to workshop ID $WORKSHOP_ID"
echo "WORKSHOP_ID=$WORKSHOP_ID" >> $GITHUB_ENV
echo "WORKSHOP_ID=$WORKSHOP_ID" >> $GITHUB_OUTPUT

- name: Publish to workshop
if: env.WORKSHOP_ID
run: |
docker run --rm \
-e STEAM_USER="${{ vars.STEAM_USERNAME }}" \
-e STEAM_PASSWORD="${{ secrets.STEAM_PASSWORD }}" \
--mount type=bind,source="/tmp/addon",target=/home/gmodws/upload \
aperturedevelopment/gmodws:latest \
upload ${{ env.WORKSHOP_ID }} addon.gma \
"${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}"
- uses: AmyJeanes/gmod-upload@main
name: Publish to workshop
with:
id: ${{ steps.workshop_id.outputs.WORKSHOP_ID }}
changelog: "${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}"
folder: ${{ github.workspace }}/combined
dry-run: ${{ steps.workshop_id.outputs.WORKSHOP_ID == '' }}
env:
STEAM_USERNAME: ${{ vars.STEAM_USERNAME }}
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}
10 changes: 9 additions & 1 deletion lua/doors/libraries/sh_entities.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
Doors.Interiors={}
function Doors:AddInterior(e)
self.Interiors[e]=true

hook.Call("Doors-InteriorAdded", GAMEMODE, e)
end
function Doors:RemoveInterior(e)
self.Interiors[e]=nil

hook.Call("Doors-InteriorRemoved", GAMEMODE, e)
end
function Doors:GetInteriors()
return self.Interiors
Expand All @@ -14,10 +18,14 @@ end
Doors.Exteriors={}
function Doors:AddExterior(e)
self.Exteriors[e]=true

hook.Call("Doors-ExteriorAdded", GAMEMODE, e)
end
function Doors:RemoveExterior(e)
self.Exteriors[e]=nil

hook.Call("Doors-ExteriorRemoved", GAMEMODE, e)
end
function Doors:GetExteriors()
return self.Exteriors
end
end
4 changes: 2 additions & 2 deletions lua/entities/gmod_door_exterior/modules/sh_interior.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- Adds an interior


CreateConVar("doors_interior_tries", 10000, {FCVAR_ARCHIVE, FCVAR_REPLICATED, FCVAR_NOTIFY}, "Doors - How many tries to find a valid interior placement")

if SERVER then
function ENT:FindPosition(e)
Expand All @@ -16,7 +16,7 @@ if SERVER then
td.maxs=e.maxs or e:OBBMaxs()
td.mask=MASK_PLAYERSOLID
local max=16384
local tries=10000
local tries=GetConVar("doors_interior_tries"):GetInt()
local targetframetime=1/30
local nowhere
local highest
Expand Down
35 changes: 28 additions & 7 deletions lua/entities/gmod_door_exterior/modules/sh_players.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ if SERVER then
self.occupants[ply]=true
net.Start("Doors-EnterExit")
net.WriteBool(true)
net.WriteEntity(ply)
net.WriteEntity(self)
net.WriteEntity(self.interior)
net.Send(ply)
net.Broadcast()
ply.door = self
ply.doori = self.interior
if IsValid(self.interior) then
Expand Down Expand Up @@ -97,9 +98,10 @@ if SERVER then
self.occupants[ply]=nil
net.Start("Doors-EnterExit")
net.WriteBool(false)
net.WriteEntity(ply)
net.WriteEntity(self)
net.WriteEntity(self.interior)
net.Send(ply)
net.Broadcast()
ply.door = nil
ply.doori = nil
if not notp and self.Fallback then
Expand Down Expand Up @@ -138,19 +140,34 @@ if SERVER then
end
end
end)

ENT:AddHook("PlayerInitialize", "players", function(self)
net.WriteTable(self.occupants)
end)
else
net.Receive("Doors-EnterExit", function()
local enter=net.ReadBool()
local ply=net.ReadEntity()
local ext=net.ReadEntity()
local int=net.ReadEntity()

if not IsValid(ply) then return end

if enter then
LocalPlayer().door=ext
LocalPlayer().doori=int
ply.door=ext
ply.doori=int
if IsValid(ext) then
ext.occupants[ply]=true
end
else
LocalPlayer().door=nil
LocalPlayer().doori=nil
ply.door=nil
ply.doori=nil
if IsValid(ext) then
ext.occupants[ply]=nil
end
end

if ply~=LocalPlayer() then return end

if IsValid(ext) and ext._init then
if enter then
Expand All @@ -168,4 +185,8 @@ else
end
end
end)
end

ENT:AddHook("PlayerInitialize", "players", function(self)
self.occupants = net.ReadTable()
end)
end
29 changes: 29 additions & 0 deletions lua/entities/gmod_door_interior/modules/sh_handleplayers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,43 @@ if SERVER then
end
end)
else
ENT:AddHook("Initialize", "handleplayers", function(self)
self.occupants=self.exterior.occupants -- Hooray for referenced tables
end)

ENT:AddHook("ShouldDraw", "handleplayers", function(self)
if (LocalPlayer().doori~=self) and not wp.drawing and not self.contains[LocalPlayer().door] then
return false
end
end)

ENT:AddHook("ShouldThink", "handleplayers", function(self)
if LocalPlayer().doori~=self then
return false
end
end)

hook.Add("PrePlayerDraw", "doors-handleplayers", function(ply)
local int=ply.doori
if not IsValid(int) then return end
local localply=LocalPlayer()
local localplyinside=localply.doori==int
local drawingportal=wp.drawing and wp.drawingent==int.portals.exterior
local shoulddraw=int:CallHook("ShouldDrawPlayer", ply, localply)
if (not localplyinside or shoulddraw==false) and not drawingportal then
return true
end
end)

hook.Add("DrawPhysgunBeam", "doors-handleplayers", function(ply)
local int=ply.doori
if not IsValid(int) then return end
local localply=LocalPlayer()
local localplyinside=localply.doori==int
local drawingportal=wp.drawing and wp.drawingent==int.portals.exterior
local shoulddraw=int:CallHook("ShouldDrawPlayer", ply, localply)
if (not localplyinside or shoulddraw==false) and not drawingportal then
return false
end
end)
end