Skip to content

Commit

Permalink
Merge pull request #903 from MattJeanes/dev
Browse files Browse the repository at this point in the history
2023.6.2
  • Loading branch information
MattJeanes authored Apr 22, 2023
2 parents dff6650 + f10c87d commit cad31a8
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 77 deletions.
12 changes: 6 additions & 6 deletions i18n/languages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"Chameleon.FailReasons.AlreadyChanging": "L'extérieur est déjà en cours de modification!",
"Chameleon.FailReasons.AlreadySelected": "Cet extérieur est déjà sélectionné",
"Chameleon.FailReasons.DoorsOpen": "En attente de la fermeture des portes...",
"Chameleon.FailReasons.NoPower": "Le circuit caméléon ne peut fonctionner sans énergie",
"Chameleon.FailReasons.NoPower": "Le circuit caméléon ne peut fonctionner sans allimentation",
"Chameleon.FailReasons.NotEnoughArtron": "Énergie artron insuffisante pour activer le circuit caméléon",
"Chameleon.FailReasons.SameSelected": "Le TARDIS applique déjà cet extérieur",
"Chameleon.FailReasons.Teleporting": "L'extérieur sera modifié lorsque le TARDIS atterrira",
Expand Down Expand Up @@ -208,9 +208,9 @@
"Controls.ThirdPerson": "Contrôle de vol",
"Controls.ThirdPerson.Tip": "Contrôle manuel de vol",
"Controls.ThirdPersonCareful.Tip": "Contrôle manuel de vol",
"Controls.ToggleConsole": "",
"Controls.ToggleConsole.Status": "",
"Controls.ToggleConsole.Tip": "",
"Controls.ToggleConsole": "Activer/Desactiver Console",
"Controls.ToggleConsole.Status": "Console",
"Controls.ToggleConsole.Tip": "Interrupteur de la console",
"Controls.ToggleScanners": "Activation des scanneurs",
"Controls.ToggleScanners.FailedToggle": "Impossible d'utiliser les scanners intérieurs",
"Controls.ToggleScanners.Status": "Scanneurs intérieurs",
Expand Down Expand Up @@ -471,8 +471,8 @@
"Settings.Sections.Misc.Tips": "Astuces",
"Settings.Sections.Misc.Tips.Enabled": "Astuces",
"Settings.Sections.Misc.Tips.Enabled.Description": "Faut-il afficher les astuces pour les contrôles du TARDIS ?",
"Settings.Sections.Misc.Tips.ShowAll": "",
"Settings.Sections.Misc.Tips.ShowAll.Description": "",
"Settings.Sections.Misc.Tips.ShowAll": "Toujours afficher toutes les astuces",
"Settings.Sections.Misc.Tips.ShowAll.Description": "Les astuces doivent-elles être toutes affichées pour les contrôles du TARDIS ?",
"Settings.Sections.Misc.Tips.Style": "Style d'Astuces",
"Settings.Sections.Misc.Tips.Style.Description": "Quel style doivent utiliser les astuces du TARDIS ?",
"Settings.Sections.Other": "Autre",
Expand Down
47 changes: 47 additions & 0 deletions lua/entities/gmod_tardis/modules/cl_alpha.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
-- Alpha

function ENT:GetAlpha()
local alpha = self:GetData("alpha",255)/255
if self:GetData("vortexalpha",0)>alpha and TARDIS:GetExteriorEnt()==self then
return self:GetData("vortexalpha",0),true
end
if self:GetData("vortex") then
return 0
elseif self:GetData("teleport") then
return alpha
elseif self:GetData("teleport-trace") then
return 20/255
end
return 1
end

local function shouldapply(self,part)
local target,override = self:GetAlpha()
if (target ~= 1 or override) and ((not part) or (part and (not part.CustomAlpha))) then
return target
end
end

local function dopredraw(self,part)
local target = shouldapply(self,part)
if target~=nil then
render.SetBlend(target)
if self:CallHook("ShouldVortexIgnoreZ") then
cam.IgnoreZ(true)
end
end
end

local function dopostdraw(self,part)
if shouldapply(self,part)~=nil then
render.SetBlend(1)
cam.IgnoreZ(false)
end
end

ENT:AddHook("PreDraw","teleport",dopredraw)
ENT:AddHook("PreDrawPart","teleport",dopredraw)
ENT:AddHook("Draw","teleport",dopostdraw)
ENT:AddHook("PostDrawPart","teleport",dopostdraw)
ENT:AddHook("PreDrawPortal","vortex",dopredraw)
ENT:AddHook("PostDrawPortal","vortex",dopostdraw)
16 changes: 16 additions & 0 deletions lua/entities/gmod_tardis/modules/cl_phase_animation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ local function dodraw(self, ent)
local dist2 = normal2:Dot(pos2)
local dist3 = normal:Dot(pos2)

local alpha = self:GetAlpha()

local ignorez = self:CallHook("ShouldVortexIgnoreZ")
if ignorez then
cam.IgnoreZ(true)
end

local oldblend = render.GetBlend()
render.SetBlend(alpha)

render.PushCustomClipPlane(normal, dist)
render.MaterialOverride(self.PhaseMaterial)
render.PushCustomClipPlane(normal2, dist2)
Expand All @@ -29,6 +39,12 @@ local function dodraw(self, ent)
render.PopCustomClipPlane()

render.EnableClipping(oldClip)

render.SetBlend(oldblend)

if ignorez then
cam.IgnoreZ(false)
end

return false
end
Expand Down
15 changes: 11 additions & 4 deletions lua/entities/gmod_tardis/modules/sh_exterior_light.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,17 @@ else
local alpha = shouldpulse and (math.sin(CurTime() * 3.7) + 0.2) * (255 / 4) + (255 / 2) - 70 or 100
render.SetMaterial(mat)
local fallback=false
for k,v in pairs(wp.portals) do -- not ideal but does the job
if wp.shouldrender(v) then
fallback=true
break

if self:GetData("vortex",false) then
fallback=true
end

if not fallback then
for k,v in pairs(wp.portals) do -- not ideal but does the job
if wp.shouldrender(v) then
fallback=true
break
end
end
end

Expand Down
63 changes: 29 additions & 34 deletions lua/entities/gmod_tardis/modules/sh_vortex.lua
Original file line number Diff line number Diff line change
Expand Up @@ -114,54 +114,49 @@ else
end
end)

local function dopredraw(self,part)
local vortexpart = (part and part.ID=="vortex")
ENT:AddHook("PreDrawPart","vortex",function(self,part)
if not (part and part.ID=="vortex") then return end
local target = self:GetData("vortex") and 1 or 0
local alpha = self:GetData("vortexalpha",0)
local vortexalpha = self:GetData("vortexalpha",0)
local enabled = self:IsVortexEnabled()
if TARDIS:GetExteriorEnt()==self and enabled then
if (not (target == 0 and alpha == 0)) or vortexpart then
render.SetBlend(alpha)
if alpha>0 and self:CallHook("ShouldVortexIgnoreZ") then
cam.IgnoreZ(true)
end
render.SetBlend(vortexalpha)
if vortexalpha>0 and self:CallHook("ShouldVortexIgnoreZ") then
cam.IgnoreZ(true)
end
else
if vortexpart or self:GetData("vortex") then
render.SetBlend(0)
end
render.SetBlend(0)
end
end
end)

local function dodraw(self,part)
ENT:AddHook("PostDrawPart","vortex",function(self,part)
if not (part and part.ID=="vortex") then return end
render.SetBlend(1)
local vortexalpha = self:GetData("vortexalpha",0)
if vortexalpha>0 then
if not part and TARDIS:GetExteriorEnt()==self then
local attached = self:GetData("demat-attached")
if attached then
local oldblend = render.GetBlend()
render.SetBlend(vortexalpha)
for k,v in pairs(attached) do
if IsValid(k) and k.DrawModel and v>0 then
local oldc = k:GetColor()
k:SetColor(ColorAlpha(oldc,v))
k:DrawModel()
k:SetColor(oldc)
end
cam.IgnoreZ(false)
end
end)

ENT:AddHook("Draw","vortex",function(self)
if TARDIS:GetExteriorEnt()==self then
local attached = self:GetData("demat-attached")
if attached then
local oldblend = render.GetBlend()
local vortexalpha = self:GetData("vortexalpha",0)
render.SetBlend(vortexalpha)
for k,v in pairs(attached) do
if IsValid(k) and k.DrawModel and v>0 then
local oldc = k:GetColor()
k:SetColor(ColorAlpha(oldc,v))
k:DrawModel()
k:SetColor(oldc)
end
render.SetBlend(oldblend)
end
render.SetBlend(oldblend)
end
cam.IgnoreZ(false)
end
end
ENT:AddHook("PreDraw","vortex",dopredraw)
ENT:AddHook("PreDrawPart","vortex",dopredraw)
ENT:AddHook("Draw","vortex",dodraw)
ENT:AddHook("PostDrawPart","vortex",dodraw)
ENT:AddHook("PreDrawPortal","vortex",dopredraw)
ENT:AddHook("PostDrawPortal","vortex",dodraw)
end)

ENT:AddHook("ShouldNotRenderPortal","vortex",function(self,parent,portal,exit)
if self:GetData("vortex") and (TARDIS:GetExteriorEnt()~=self or (not self:IsVortexEnabled())) then
Expand Down
29 changes: 1 addition & 28 deletions lua/entities/gmod_tardis/modules/teleport/cl_tp_rendering.lua
Original file line number Diff line number Diff line change
@@ -1,32 +1,5 @@
-- Draw and render teleport-related functions

local function shouldapply(self,part)
if
(self:GetData("teleport") or self:GetData("teleport-trace"))
and not (self:GetData("vortexalpha",0)>0 and TARDIS:GetExteriorEnt()==self)
and ((not part) or (part and (not part.CustomAlpha)))
then
return true
end
end

local function dopredraw(self,part)
if shouldapply(self,part) then
render.SetBlend((self:GetData("teleport-trace") and 20 or self:GetData("alpha",255))/255)
end
end

local function dodraw(self,part)
if shouldapply(self,part) then
render.SetBlend(1)
end
end

ENT:AddHook("PreDraw","teleport",dopredraw)
ENT:AddHook("PreDrawPart","teleport",dopredraw)
ENT:AddHook("Draw","teleport",dodraw)
ENT:AddHook("PostDrawPart","teleport",dodraw)

ENT:AddHook("ShouldAllowThickPortal", "teleport", function(self, portal)
if self.interior and portal==self.interior.portals.exterior then
if self:GetData("teleport-trace") then
Expand All @@ -51,4 +24,4 @@ hook.Add("PostDrawTranslucentRenderables", "tardis-trace", function()
render.DrawLine(pos,pos+(ri*size),col)
render.DrawLine(pos,pos+(le*size),col)
end
end)
end)
8 changes: 4 additions & 4 deletions lua/tardis/interiors/modules/sh_templates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,15 @@ function TARDIS:MergeTemplates(metadata, ent)
templates_todo = {}
for template_id, template in pairs(metadata.Templates) do
if not template.condition then
templates_todo[template_id] = template
table.insert(templates_todo, template_id)
end
end
elseif SERVER then
ent.templates = {}

for template_id, template in pairs(metadata.Templates) do
if template and istable(template) and (not template.condition or template.condition(id, ent:GetCreator(), ent)) then
ent.templates[template_id] = TARDIS:CopyTable(template)
ent.templates[template_id].condition = nil
table.insert(ent.templates, template_id)
end
end

Expand All @@ -163,7 +162,8 @@ function TARDIS:MergeTemplates(metadata, ent)
end


for template_id, template in pairs(templates_todo) do
for i,template_id in ipairs(templates_todo) do
local template = metadata.Templates[template_id]

if template and template.realID then
template_id = template.realID
Expand Down
7 changes: 6 additions & 1 deletion lua/tardis/languages/fr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ T.Phrases = {
["Chameleon.FailReasons.AlreadyChanging"] = "L'extérieur est déjà en cours de modification!",
["Chameleon.FailReasons.AlreadySelected"] = "Cet extérieur est déjà sélectionné",
["Chameleon.FailReasons.DoorsOpen"] = "En attente de la fermeture des portes...",
["Chameleon.FailReasons.NoPower"] = "Le circuit caméléon ne peut fonctionner sans énergie",
["Chameleon.FailReasons.NoPower"] = "Le circuit caméléon ne peut fonctionner sans allimentation",
["Chameleon.FailReasons.NotEnoughArtron"] = "Énergie artron insuffisante pour activer le circuit caméléon",
["Chameleon.FailReasons.SameSelected"] = "Le TARDIS applique déjà cet extérieur",
["Chameleon.FailReasons.Teleporting"] = "L'extérieur sera modifié lorsque le TARDIS atterrira",
Expand Down Expand Up @@ -211,6 +211,9 @@ T.Phrases = {
["Controls.ThirdPerson"] = "Contrôle de vol",
["Controls.ThirdPerson.Tip"] = "Contrôle manuel de vol",
["Controls.ThirdPersonCareful.Tip"] = "Contrôle manuel de vol",
["Controls.ToggleConsole"] = "Activer/Desactiver Console",
["Controls.ToggleConsole.Status"] = "Console",
["Controls.ToggleConsole.Tip"] = "Interrupteur de la console",
["Controls.ToggleScanners"] = "Activation des scanneurs",
["Controls.ToggleScanners.FailedToggle"] = "Impossible d'utiliser les scanners intérieurs",
["Controls.ToggleScanners.Status"] = "Scanneurs intérieurs",
Expand Down Expand Up @@ -471,6 +474,8 @@ T.Phrases = {
["Settings.Sections.Misc.Tips"] = "Astuces",
["Settings.Sections.Misc.Tips.Enabled"] = "Astuces",
["Settings.Sections.Misc.Tips.Enabled.Description"] = "Faut-il afficher les astuces pour les contrôles du TARDIS ?",
["Settings.Sections.Misc.Tips.ShowAll"] = "Toujours afficher toutes les astuces",
["Settings.Sections.Misc.Tips.ShowAll.Description"] = "Les astuces doivent-elles être toutes affichées pour les contrôles du TARDIS ?",
["Settings.Sections.Misc.Tips.Style"] = "Style d'Astuces",
["Settings.Sections.Misc.Tips.Style.Description"] = "Quel style doivent utiliser les astuces du TARDIS ?",
["Settings.Sections.Other"] = "Autre",
Expand Down

0 comments on commit cad31a8

Please sign in to comment.