forked from bliptec/world-portals
-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also added some hooks 'wp-shouldrender' and 'wp-shouldtp' as well as ENT.TPHook.
- Loading branch information
1 parent
d89c9ab
commit bf2225e
Showing
9 changed files
with
219 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
|
||
worldportals = {} | ||
--because worldportals is too long | ||
wp = {} | ||
|
||
-- Load required files | ||
include( "worldportals/utils_sh.lua" ) | ||
|
||
if SERVER then | ||
|
||
include( "worldportals/render_sv.lua" ) | ||
include( "worldportals/teleport_sv.lua" ) | ||
|
||
AddCSLuaFile( "worldportals/utils_sh.lua" ) | ||
AddCSLuaFile( "worldportals/render_cl.lua" ) | ||
--AddCSLuaFile( "worldportals/teleport_cl.lua" ) | ||
|
||
else | ||
|
||
include( "worldportals/render_cl.lua" ) | ||
include( "worldportals/teleport_cl.lua" ) | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
|
||
-- Client side tetleportation prediction | ||
-- This is somewhat specific to rooftops_lost and can be improved a lot | ||
|
||
--should really create a custom move type based off of the source engine move type in order | ||
--to have properly predicted teleportation | ||
|
||
--[[ | ||
local last_tele = 0 | ||
hook.Add( "Tick", "WorldPortals_Teleportation", function() | ||
hook.Remove( "CalcView", "WorldPortals_PredictTeleView" ) | ||
local ply = LocalPlayer() | ||
for _, portal in pairs( wp.portals ) do | ||
local distance = ply:GetPos():Distance( portal:GetPos() ) | ||
if distance < 150 then | ||
print("asdf") | ||
local mins = portal:GetPos() + Vector( -32, -portal:GetWidth() /2, -portal:GetHeight() /2 ) --would normally be 0 | ||
local maxs = portal:GetPos() + Vector( 32, portal:GetWidth() /2, portal:GetHeight() /2) --would normally be 10 | ||
local ply_pos = LocalPlayer():GetPos() + Vector( 0, 0, 36) | ||
if ply_pos:WithinAABox( mins, maxs ) then | ||
--print("asddd1", ent, LocalPlayer() ) | ||
--if ent ~= ply then continue end | ||
print("asddd") | ||
local vel_norm = ply:GetVelocity():GetNormalized() | ||
-- Object is moving towards the portal | ||
if vel_norm:Dot( portal:GetForward() ) < 0 then --and SysTime() - last_tele > 0.5 then | ||
print("ddddd") | ||
local projected_distance = wp.DistanceToPlane( ply:EyePos() + ply:GetVelocity() *engine.TickInterval(), portal:GetPos(), portal:GetForward() ) | ||
--if projected_distance < 0 then | ||
print("ffffff") | ||
hook.Add( "CalcView", "WorldPortals_PredictTeleView", function( ply, pos, angle, fov ) | ||
local camOrigin = wp.TransformPortalPos( pos, portal, portal:GetExit() ) | ||
local camAngle = wp.TransformPortalAngle( angle, portal, portal:GetExit() ) | ||
print("qqqqq") | ||
return { | ||
origin = camOrigin, ---( angle:Forward()*100 ), --camorigin | ||
angles = camAngle, | ||
fov = fov | ||
} | ||
end ) | ||
--end | ||
end | ||
end | ||
end | ||
end | ||
end ) | ||
net.Receive( "WorldPortals_TeleportAlert", function() | ||
hook.Remove( "CalcView", "WorldPortals_PredictTeleView" ) | ||
end ) | ||
]]-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
-- Add message name to pool | ||
util.AddNetworkString( "WorldPortals_TeleportAlert" ) | ||
|
||
-- Let player know that server has acknowledged and completed the teleport | ||
function wp.AlertPlayerOnTeleport( ply ) | ||
net.Start( "WorldPortals_TeleportAlert" ) | ||
net.Send( ply ) | ||
end |
Oops, something went wrong.