Add round stages, respawn protection and match highlights
This commit is contained in:
1 parent
b87a3770a1
commit
d1c42a36b8
28 files changed
+753
-45
No files matched your search
@@ -45,6 +45,11 @@ local SAMPLE_STEP = 1 / 30
|
||||
local round = ReplicatedStorage:WaitForChild("ArenaRound")
|
||||
local ArenaModes = require(ReplicatedStorage:WaitForChild("ArenaModes") :: ModuleScript)
|
||||
local Objectives = require(script.Parent:WaitForChild("ArenaObjectives") :: ModuleScript)
|
||||
local Hunter = ReplicatedStorage:WaitForChild("Hunter")
|
||||
local Stage = require(Hunter:WaitForChild("Stage") :: ModuleScript)
|
||||
local Runtime = script.Parent:WaitForChild("ModeRuntime")
|
||||
local Stats = require(Runtime:WaitForChild("Stats") :: ModuleScript)
|
||||
local RoundPlayer = require(Runtime:WaitForChild("PlayerRoundState") :: ModuleScript)
|
||||
local TrophyDrops = require(script.Parent:WaitForChild("TrophyDrops"))
|
||||
local PowerDrops = require(script.Parent:WaitForChild("PowerUpDrops"))
|
||||
local PowerEffects = require(script.Parent:WaitForChild("PowerUpEffects"))
|
||||
@@ -67,6 +72,7 @@ local function recordArenaKill(player: Player, victim: Player, origin: Vector3,
|
||||
if side ~= "Blue" and side ~= "Orange" then return nil end
|
||||
local scoreAttribute = side .. "Kills"
|
||||
local state = ArenaModes.state(round, mode)
|
||||
Stats.add(player, "kills", 1)
|
||||
player:SetAttribute("RoundKills", ((player:GetAttribute("RoundKills") :: number?) or 0) + 1)
|
||||
state:SetAttribute(scoreAttribute, ((state:GetAttribute(scoreAttribute) :: number?) or 0) + 1)
|
||||
local match = Objectives.current(mode)
|
||||
@@ -125,6 +131,8 @@ local function applyHit(
|
||||
player: Player, character: Model, shooter: Humanoid, model: Model, humanoid: Humanoid,
|
||||
victim: Player?, hit: ShotHistory.Hit, origin: Vector3, params: RaycastParams, mode: string
|
||||
)
|
||||
local now = workspace:GetServerTimeNow()
|
||||
if not Stage.combatAllowed(ArenaModes.state(round, mode)) then return end
|
||||
local eye = headOf(character)
|
||||
if player.Character ~= character or not inMode(player, mode) or shooter.Health <= 0
|
||||
or not model.Parent or humanoid.Health <= 0 or not hit.part:IsDescendantOf(model)
|
||||
@@ -139,6 +147,11 @@ local function applyHit(
|
||||
return
|
||||
end
|
||||
|
||||
local shield = victim and victim:GetAttribute("SpawnShield")
|
||||
if typeof(shield) == "number" and shield > now then
|
||||
broadcast(mode, remote, character, hit.position)
|
||||
return
|
||||
end
|
||||
local before = humanoid.Health
|
||||
PowerEffects.damage(model, humanoid, math.floor(damageFor(hit.zone) + .5), workspace:GetServerTimeNow())
|
||||
local damage = before - humanoid.Health
|
||||
@@ -173,7 +186,8 @@ remote.OnServerEvent:Connect(function(player: Player, direction: unknown, camera
|
||||
or timestamp ~= timestamp or math.abs(timestamp) == math.huge then return end
|
||||
local received = workspace:GetServerTimeNow()
|
||||
local mode = ArenaModes.of(player)
|
||||
if player:GetAttribute("InArena") ~= true or not ArenaModes.open(round, mode, received) then return end
|
||||
if player:GetAttribute("InArena") ~= true or not ArenaModes.open(round, mode, received)
|
||||
or not Stage.combatAllowed(ArenaModes.state(round, mode)) then return end
|
||||
local oneWay = math.clamp(player:GetNetworkPing() * .5, 0, .20)
|
||||
local ageLimit = math.clamp(oneWay + .10, .12, .30)
|
||||
if timestamp > received + .035 or timestamp < received - ageLimit then return end
|
||||
@@ -198,6 +212,7 @@ remote.OnServerEvent:Connect(function(player: Player, direction: unknown, camera
|
||||
world.FilterDescendantsInstances = excluded
|
||||
world.RespectCanCollide = true
|
||||
if obstruction(eye, cameraOrigin, world) then return end
|
||||
if player:GetAttribute("SpawnShield") ~= nil then RoundPlayer.clearShield(player) end
|
||||
|
||||
local origin, dir = cameraOrigin, direction.Unit
|
||||
local worldHit = workspace:Raycast(origin, dir * RANGE, world)
|
||||
|
||||
Reference in new issue
Block a user