Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Sayis Destruction System
- behaviour("SayisTheJew")
- local PLAYER_TEAM = Team.Blue
- local ENEMY_TEAM = Team.Red
- local MIN_SPAWN_DISTANCE = 5
- local MAX_SPAWN_DISTANCE = 10
- -- local variables are launched using the awake function in the ravenscript api
- function SayisTheJew:Awake()
- -- A `CapturePoint` where the player will start.
- self.playerSpawn = nil -- CapturePoint
- local Nodes = Ravenlua.new("Behaviour_Options")
- for i,v in pairs(get(nodes) ) ;
- print(Nodes)
- -- Overlay Text
- Overlay.ShowMessage("Detected" + Nodes)
- self.enemySpawn = {} -- array<PathfindingNode>
- self.enemyBase = nil -- SpawnPoint
- self.numAliveEnemies = 0
- -- A number that represents the game's difficulty setting. Not used.
- self.difficulty = 0.4
- end
- -- function is called to modify gamerule in ravenscript api
- function MyGameMode:OnModifyRules(rules)
- print("Gamerule 1 detected, modifying.")
- rules.noVehicles = true
- rules.noTurrets = true
- rules.playerTeam = PLAYER_TEAM
- rules.nightMode = true
- rules.balance = 1
- self.difficulty = rules.difficulty
- rules.spawnDeadPlayers = true
- end
- -- core scripts
- function SayisTheJew:OnStartGame()
- local crates = GameObject.FindObjectsOfType(ResupplyCrate)
- for i,c in ipairs(crates) do
- GameObject.Destroy(c)
- end
- print("Removed " .. tostring(#crates) .. " crates")
- for i,sp in ipairs(ActorManager.spawnPoints) do
- sp.gameObject:SetActive(false)
- end
- for i,sp in ipairs(ActorManager.spawnPoints) do
- if sp.isCapturePoint and sp.defaultOwner == PLAYER_TEAM then
- self.playerSpawn = sp
- print("Found player spawn point")
- break
- end
- end
- for i,sp in ipairs(ActorManager.spawnPoints) do
- if sp ~= self.playerSpawn then
- local nodes = self:FindNodesCloseToSpawnPoint(sp)
- table.add_range(self.enemySpawn, nodes)
- -- Defend from the sayis jews
- if sp.defaultOwner == ENEMY_TEAM then
- self.enemyBase = sp
- end
- end
- end
- print("Found ".. tostring(#self.enemySpawn) .." enemy spawn points")
- end
- function SayisTheJew:OnLoadoutAccepted(e)
- if e.firstTime then
- print("Player is ready!")
- self:SpawnDeadActorsOfTeam(PLAYER_TEAM)
- self:SpawnDeadActorsOfTeam(ENEMY_TEAM)
- Overlay.ShowMessage("Make sure that you don't see any whores nearby")
- end
- return true
- end
- function SayisTheJew:FindNodesCloseToSpawnPoint(spawnPoint)
- local close = {} -- array<PathfindingNode>
- local center = spawnPoint.transform.position
- local radius = MAX_SPAWN_DISTANCE
- local nodes = Pathfinding.FindNodes(center, radius)
- for i,node in ipairs(nodes) do
- local distance = Vector3.Distance(node.position, center)
- if distance > MIN_SPAWN_DISTANCE and distance < MAX_SPAWN_DISTANCE then
- table.insert(close, node)
- end
- end
- return close
- end
- function SayisTheJew:GetRandomEnemySpawn()
- local i = Random.Range(1, #self.enemySpawn)
- local node = self.enemySpawn[i]
- return node:RandomPointOnSurface()
- end
- function SayisTheJew:OnSpawnActors(e)
- if e.team == PLAYER_TEAM then
- -- From the player's team we are only interested in spawning the
- -- player. All others are left for dead.
- for i,actor in ipairs(e.actorsToSpawn) do
- if actor.isPlayer then
- actor.SpawnAt(self.playerSpawn.spawnPosition,
- Quaternion.identity)
- end
- end
- else
- self.numAliveEnemies = self.numAliveEnemies + #e.actorsToSpawn
- for i,actor in ipairs(e.actorsToSpawn) do
- actor.SpawnAt(self:GetRandomEnemySpawn(), Quaternion.identity)
- end
- Order.PatrolBase(e.actorsToSpawn, self.enemyBase)
- end
- return true
- end
- ]
- function SayisTheJew:OnActorDied(e)
- if e.actor.isPlayer then
- -- The player is dead! Game over!
- print("rip lmao its ok though sayis usually dies after like 1 battle in rp")
- Overlay.ShowMessage("Vaccinate yourself Sayis")
- self:GameLost()
- end
- if e.actor.team == ENEMY_TEAM then
- -- A bot was killed. Keep track of number of living bots.
- self.numAliveEnemies = self.numAliveEnemies - 1
- print("Enemies alive: " .. tostring(self.numAliveEnemies))
- if self.numAliveEnemies <= 0 then
- -- All bots dead! Game over!
- self:GameWon()
- end
- end
- return true -- Override default behavior
- end
- function SayisTheJew:GameLost()
- print("i mean its not game lost since sayis still dies")
- self.script.StartCoroutine("FadeInGameOver")
- end
- function SayisTheJew:FadeInGameOver()
- self.targets.canvas.SetActive(true)
- ` local blackout = self.targets.blackout.GetComponent(UiImage)
- local color = Color(0, 0, 0, 0)
- local steps = 100
- for i = 1, steps do
- color.a = (1 / steps) * i
- blackout.color = color
- coroutine.yield(WaitForSeconds(0.02))
- end
- end
- function SayisTheJew:GameWon()
- print("gottem")
- Overlay.ShowMessage("Sayis Didn't Think Of This NOOOO HE DIED OMG")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement