Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

Commit

Permalink
Update cl_scenes.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
sophfee authored Dec 15, 2021
1 parent 5941765 commit 2f41891
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion gamemode/core/cl_scenes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ landis.Scene.fromPos = nil
landis.Scene.fromAng = nil
landis.Scene.toPos = nil
landis.Scene.toAng = nil
landis.Scene.Fading = false
landis.Scene.Tween = nil

function landis.PlayScene(self)
self.IsPlaying = true
-- faster inheritence?? idk test the performance of this.
landis.Scene = table.Inherit(landis.Scene,self)
landis.Playhead = 0
landis.Scene.Fading = false
landis.Scene.Playhead = 0
landis.Scene.Tween = tween.new(self.Duration, landis.Scene, {"Playhead"=self.Duration}, "outInQuad")
LocalPlayer():ScreenFade(SCREENFADE.IN,Color(0,0,0,255),0.25,0)
end
Expand All @@ -27,5 +29,13 @@ hook.Add("CalcView","landisPlayScene",function()
local view = {}
view.origin = LerpVector(scene.Playhead/scene.Duration,scene.fromPos,scene.toPos)
view.angles = LerpAngle(scene.Playhead/scene.Duration,scene.fromAng,scene.toAng)
if scene.Playhead > scene.Duration - .25 and not scene.Fading then
landis.Scene.Fading = true
LocalPlayer():ScreenFade(SCREENFADE.IN,Color(0,0,0,255),.25,0)
timer.Simple(.25, function()
landis.Scene.IsPlaying = false
LocalPlayer():ScreenFade(SCREENFADE.OUT,Color(0,0,0,255),.75,0)
end)
end
return view
end)

0 comments on commit 2f41891

Please sign in to comment.