feat(studio,stacking,animations,collections): M16 ModBison Studio, object stacking, model animations, and poly collections for MVP 2
checkpoint / checkpoint (push) Successful in 6m32s
checkpoint / checkpoint (push) Successful in 6m32s
This commit is contained in:
+12
-2
@@ -27,6 +27,9 @@ var scale: Vector3 = Vector3.ONE
|
||||
## Type-specific key/value properties.
|
||||
var properties: Dictionary = {}
|
||||
|
||||
## Parent object ID when stacked on top of or attached to another object.
|
||||
var parent_id: String = ""
|
||||
|
||||
## Whether this is a spawnable dynamic entity (true) or static (false).
|
||||
var is_dynamic: bool = false
|
||||
|
||||
@@ -55,6 +58,7 @@ func _init(
|
||||
rotation = p_rotation
|
||||
scale = p_scale
|
||||
properties = p_properties
|
||||
parent_id = str(properties.get("parent_id", ""))
|
||||
is_dynamic = p_dynamic
|
||||
if p_flags != null:
|
||||
flags = p_flags
|
||||
@@ -93,7 +97,7 @@ func get_display_name() -> String:
|
||||
|
||||
## Serialize this object to a dictionary (for networking).
|
||||
func to_dict() -> Dictionary:
|
||||
return {
|
||||
var d := {
|
||||
"id": id,
|
||||
"type": type,
|
||||
"asset_id": asset_id,
|
||||
@@ -103,6 +107,9 @@ func to_dict() -> Dictionary:
|
||||
"properties": properties,
|
||||
"dynamic": is_dynamic,
|
||||
}
|
||||
if parent_id != "":
|
||||
d["parent_id"] = parent_id
|
||||
return d
|
||||
|
||||
|
||||
## Create a WorldObject from a dictionary (for networking).
|
||||
@@ -123,6 +130,9 @@ static func from_dict(d: Dictionary) -> WorldObject:
|
||||
d.get("scale", [1, 1, 1])[1],
|
||||
d.get("scale", [1, 1, 1])[2]
|
||||
)
|
||||
var props: Dictionary = d.get("properties", {}).duplicate()
|
||||
if d.has("parent_id") and not props.has("parent_id"):
|
||||
props["parent_id"] = d["parent_id"]
|
||||
return WorldObject.new(
|
||||
d.get("id", ""),
|
||||
d.get("type", ""),
|
||||
@@ -130,6 +140,6 @@ static func from_dict(d: Dictionary) -> WorldObject:
|
||||
pos,
|
||||
rot,
|
||||
scl,
|
||||
d.get("properties", {}),
|
||||
props,
|
||||
d.get("dynamic", false),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user