Refactor arena modes and add objective event feed
This commit is contained in:
1 parent
df6ab8efe1
commit
b87a3770a1
26 files changed
+1221
-654
No files matched your search
@@ -0,0 +1,19 @@
|
||||
--!strict
|
||||
export type Spec = {radius: number, height: number, sightHeight: number, exclusiveHeight: boolean?}
|
||||
export type Reason = "Outside" | "Height" | "Blocked" | "Inside"
|
||||
local Zones = {}
|
||||
|
||||
function Zones.reason(delta: Vector3, spec: Spec, blocked: boolean): Reason
|
||||
if delta.X * delta.X + delta.Z * delta.Z > spec.radius * spec.radius then return "Outside" end
|
||||
local height = math.abs(delta.Y)
|
||||
if height > spec.height or (height == spec.height and spec.exclusiveHeight) then return "Height" end
|
||||
return if blocked then "Blocked" else "Inside"
|
||||
end
|
||||
|
||||
function Zones.classify(position: Vector3, center: Vector3, spec: Spec, geometry: RaycastParams): Reason
|
||||
local candidate = Zones.reason(position - center, spec, false)
|
||||
if candidate ~= "Inside" then return candidate end
|
||||
local target = center + Vector3.yAxis * spec.sightHeight
|
||||
return if workspace:Raycast(position, target - position, geometry) then "Blocked" else "Inside"
|
||||
end
|
||||
return Zones
|
||||
Reference in new issue
Block a user