Implement production vertical slice foundation
This commit is contained in:
1 parent
9d4a89f355
commit
a18e82eb44
104 files changed
+10595
-268
No files matched your search
@@ -0,0 +1,70 @@
|
||||
class_name DiveStep
|
||||
extends RefCounted
|
||||
|
||||
const DiveTick = preload("res://game/domain/dive/dive_tick.gd")
|
||||
const DiveTelemetrySample = preload("res://game/domain/dive/dive_telemetry_sample.gd")
|
||||
const CollisionObservation = preload("res://game/domain/dive/collision_observation.gd")
|
||||
const ToolPowerDemand = preload("res://game/domain/dive/tool_power_demand.gd")
|
||||
const EjectionIntent = preload("res://game/domain/dive/ejection_intent.gd")
|
||||
const ReturnRouteSample = preload("res://game/domain/dive/return_route_sample.gd")
|
||||
|
||||
var tick: DiveTick
|
||||
var telemetry: DiveTelemetrySample
|
||||
var collisions: Array[CollisionObservation]
|
||||
var tool_power_demands: Array[ToolPowerDemand]
|
||||
var ejection_intent: EjectionIntent
|
||||
var return_route: ReturnRouteSample
|
||||
|
||||
|
||||
func _init(
|
||||
p_tick: DiveTick,
|
||||
p_telemetry: DiveTelemetrySample,
|
||||
p_collisions: Array[CollisionObservation] = [],
|
||||
p_tool_power_demands: Array[ToolPowerDemand] = [],
|
||||
p_ejection_intent: EjectionIntent = null,
|
||||
p_return_route: ReturnRouteSample = null
|
||||
) -> void:
|
||||
tick = p_tick
|
||||
telemetry = p_telemetry
|
||||
collisions = p_collisions.duplicate()
|
||||
tool_power_demands = p_tool_power_demands.duplicate()
|
||||
ejection_intent = p_ejection_intent if p_ejection_intent != null else EjectionIntent.new()
|
||||
return_route = p_return_route if p_return_route != null else ReturnRouteSample.new()
|
||||
|
||||
|
||||
func validation_error() -> String:
|
||||
if tick == null:
|
||||
return "DiveStep has no tick"
|
||||
var error: String = tick.validation_error()
|
||||
if not error.is_empty():
|
||||
return error
|
||||
if telemetry == null:
|
||||
return "DiveStep has no telemetry"
|
||||
error = telemetry.validation_error()
|
||||
if not error.is_empty():
|
||||
return error
|
||||
if ejection_intent == null:
|
||||
return "DiveStep has no ejection intent"
|
||||
if return_route == null:
|
||||
return "DiveStep has no return route sample"
|
||||
error = return_route.validation_error()
|
||||
if not error.is_empty():
|
||||
return error
|
||||
for collision: CollisionObservation in collisions:
|
||||
if collision == null:
|
||||
return "DiveStep contains a null collision"
|
||||
error = collision.validation_error(tick.sequence)
|
||||
if not error.is_empty():
|
||||
return error
|
||||
for demand: ToolPowerDemand in tool_power_demands:
|
||||
if demand == null:
|
||||
return "DiveStep contains a null tool power demand"
|
||||
error = demand.validation_error()
|
||||
if not error.is_empty():
|
||||
return error
|
||||
var tool_ids: Dictionary[StringName, bool] = {}
|
||||
for demand: ToolPowerDemand in tool_power_demands:
|
||||
if tool_ids.has(demand.tool_id):
|
||||
return "DiveStep contains duplicate tool power demands"
|
||||
tool_ids[demand.tool_id] = true
|
||||
return ""
|
||||
Reference in new issue
Block a user