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
4 changes: 2 additions & 2 deletions lua/entities/gmod_wire_expression2/core/hologram.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1085,14 +1085,14 @@ e2function void holoDisableShading( index, disable )
local Holo = CheckIndex(self, index)
if not Holo then return end

Holo.ent:SetNWBool( "disable_shading", disable == 1 )
Holo.ent:SetDisableShading( disable == 1 )
end

e2function void holoInvertModel( index, enable )
local Holo = CheckIndex(self, index)
if not Holo then return end

Holo.ent:SetNWInt("invert_model", enable ~= 0 and 1 or 0)
Holo.ent:SetInvertModel( enable ~= 0 and true or false )
end

-- -----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion lua/entities/gmod_wire_expression2/core/selfaware.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ local function doSetName(self, this, name)
end
this.name = name

this:SetNWString("name", name)
this:SetInstanceName(name)
this:SetOverlayText(name)
else
if #name > 200 then name = string.sub(name, 1, 200) end
Expand Down
13 changes: 10 additions & 3 deletions lua/entities/gmod_wire_expression2/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ function ENT:Initialize()
end
end

function ENT:SetupDataTables()
self:NetworkVar("Entity", 0, "InstancePlayer")
self:NetworkVar("String", 0, "InstanceName")
end

function ENT:OnRestore()
self:Setup(self.original, self.inc_files, nil, true)
end
Expand Down Expand Up @@ -460,7 +465,7 @@ function ENT:CompileCode(buffer, files, filepath)
else
self.WireDebugName = "E2 - " .. self.name
end
self:SetNWString("name", self.name)
self:SetInstanceName(self.name)

self.directives = directives
self.inports = directives.inputs
Expand Down Expand Up @@ -846,7 +851,7 @@ hook.Add("PlayerAuthed", "Wire_Expression2_Player_Authed", function(ply, sid, ui
end

if ent.uid == uid then
ent:SetNWEntity("player", ply)
ent:SetInstancePlayer(ply)
ent.player = ply
end
end
Expand All @@ -866,10 +871,12 @@ function MakeWireExpression2(player, Pos, Ang, model, buffer, name, inputs, outp
self:SetAngles(Ang)
self:SetPos(Pos)
self:SetPlayer(player)
self:SetNWEntity("player", player)
self.player = player
self:Spawn()

-- Wait for ENT:SetupDataTables
self:SetInstancePlayer(self.player)

if isstring( buffer ) then -- if someone dupes an E2 with compile errors, then all these values will be invalid
buffer = string.Replace(string.Replace(buffer, string.char(163), "\""), string.char(128), "\n")

Expand Down
13 changes: 9 additions & 4 deletions lua/entities/gmod_wire_hologram.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ ENT.DisableDuplicator = true

function ENT:SetupDataTables()
self:NetworkVar( "Entity", 0, "PlayerEnt" )
self:NetworkVar( "Bool", 0, "InvertModel" )
self:NetworkVar( "Bool", 1, "DisableShading" )
end

function ENT:GetPlayer()
Expand Down Expand Up @@ -122,18 +124,21 @@ if CLIENT then
SetupClipping(selfTbl)
end

local invert_model = EntityMeta.GetNWInt(self, "invert_model")
render.CullMode(invert_model)
local invert_model = selfTbl.GetInvertModel(self)

if EntityMeta.GetNWBool(self, "disable_shading") then
if invert_model then
render.CullMode(1)
end

if selfTbl.GetDisableShading(self) then
render.SuppressEngineLighting(true)
EntityMeta.DrawModel(self)
render.SuppressEngineLighting(false)
else
EntityMeta.DrawModel(self)
end

if invert_model ~= 0 then
if invert_model then
render.CullMode(0)
end

Expand Down
2 changes: 1 addition & 1 deletion lua/wire/client/text_editor/wire_expression2_editor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,7 @@ Text here]# ]]
dlist2:Clear()
local size = 0
for _, v in ipairs(E2s) do
local ply = v:GetNWEntity("player", NULL)
local ply = v:GetInstancePlayer()
if IsValid(ply) and ply == LocalPlayer() or showall then
local nick
if not ply or not ply:IsValid() then nick = "Unknown" else nick = ply:Nick() end
Expand Down
2 changes: 1 addition & 1 deletion lua/wire/stools/expression2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ if SERVER then
if ply ~= toent.player then
toent.player = ply
toent:SetPlayer(ply)
toent:SetNWEntity("player", ply)
toent:SetInstancePlayer(ply)

-- Note that the SENT and CPPI owners aren't set here to allow the original owner to still access their chip
end
Expand Down
Loading