Complete M11 Creator Studio and M12 Trust & Safety for PC5
checkpoint / checkpoint (push) Failing after 3h14m9s
checkpoint / checkpoint (push) Failing after 3h14m9s
- Creator Studio: Visual behavior & property inspector, GLB model importer, binary persistence - Trust & Safety: 18+ TOS confirmation (DOB removed), creator guidelines & briefing card on join, in-game reporting HUD - Test Harness: Add --filter, --skip-backend, --skip-godot to run_checkpoint_tests.py
This commit is contained in:
@@ -14,6 +14,9 @@ extends Node3D
|
||||
## └── MeshInstance3D # the object's visual mesh
|
||||
## ```
|
||||
|
||||
const ScriptBehaviorClass := preload("res://scripts/scripting/script_behavior.gd")
|
||||
const ScriptInterpreterNodeClass := preload("res://scripts/scripting/script_interpreter.gd")
|
||||
|
||||
## The world object data this node represents.
|
||||
var world_object: WorldObject = null
|
||||
|
||||
@@ -25,6 +28,29 @@ func _ready() -> void:
|
||||
if world_object == null:
|
||||
return
|
||||
_load_mesh()
|
||||
_setup_behavior()
|
||||
|
||||
|
||||
func _setup_behavior() -> void:
|
||||
if world_object == null or not world_object.properties is Dictionary:
|
||||
return
|
||||
var b_dict = world_object.properties.get("script_behavior", world_object.properties.get("behavior"))
|
||||
if b_dict is Dictionary and not b_dict.is_empty():
|
||||
var behavior := ScriptBehaviorClass.load_from_dict(b_dict)
|
||||
if behavior != null and not behavior.rules.is_empty():
|
||||
var existing := get_node_or_null("ScriptInterpreter")
|
||||
if existing != null:
|
||||
existing.queue_free()
|
||||
var interp := ScriptInterpreterNodeClass.new()
|
||||
interp.name = "ScriptInterpreter"
|
||||
interp.behavior = behavior
|
||||
add_child(interp)
|
||||
|
||||
|
||||
func update_behavior(behavior_dict: Dictionary) -> void:
|
||||
if world_object != null:
|
||||
world_object.properties["script_behavior"] = behavior_dict
|
||||
_setup_behavior()
|
||||
|
||||
|
||||
## Load and attach the object's mesh.
|
||||
@@ -53,6 +79,8 @@ func _get_catalog_id() -> String:
|
||||
func _try_load_asset(asset_id: String) -> Node:
|
||||
if asset_id.is_empty():
|
||||
return null
|
||||
|
||||
# 1. Try standard project asset path (res://assets/...)
|
||||
var path := "res://assets/%s" % asset_id
|
||||
if ResourceLoader.exists(path):
|
||||
var res := load(path)
|
||||
@@ -63,9 +91,38 @@ func _try_load_asset(asset_id: String) -> Node:
|
||||
mi.name = "mesh"
|
||||
mi.mesh = res as Mesh
|
||||
return mi
|
||||
|
||||
# 2. Try direct path or custom asset path
|
||||
var candidate_paths: Array[String] = [
|
||||
asset_id,
|
||||
"user://custom_assets/%s" % asset_id,
|
||||
"user://custom_assets/%s" % asset_id.get_file()
|
||||
]
|
||||
|
||||
for cpath in candidate_paths:
|
||||
if FileAccess.file_exists(cpath):
|
||||
if cpath.ends_with(".glb") or cpath.ends_with(".gltf"):
|
||||
var gltf := GLTFDocument.new()
|
||||
var state := GLTFState.new()
|
||||
var err := gltf.append_from_file(cpath, state)
|
||||
if err == OK:
|
||||
var scene := gltf.generate_scene(state)
|
||||
if scene != null:
|
||||
return scene
|
||||
elif ResourceLoader.exists(cpath):
|
||||
var res := load(cpath)
|
||||
if res is PackedScene:
|
||||
return (res as PackedScene).instantiate()
|
||||
elif res is Mesh:
|
||||
var mi := MeshInstance3D.new()
|
||||
mi.name = "mesh"
|
||||
mi.mesh = res as Mesh
|
||||
return mi
|
||||
|
||||
return null
|
||||
|
||||
|
||||
|
||||
func _build_procedural_object(cat_id: String) -> void:
|
||||
var container := Node3D.new()
|
||||
container.name = "visuals"
|
||||
|
||||
Reference in New Issue
Block a user