feat: make pantry crises visible in the world
This commit is contained in:
@@ -6,6 +6,7 @@ signal position_changed(sim_id: int, active_position: Vector3)
|
||||
|
||||
const TRUST_REACTION_BASE_POSITION := Vector3(0.0, 2.72, 0.0)
|
||||
const TRUST_REACTION_START_SCALE := Vector3(0.24, 0.24, 0.24)
|
||||
const CONCERN_BASE_POSITION := Vector3(-0.4, 2.72, 0.0)
|
||||
|
||||
@export var debug_logs := false
|
||||
|
||||
@@ -28,6 +29,7 @@ const TRUST_REACTION_START_SCALE := Vector3(0.24, 0.24, 0.24)
|
||||
@onready var carried_wood_visual: Node3D = $CarriedWood
|
||||
@onready var task_glyph_root: Node3D = $TaskGlyphRoot
|
||||
@onready var task_glyph: MeshInstance3D = $TaskGlyphRoot/TaskGlyph
|
||||
@onready var opportunity_concern_root: Node3D = $OpportunityConcernRoot
|
||||
@onready var trust_reaction_root: Node3D = $TrustReactionRoot
|
||||
@onready var trust_reaction_visuals: Array[MeshInstance3D] = [
|
||||
$TrustReactionRoot/Halo,
|
||||
@@ -54,6 +56,7 @@ var dead_material := StandardMaterial3D.new()
|
||||
var debug_overlay_visible := true
|
||||
var walk_phase := 0.0
|
||||
var glyph_phase := 0.0
|
||||
var concern_phase := 0.0
|
||||
var trust_reaction_tween: Tween
|
||||
|
||||
|
||||
@@ -74,6 +77,12 @@ func _process(delta: float) -> void:
|
||||
if task_glyph_root.visible:
|
||||
task_glyph_root.position.y = 2.35 + sin(glyph_phase) * 0.045
|
||||
task_glyph_root.rotation.y = glyph_phase * 0.35
|
||||
if opportunity_concern_root.visible:
|
||||
concern_phase = fmod(concern_phase + delta * 1.65, TAU)
|
||||
opportunity_concern_root.position.y = (CONCERN_BASE_POSITION.y + sin(concern_phase) * 0.045)
|
||||
opportunity_concern_root.rotation.y = sin(concern_phase * 0.7) * 0.16
|
||||
var concern_scale := 0.96 + sin(concern_phase) * 0.04
|
||||
opportunity_concern_root.scale = Vector3.ONE * concern_scale
|
||||
|
||||
var horizontal_speed := Vector2(velocity.x, velocity.z).length()
|
||||
var blend := minf(delta * 9.0, 1.0)
|
||||
@@ -104,6 +113,7 @@ func setup_from_sim(npc: SimNPC) -> void:
|
||||
profession = npc.profession
|
||||
name = "NPC_%s_%s" % [sim_id, npc_name]
|
||||
_stop_trust_gain_reaction()
|
||||
set_opportunity_concern_visible(false)
|
||||
_apply_personal_details()
|
||||
_apply_profession_presentation()
|
||||
set_carried_food_visible(npc.get_inventory_amount(SimulationIds.RESOURCE_FOOD) > 0.0)
|
||||
@@ -203,6 +213,17 @@ func set_task_presentation(action_id: StringName, task_state: StringName) -> voi
|
||||
task_glyph_root.visible = task_glyph.mesh != null
|
||||
|
||||
|
||||
func set_opportunity_concern_visible(is_visible: bool) -> void:
|
||||
if opportunity_concern_root == null:
|
||||
return
|
||||
opportunity_concern_root.visible = is_visible and not is_dead_visual
|
||||
opportunity_concern_root.position = CONCERN_BASE_POSITION
|
||||
opportunity_concern_root.rotation = Vector3.ZERO
|
||||
opportunity_concern_root.scale = Vector3.ONE
|
||||
if is_visible:
|
||||
concern_phase = 0.0
|
||||
|
||||
|
||||
func set_debug_overlay_visible(is_visible: bool) -> void:
|
||||
debug_overlay_visible = is_visible
|
||||
if profession_label != null:
|
||||
@@ -399,6 +420,7 @@ func _report_navigation_failure_once() -> void:
|
||||
func apply_dead_visual_state() -> void:
|
||||
is_dead_visual = true
|
||||
_stop_trust_gain_reaction()
|
||||
set_opportunity_concern_visible(false)
|
||||
carried_food_visual.visible = false
|
||||
carried_wood_visual.visible = false
|
||||
profession_prop.visible = false
|
||||
|
||||
Reference in New Issue
Block a user