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

Commit

Permalink
Kind of working Rainbow Dash
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorienXP committed May 28, 2016
1 parent 504b009 commit 8262fcd
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 20 deletions.
32 changes: 13 additions & 19 deletions gamemodes/fnapgm/gamemode/init.lua
Expand Up @@ -67,7 +67,6 @@ function fnapgmStartNightCustom(ply)
ents.FindByName( "RainbowTimer" )[1]:Fire("UpperRandomBound", 120)
ents.FindByName( "RainbowTimer2" )[1]:Fire("LowerRandomBound", 10)
ents.FindByName( "RainbowTimer2" )[1]:Fire("UpperRandomBound", 20)
ents.FindByName( "PinkieIsScaryTimer" )[1]:Fire("Enable")
elseif GAMEMODE.Vars.night==1 then
ents.FindByName( "RainbowTimer" )[1]:Fire("Kill")
elseif GAMEMODE.Vars.night==2 then
Expand All @@ -85,33 +84,29 @@ function fnapgmStartNightCustom(ply)
ents.FindByName( "RainbowTimer" )[1]:Fire("UpperRandomBound", 260)
ents.FindByName( "RainbowTimer2" )[1]:Fire("LowerRandomBound", 20)
ents.FindByName( "RainbowTimer2" )[1]:Fire("UpperRandomBound", 40)
ents.FindByName( "PinkieIsScaryTimer" )[1]:Fire("Enable")
elseif GAMEMODE.Vars.night==5 then
ents.FindByName( "RainbowTimer" )[1]:Fire("LowerRandomBound", 60)
ents.FindByName( "RainbowTimer" )[1]:Fire("UpperRandomBound", 160)
ents.FindByName( "RainbowTimer2" )[1]:Fire("LowerRandomBound", 15)
ents.FindByName( "RainbowTimer2" )[1]:Fire("UpperRandomBound", 30)
ents.FindByName( "PinkieIsScaryTimer" )[1]:Fire("Enable")
elseif GAMEMODE.Vars.night==6 then
ents.FindByName( "RainbowTimer" )[1]:Fire("LowerRandomBound", 30)
ents.FindByName( "RainbowTimer" )[1]:Fire("UpperRandomBound", 120)
ents.FindByName( "RainbowTimer2" )[1]:Fire("LowerRandomBound", 10)
ents.FindByName( "RainbowTimer2" )[1]:Fire("UpperRandomBound", 20)
ents.FindByName( "PinkieIsScaryTimer" )[1]:Fire("Enable")
else
ents.FindByName( "RainbowTimer" )[1]:Fire("LowerRandomBound", 30)
ents.FindByName( "RainbowTimer" )[1]:Fire("UpperRandomBound", 120)
ents.FindByName( "RainbowTimer2" )[1]:Fire("LowerRandomBound", 10)
ents.FindByName( "RainbowTimer2" )[1]:Fire("UpperRandomBound", 20)
ents.FindByName( "PinkieIsScaryTimer" )[1]:Fire("Enable")
end
GAMEMODE:CreateAnimatronic(GAMEMODE.Animatronic.Pinkie, GAMEMODE.APos.fnap_scc.SS)
GAMEMODE:CreateAnimatronic(GAMEMODE.Animatronic.Fluttershy, GAMEMODE.APos.fnap_scc.SS)
GAMEMODE:CreateAnimatronic(GAMEMODE.Animatronic.Twilight, GAMEMODE.APos.fnap_scc.SS)
GAMEMODE:CreateAnimatronic(GAMEMODE.Animatronic.Rarity, GAMEMODE.APos.fnap_scc.SS)
GAMEMODE:CreateAnimatronic(GAMEMODE.Animatronic.Applejack, GAMEMODE.APos.fnap_scc.SS)
--GAMEMODE:CreateAnimatronic(GAMEMODE.Animatronic.RainbowDash, GAMEMODE.APos.fnap_scc.Trash)
GAMEMODE:CreateAnimatronic(GAMEMODE.Animatronic.RainbowDash, GAMEMODE.APos.fnap_scc.Trash)
timer.Create( "fnafgmTempoStartU", 1.3, 1, function()
Expand Down Expand Up @@ -777,14 +772,16 @@ function fnapgmRainbowDash(self)

if self.FoxyMove then
self.FoxyMove = false
self.loco:SetDesiredSpeed( 600 )
self.FoxyMoveState = self:MoveToPos(Vector(355, -311, -91.8968),{maxage=1,draw=true})
self.FoxyMoveState = self:MoveToPos(Vector(324, -15, 32),{maxage=1,draw=true})
self:SetPos(Vector(324, -15, 32))
self.FoxyMoveState = self:MoveToPos(Vector(200, -10, 32),{maxage=1,draw=true})
self:SetPos(Vector(200, -10, 32))
self.FoxyMoveState = self:MoveToPos(GAMEMODE.FNaFView[game.GetMap()][1],{maxage=30,draw=true})
self:Jumpscare()
self.FoxyMove2 = true
for k, v in pairs(player.GetAll()) do

if v:Team()!=TEAM_CONNECTING and v:Team()!=TEAM_UNASSIGNED then

v:SendLua([[LocalPlayer():EmitSound("fnapgm_runrainbowdash")]])

end

end
end

if self.FoxyWillMove or self.FoxyMove then coroutine.wait(0.1) else coroutine.wait(1) end
Expand Down Expand Up @@ -916,7 +913,7 @@ function fnapgmGoJumpscare(me,self,timet)
if GAMEMODE.Vars.startday and me!=GAMEMODE.Animatronic.RainbowDash then
self:Jumpscare()
elseif GAMEMODE.Vars.startday then
self:SetPos(Vector(355, -311, -91.8968))
self:SetPos(Vector(417.923, -388.438, -95.7159))
self:SetAngles(Angle(0, 0, 0))
self.FoxyWillMove = false
self.FoxyMove = true
Expand Down Expand Up @@ -1018,7 +1015,7 @@ function fnapgmJumpscare(me,self)

GAMEMODE:Log("Jumpscared by "..GAMEMODE.AnimatronicName[me])

elseif me==GAMEMODE.Animatronic.RainbowDash and ( self.FoxyMoveState=="ok" or GAMEMODE:CheckPlayerSecurityRoom(self) ) then
elseif me==GAMEMODE.Animatronic.RainbowDash and !GAMEMODE.Vars.DoorClosed[2] then

for k, v in pairs(player.GetAll()) do

Expand Down Expand Up @@ -1064,13 +1061,10 @@ function fnapgmJumpscare(me,self)

if me==GAMEMODE.Animatronic.RainbowDash then

self:SetColor( Color( 255, 255, 255, 0 ) )

timer.Create( "fnafgmFoxyReset", 1, 1, function()
self:SetPos(GAMEMODE.AnimatronicAPos[me][game.GetMap()][GAMEMODE.APos[game.GetMap()].Trash][1])
self:SetAngles(GAMEMODE.AnimatronicAPos[me][game.GetMap()][GAMEMODE.APos[game.GetMap()].Trash][2])
GAMEMODE:SetAnimatronicPos(nil,me,GAMEMODE.APos[game.GetMap()].Trash)
self:SetColor( Color( 255, 255, 255, 255 ) )
timer.Remove( "fnafgmFoxyReset" )
end)

Expand Down
82 changes: 81 additions & 1 deletion gamemodes/fnapgm/gamemode/shared.lua
Expand Up @@ -8,7 +8,7 @@ GM.Author = "Xperidia"
GM.Email = "contact@Xperidia.com"
GM.Website = "http://go.Xperidia.com/FNAPGM"

GM.Version = 1.39
GM.Version = 1.40
GM.CustomVersionChecker = "http://xperidia.com/fnapgmversion.txt"

if game.GetMap()=="fnap_cb" then
Expand Down Expand Up @@ -66,6 +66,13 @@ hook.Add( "Initialize", "fnapgmInit", function()
level = 0,
sound = "fnafsounds/pinkieisscary.wav"
} )
sound.Add( {
name = "fnapgm_runrainbowdash",
channel = CHAN_AUTO,
volume = 0.8,
level = 0,
sound = "fnafsounds/runrainbowdash.wav"
} )

end)

Expand Down Expand Up @@ -523,3 +530,76 @@ function fnapgmAnimatronicsCD()

end
hook.Add( "fnafgmCustomAnimatronicsCD", "fnapgmAnimatronicsCD", fnapgmAnimatronicsCD)

function fnapgmAnimatronicMove(self,me,apos)

if apos!=nil and self.OldAPos != apos then

self.OldAPos = apos

if me!=GAMEMODE.Animatronic.RainbowDash then

self:SetColor( Color( 255, 255, 255, 0 ) )

if GAMEMODE.AnimatronicAPos[me] and GAMEMODE.AnimatronicAPos[me][game.GetMap()] and GAMEMODE.AnimatronicAPos[me][game.GetMap()][apos] then
self:SetPos(GAMEMODE.AnimatronicAPos[me][game.GetMap()][apos][1])
self:SetAngles(GAMEMODE.AnimatronicAPos[me][game.GetMap()][apos][2])
end

self:SetColor( Color( 255, 255, 255, 255 ) )

end

elseif me==GAMEMODE.Animatronic.RainbowDash and apos==GAMEMODE.APos[game.GetMap()].Office and self.FoxyWillMove then

if self:GetColor()!=Color( 255, 255, 255, 255 ) then self:SetColor( Color( 255, 255, 255, 255 ) ) end

elseif me==GAMEMODE.Animatronic.RainbowDash and apos==GAMEMODE.APos[game.GetMap()].Office and self.FoxyMove2 then

if self:GetColor()!=Color( 255, 255, 255, 255 ) then self:SetColor( Color( 255, 255, 255, 255 ) ) end

if !self.ltime or self.ltime<1 then
self.ltime = (self.ltime or 0) + FrameTime()
elseif !self.ltime or self.ltime>=1 then
self.ltime = 0
self.sta = (self.sta or 0) + 1
end

if !self.sta or self.sta==0 then
self:SetPos( LerpVector( self.ltime, GAMEMODE.AnimatronicAPos[me][game.GetMap()][apos][1], Vector(417.923, -388.438, -95.7159) ) )
self:SetAngles( LerpAngle( self.ltime, GAMEMODE.AnimatronicAPos[me][game.GetMap()][apos][2], Angle(0,120,0) ) )
elseif self.sta==1 then
self:SetPos( LerpVector( self.ltime, Vector(417.923, -388.438, -95.7159), Vector(323, -186.201813, -89.016739) ) )
self:SetAngles( LerpAngle( self.ltime, Angle(0,120,0), Angle(0,90,0) ) )
elseif self.sta==2 then
self:SetPos( LerpVector( self.ltime, Vector(323, -186.201813, -89.016739), Vector(323, -70.793152, 32) ) )
self:SetAngles( Angle(-40,90,0) )
elseif self.sta==3 then
self:SetPos( LerpVector( self.ltime, Vector(323, -70.793152, 32), Vector(283.779999, -15.925056, 32) ) )
self:SetAngles(LerpAngle( self.ltime, Angle(0,90,0), Angle(0,-180,0) ) )
elseif self.sta==4 then
self:SetPos( LerpVector( self.ltime, Vector(283.779999, -15.925056, 32), Vector(-137.194016, -8.655641, 32) ) )
self:SetAngles( Angle(0,-180,0) )
elseif self.sta==5 then
self:SetPos( LerpVector( self.ltime, Vector(-137.194016, -8.655641, 32), Vector(-385.440521, -42.308228, 32) ) )
self:SetAngles(LerpAngle( self.ltime, Angle(0,-180,0), Angle(0,-150,0) ) )
elseif self.sta==6 then
self:SetPos( LerpVector( self.ltime, Vector(-385.440521, -42.308228, 32), Vector(-431.247833, -95, 32) ) )
self:SetAngles(LerpAngle( self.ltime, Angle(0,-150,0), Angle(0,-90,0) ) )
elseif self.sta==7 then
self:Jumpscare()
self.FoxyMove2 = false
end

elseif me==GAMEMODE.Animatronic.RainbowDash and apos==GAMEMODE.APos[game.GetMap()].Trash then

if self:GetColor()!=Color( 255, 255, 255, 0 ) then self:SetColor( Color( 255, 255, 255, 0 ) ) end

if !self.sta or self.sta>0 then self.sta=0 end

end

return true

end
hook.Add( "fnafgmAnimatronicMove", "fnapgmAnimatronicMove", fnapgmAnimatronicMove)

0 comments on commit 8262fcd

Please sign in to comment.