Fix clam spurt origin artifact (#118)
This commit is contained in:
parent
f910e6bdbb
commit
ae802493a0
2 changed files with 42 additions and 4 deletions
|
|
@ -29,12 +29,16 @@ func configure(
|
|||
entity_id = configured_entity_id
|
||||
data = configured_data
|
||||
type_id = data.type_id if data != null else StringName()
|
||||
# Establish the authoritative transform before constructing transient visuals.
|
||||
# Effects emitted before this point would begin at the default world origin.
|
||||
apply_network_state(position, yaw, true)
|
||||
if data != null and data.is_stationary_hotspot():
|
||||
_ensure_water_spurt_visual()
|
||||
_water_spurt_elapsed = (
|
||||
float(abs(hash(entity_id)) % 1000) / 1000.0
|
||||
* WATER_SPURT_INTERVAL_SECONDS
|
||||
)
|
||||
_emit_water_spurt()
|
||||
else:
|
||||
_ensure_visual()
|
||||
if data != null and data.catch_data != null and _sprite != null:
|
||||
|
|
@ -50,7 +54,6 @@ func configure(
|
|||
)
|
||||
)
|
||||
_sprite.rotation_degrees.x = data.sprite_tilt_degrees
|
||||
apply_network_state(position, yaw, true)
|
||||
|
||||
|
||||
func apply_network_state(
|
||||
|
|
@ -147,7 +150,6 @@ func _ensure_water_spurt_visual() -> void:
|
|||
hole.mesh = hole_mesh
|
||||
hole.cast_shadow = GeometryInstance3D.SHADOW_CASTING_SETTING_OFF
|
||||
_water_spurt_root.add_child(hole)
|
||||
_emit_water_spurt()
|
||||
|
||||
|
||||
func _emit_water_spurt() -> void:
|
||||
|
|
@ -159,6 +161,7 @@ func _emit_water_spurt() -> void:
|
|||
particles.amount = 6
|
||||
particles.lifetime = 0.42
|
||||
particles.one_shot = true
|
||||
particles.local_coords = true
|
||||
particles.explosiveness = 1.0
|
||||
particles.direction = Vector3.UP
|
||||
particles.spread = 32.0
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@ const CalendarSeasonType = preload("res://world/calendar_season.gd")
|
|||
|
||||
|
||||
func _initialize() -> void:
|
||||
call_deferred(&"_run")
|
||||
|
||||
|
||||
func _run() -> void:
|
||||
assert(NetworkProtocol.PROTOCOL_VERSION == 11)
|
||||
assert(
|
||||
NetworkWorldSpawnProtocol.CAPABILITY
|
||||
|
|
@ -23,7 +27,7 @@ func _initialize() -> void:
|
|||
)
|
||||
assert(NetworkWorldSpawnProtocol.SNAPSHOT_ENTITIES_PER_ENVELOPE <= 4)
|
||||
_validate_catalog_statuses()
|
||||
_validate_billboard_presentation()
|
||||
await _validate_billboard_presentation()
|
||||
_validate_envelopes()
|
||||
print("World spawn protocol validation: PASS")
|
||||
quit()
|
||||
|
|
@ -148,8 +152,27 @@ func _validate_billboard_presentation() -> void:
|
|||
assert(not sprite.shaded)
|
||||
gatherable.free()
|
||||
|
||||
var unconfigured_hotspot := WorldGatherableType.new()
|
||||
unconfigured_hotspot.call("_ensure_water_spurt_visual")
|
||||
assert(
|
||||
unconfigured_hotspot.get_node_or_null(
|
||||
"WaterSpurt/WaterDroplets"
|
||||
) == null
|
||||
)
|
||||
unconfigured_hotspot.free()
|
||||
|
||||
var clam: GatherableData = Gatherables.get_entry(&"clam_manila")
|
||||
assert(clam != null)
|
||||
var hotspot := WorldGatherableType.new()
|
||||
hotspot.call("_ensure_water_spurt_visual")
|
||||
root.add_child(hotspot)
|
||||
var configured_position := Vector3(24.0, 0.3, -11.0)
|
||||
hotspot.configure(
|
||||
"world:clam-presentation-regression",
|
||||
clam,
|
||||
configured_position,
|
||||
0.0,
|
||||
)
|
||||
assert(hotspot.global_position.is_equal_approx(configured_position))
|
||||
var hole := hotspot.get_node("WaterSpurt/BurrowMark") as MeshInstance3D
|
||||
assert(hole != null)
|
||||
assert(hole.cast_shadow == GeometryInstance3D.SHADOW_CASTING_SETTING_OFF)
|
||||
|
|
@ -158,6 +181,18 @@ func _validate_billboard_presentation() -> void:
|
|||
assert(hole_material.shading_mode == BaseMaterial3D.SHADING_MODE_UNSHADED)
|
||||
assert(hole_material.transparency == BaseMaterial3D.TRANSPARENCY_DISABLED)
|
||||
assert(is_equal_approx(hole_material.albedo_color.a, 1.0))
|
||||
var particles := hotspot.get_node(
|
||||
"WaterSpurt/WaterDroplets"
|
||||
) as CPUParticles3D
|
||||
assert(particles != null and particles.emitting)
|
||||
assert(particles.local_coords)
|
||||
assert(particles.global_position.is_equal_approx(
|
||||
configured_position + Vector3.UP * 0.035
|
||||
))
|
||||
hotspot.set_process(false)
|
||||
await create_timer(0.6).timeout
|
||||
await process_frame
|
||||
assert(hotspot.get_node_or_null("WaterSpurt/WaterDroplets") == null)
|
||||
hotspot.queue_free()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue