class_name CockpitSideEquipment extends Node3D const CockpitMaterialPalette = preload( "res://game/presentation/cockpit/cockpit_material_palette.gd" ) const CockpitMeshFactory = preload( "res://game/presentation/cockpit/cockpit_mesh_factory.gd" ) var _materials: CockpitMaterialPalette var _junction_box_count := 0 var _control_count := 0 func _init(materials: CockpitMaterialPalette) -> void: _materials = materials name = "SideEquipment" _build_right_electrical_bank() func junction_box_count() -> int: return _junction_box_count func control_count() -> int: return _control_count func _build_right_electrical_bank() -> void: var root := Node3D.new() root.name = "ElectricalBank" # Seated on the flat end cap of the pressure hull, behind the sonar. root.position = Vector3(0.14, -0.18, -0.055) add_child(root) _add_service_box(root, Vector3(0.72, 0.65, -1.17), "ELEC", 11.0) _add_service_box(root, Vector3(0.73, 0.36, -1.16), "POMPES", 8.0) _add_vent(root, Vector3(0.705, 0.69, -1.095)) _add_vent(root, Vector3(0.715, 0.40, -1.085)) _add_knob(root, Vector3(0.66, 0.55, -1.08)) _add_knob(root, Vector3(0.68, 0.25, -1.07)) func _add_service_box( root: Node3D, box_position: Vector3, caption: String, yaw_degrees: float ) -> void: CockpitMeshFactory.add_box( "JunctionBox", root, box_position, Vector3(0.17, 0.23, 0.12), _materials.overhead_steel, Vector3(0.0, yaw_degrees, 0.0) ) var label := Label3D.new() label.name = "%sPlate" % caption.to_pascal_case() label.text = caption label.font_size = 12 label.pixel_size = 0.00065 label.modulate = Color(0.13, 0.16, 0.14) label.position = box_position + Vector3(0.0, 0.075, 0.067) root.add_child(label) for corner: Vector2 in [ Vector2(-0.065, -0.085), Vector2(-0.065, 0.085), Vector2(0.065, -0.085), Vector2(0.065, 0.085), ]: CockpitMeshFactory.add_cylinder( "BoxFastener", root, box_position + Vector3(corner.x, corner.y, 0.065), 0.008, 0.01, _materials.dark_steel, Vector3(90.0, 0.0, 0.0) ) _junction_box_count += 1 func _add_vent(root: Node3D, center: Vector3) -> void: for row in 5: CockpitMeshFactory.add_box( "VentSlit", root, center + Vector3(0.0, (row - 2) * 0.018, 0.0), Vector3(0.085, 0.007, 0.009), _materials.dark_steel ) func _add_knob(root: Node3D, knob_position: Vector3) -> void: CockpitMeshFactory.add_cylinder( "ControlKnob", root, knob_position, 0.027, 0.026, _materials.rubber, Vector3(90.0, 0.0, 0.0) ) _control_count += 1