Compare commits
5 Commits
7a18765ebd
...
3b4d8a4d8e
Author | SHA1 | Date |
---|---|---|
|
3b4d8a4d8e | |
|
3d716ed06d | |
|
f3f4cef1bf | |
|
263816fa53 | |
|
08647a4188 |
File diff suppressed because one or more lines are too long
|
@ -45,8 +45,6 @@ func defer_ready() -> void:
|
||||||
get_tree().create_tween().tween_method(set_instructions_opacity, 0.0, 1.0, 1.0)
|
get_tree().create_tween().tween_method(set_instructions_opacity, 0.0, 1.0, 1.0)
|
||||||
|
|
||||||
|
|
||||||
# game_ticker.start()
|
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
if Input.is_action_just_pressed("force_game_tick"):
|
if Input.is_action_just_pressed("force_game_tick"):
|
||||||
Task.print_behavior_tree_evaluation = true
|
Task.print_behavior_tree_evaluation = true
|
||||||
|
@ -123,6 +121,7 @@ func _on_game_tick_timeout() -> void:
|
||||||
EventsTracker.populate_visual_log(%RecentEventsLog, self)
|
EventsTracker.populate_visual_log(%RecentEventsLog, self)
|
||||||
|
|
||||||
update_bars()
|
update_bars()
|
||||||
|
world.camp_manager.populate_camp_visualization(%BoatProcessUI, %CampItemUI)
|
||||||
handle_result_game_state(player.behavior_tree.blackboard)
|
handle_result_game_state(player.behavior_tree.blackboard)
|
||||||
|
|
||||||
if not game_ticker.is_stopped():
|
if not game_ticker.is_stopped():
|
||||||
|
@ -174,6 +173,61 @@ func handle_result_game_state(blackboard: Dictionary) -> void:
|
||||||
get_tree().create_tween().tween_method(set_outro_opacity, 0.0, 1.0, 1.0)
|
get_tree().create_tween().tween_method(set_outro_opacity, 0.0, 1.0, 1.0)
|
||||||
|
|
||||||
|
|
||||||
|
func update_boat_progress_old() -> void:
|
||||||
|
var part_counts: Dictionary = { # @formatter:off
|
||||||
|
tilemap_types.OBJECT_I_BOAT_PART_ENGINE: 0,
|
||||||
|
tilemap_types.OBJECT_I_BOAT_PART_FUEL: 0,
|
||||||
|
tilemap_types.OBJECT_I_BOAT_PART_ANCHOR: 0,
|
||||||
|
tilemap_types.OBJECT_I_BOAT_PART_CHEST: 0,
|
||||||
|
tilemap_types.OBJECT_I_BOAT_PART_GEARS: 0,
|
||||||
|
tilemap_types.OBJECT_I_BOAT_PART_MEDIKIT: 0,
|
||||||
|
tilemap_types.OBJECT_I_BOAT_PART_PADDLE: 0,
|
||||||
|
tilemap_types.OBJECT_I_BOAT_PART_GAS_STOVE: 0
|
||||||
|
} # @formatter:on
|
||||||
|
|
||||||
|
for boat_part in world.camp_manager.boat_items:
|
||||||
|
if part_counts.has(boat_part):
|
||||||
|
part_counts[boat_part] += 1
|
||||||
|
|
||||||
|
for part in part_counts.keys():
|
||||||
|
var count = part_counts[part]
|
||||||
|
if count > 0:
|
||||||
|
if part == tilemap_types.OBJECT_I_BOAT_PART_ENGINE:
|
||||||
|
%BoatPartEngine.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_BOAT_PART_ENGINE)
|
||||||
|
%BoatPartEngine.visible = true
|
||||||
|
%EngineCount.text = str(count)
|
||||||
|
elif part == tilemap_types.OBJECT_I_BOAT_PART_FUEL:
|
||||||
|
%BoatPartFuel.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_BOAT_PART_FUEL)
|
||||||
|
%BoatPartFuel.visible = true
|
||||||
|
%FuelCount.text = str(count)
|
||||||
|
elif part == tilemap_types.OBJECT_I_BOAT_PART_ANCHOR:
|
||||||
|
%BoatPartAnchor.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_BOAT_PART_ANCHOR)
|
||||||
|
%BoatPartAnchor.visible = true
|
||||||
|
%AnchorCount.text = str(count)
|
||||||
|
elif part == tilemap_types.OBJECT_I_BOAT_PART_CHEST:
|
||||||
|
%BoatPartChest.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_BOAT_PART_CHEST)
|
||||||
|
%BoatPartChest.visible = true
|
||||||
|
%ChestCount.text = str(count)
|
||||||
|
elif part == tilemap_types.OBJECT_I_BOAT_PART_GEARS:
|
||||||
|
%BoatPartGears.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_BOAT_PART_GEARS)
|
||||||
|
%BoatPartGears.visible = true
|
||||||
|
%GearsCount.text = str(count)
|
||||||
|
elif part == tilemap_types.OBJECT_I_BOAT_PART_MEDIKIT:
|
||||||
|
%BoatPartMedikit.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_BOAT_PART_MEDIKIT)
|
||||||
|
%BoatPartMedikit.visible = true
|
||||||
|
%MedikitCount.text = str(count)
|
||||||
|
elif part == tilemap_types.OBJECT_I_BOAT_PART_PADDLE:
|
||||||
|
%BoatPartPaddle.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_BOAT_PART_PADDLE)
|
||||||
|
%BoatPartPaddle.visible = true
|
||||||
|
%PaddleCount.text = str(count)
|
||||||
|
elif part == tilemap_types.OBJECT_I_BOAT_PART_GAS_STOVE:
|
||||||
|
%BoatPartGasStove.texture = world.tilemap_interactive.get_cell_texture(tilemap_types.OBJECT_I_BOAT_PART_GAS_STOVE)
|
||||||
|
%BoatPartGasStove.visible = true
|
||||||
|
%StoveCount.text = str(count)
|
||||||
|
else:
|
||||||
|
push_error("Unknown boat part: " + str(part))
|
||||||
|
|
||||||
|
|
||||||
func update_bars() -> void:
|
func update_bars() -> void:
|
||||||
if health_bar != null:
|
if health_bar != null:
|
||||||
health_bar.max_value = player.max_health
|
health_bar.max_value = player.max_health
|
||||||
|
|
|
@ -2,19 +2,19 @@ class_name TaskDeliverBoatPart
|
||||||
extends Task
|
extends Task
|
||||||
|
|
||||||
func run(blackboard: Dictionary) -> void:
|
func run(blackboard: Dictionary) -> void:
|
||||||
var world: World = blackboard["world"]
|
var world: World = blackboard["world"]
|
||||||
var player: PlayerManager = blackboard["player"]
|
var player: PlayerManager = blackboard["player"]
|
||||||
|
|
||||||
if tilemap_types.is_part_of_collection(tilemap_types.OBJECT_COLLECTION_BOAT_PARTS, player.inventory_slot):
|
if tilemap_types.is_part_of_collection(tilemap_types.OBJECT_COLLECTION_BOAT_PARTS, player.inventory_slot):
|
||||||
EventsTracker.track(EventsTracker.Event.CAMP_BOAT_PART_DELIVERED, {"item": player.inventory_slot})
|
EventsTracker.track(EventsTracker.Event.CAMP_BOAT_PART_DELIVERED, {"item": player.inventory_slot})
|
||||||
world.camp_manager.boat_items.append(player.inventory_slot)
|
world.camp_manager.boat_items.append(player.inventory_slot)
|
||||||
player.inventory_slot = tilemap_types.EMPTY
|
player.inventory_slot = tilemap_types.EMPTY
|
||||||
if world.camp_manager.boat_items.size() >= world.camp_manager.required_boat_parts:
|
if world.camp_manager.boat_items.size() >= world.camp_manager.required_boat_parts:
|
||||||
EventsTracker.track(EventsTracker.Event.CAMP_BOAT_COMPLETE, {"item": tilemap_types.OBJECT_I_BOAT_WITH_ENGINE})
|
EventsTracker.track(EventsTracker.Event.CAMP_BOAT_COMPLETE, {"item": tilemap_types.OBJECT_I_BOAT_WITH_ENGINE})
|
||||||
world.tilemap_interactive.set_cell(world.camp_manager.boat_build_location, tilemap_types.OBJECT_I_BOAT_WITH_ENGINE)
|
world.tilemap_interactive.set_cell(world.camp_manager.boat_build_location, tilemap_types.OBJECT_I_BOAT_WITH_ENGINE)
|
||||||
status = SUCCESS
|
status = SUCCESS
|
||||||
status_reason = "Player delivered boat part"
|
status_reason = "Player delivered boat part"
|
||||||
return
|
return
|
||||||
|
|
||||||
status = FAILURE
|
status = FAILURE
|
||||||
status_reason = "Player does not have boat part to deliver"
|
status_reason = "Player does not have boat part to deliver"
|
||||||
|
|
|
@ -16,7 +16,7 @@ var boat_leave_location: Vector2i = tilemap_types.EMPTY
|
||||||
var time_of_day: int = 0
|
var time_of_day: int = 0
|
||||||
var day_length: int = 1000
|
var day_length: int = 1000
|
||||||
|
|
||||||
@export var required_boat_parts: int = 6
|
@export var required_boat_parts: int = 8
|
||||||
|
|
||||||
|
|
||||||
func setup() -> void:
|
func setup() -> void:
|
||||||
|
@ -153,3 +153,32 @@ func sleep_effect() -> void:
|
||||||
print("Sleep effect done")
|
print("Sleep effect done")
|
||||||
is_sleep_active = false
|
is_sleep_active = false
|
||||||
time_of_day = 0
|
time_of_day = 0
|
||||||
|
|
||||||
|
|
||||||
|
func populate_camp_visualization(boat_ui: HBoxContainer, camp_ui: HBoxContainer) -> void:
|
||||||
|
for child in boat_ui.get_children():
|
||||||
|
if child.name != "HeightLabel":
|
||||||
|
boat_ui.remove_child(child)
|
||||||
|
|
||||||
|
for boat_part in boat_items:
|
||||||
|
var texture: TextureRect = create_item_texture(boat_part)
|
||||||
|
boat_ui.add_child(texture)
|
||||||
|
|
||||||
|
for child in camp_ui.get_children():
|
||||||
|
if child.name != "HeightLabel":
|
||||||
|
camp_ui.remove_child(child)
|
||||||
|
|
||||||
|
for boat_part in camp_items:
|
||||||
|
var texture: TextureRect = create_item_texture(boat_part)
|
||||||
|
camp_ui.add_child(texture)
|
||||||
|
|
||||||
|
|
||||||
|
func create_item_texture(item: Vector2i) -> TextureRect:
|
||||||
|
var item_texture: Texture = game_manager.world.tilemap_interactive.get_cell_texture(item)
|
||||||
|
if item_texture:
|
||||||
|
var item_texture_rect: TextureRect = TextureRect.new()
|
||||||
|
item_texture_rect.texture = item_texture
|
||||||
|
item_texture_rect.set_expand_mode(TextureRect.EXPAND_FIT_WIDTH)
|
||||||
|
item_texture_rect.set_stretch_mode(TextureRect.STRETCH_KEEP_ASPECT_CENTERED)
|
||||||
|
return item_texture_rect
|
||||||
|
return null
|
||||||
|
|
Loading…
Reference in New Issue