Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separates interactable updating from PlayerInteractionComponent to InteractionRayCast #173

Merged
merged 37 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9248f5a
refactor: Simplifies PlayerInteractionComponent
aronand Apr 18, 2024
56c9425
refactor: Simplifies attempt_reload()
aronand Apr 18, 2024
f9fa0a5
feat: Adds InteractionRayCast
aronand Apr 18, 2024
fd60a83
refactor: Remove debug prints from InteractionRayCast
aronand Apr 18, 2024
052591c
feat: Pass interactable from InteractionRayCast to PlayerInteractionC…
aronand Apr 18, 2024
a8362e4
refactor: Removes interactable group checks from PlayerInteractionCom…
aronand Apr 18, 2024
18a6208
refactor: Remove unnecessary variables and methods
aronand Apr 18, 2024
0f474c6
chore: Whitespace cleanup
aronand Apr 18, 2024
6e0771f
chore: Cleaning comments
aronand Apr 18, 2024
6adc37b
chore: Type hint and argument spacing cleanup
aronand Apr 18, 2024
3b579c9
fix: Removes type hints from interactables
aronand Apr 18, 2024
a18b575
fix: Adds missing interaction_raycast.gd to Player
aronand Apr 18, 2024
6e4666d
fix: Fixes UI prompts
aronand Apr 18, 2024
4541081
fix: Update UI each frame
aronand Apr 18, 2024
4124d28
fix: Restores the drop prompt
aronand Apr 18, 2024
3210fdf
chore: Adds comments
aronand Apr 18, 2024
0e8d0aa
fix: Changes reload to account for reload ammount of ammo type
aronand Apr 20, 2024
3ca9a08
refactor: Removes a ceili() that was used for testing
aronand Apr 20, 2024
35fd866
Merge branch 'PlayerInteractionComponentRefactor' into InteractionRay…
aronand Apr 20, 2024
49d52a3
refactor: Turn is_carrying and is_wielding into getters
aronand Apr 20, 2024
cc78afa
fix: Fixes seemingly broke interactable check before attempting reload
aronand Apr 20, 2024
5174103
feat: Adds setter for PlayerInteractionComponent.interactable
aronand Apr 20, 2024
2699b2c
fix: Restores dual interaction functionality
aronand Apr 20, 2024
42b8ffc
refactor: Moves weapon UI updating to _process()
aronand Apr 20, 2024
2f9f46d
refactor: Moves all is_wielding checks to a single location in _input()
aronand Apr 20, 2024
db0df70
feat: Adds wieldables UI update to PickupComponent
aronand Apr 20, 2024
ac9e1bb
feat: Adds carried_object setter
aronand Apr 20, 2024
4b27a8e
chore: Removes commented out code from _ready
aronand Apr 20, 2024
e3c2baf
refactor: Moves prompt rebuilding back to after interaction
aronand Apr 20, 2024
1c9caff
refactor: Simplifies parts of Player_Hud_Manager
aronand Apr 20, 2024
703cfbf
refactor: Adds descriptive booleans to a long if statement
aronand Apr 20, 2024
2c7050a
fix: Adds prompt cleanup after stopping carrying
aronand Apr 20, 2024
2481309
feat: Adds helper function to rebuild interaction prompts
aronand Apr 20, 2024
a695116
refactor: simplifies single line getters
aronand Apr 23, 2024
884927e
fix: stops InteractionRayCast from spamming the unseen signal
aronand Apr 24, 2024
fc3851e
fix: removes the drop prompt hack
aronand Apr 26, 2024
f80d5ac
fix: changes null colliders into real nulls
aronand Apr 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions COGITO/CogitoObjects/Cogito_Door.gd
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,6 @@ func close_door(_interactor: Node3D):
tween_door.tween_property(self,"position", closed_position, door_speed)
is_open = false
interaction_text = interaction_text_when_closed
if player_interaction_component:
player_interaction_component.interactive_object_exit() #Froces a re-detection of the interaction prompt.
object_state_updated.emit(interaction_text)
door_state_changed.emit(false)

Expand Down
22 changes: 17 additions & 5 deletions COGITO/Components/Interactions/PickupComponent.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,23 @@ func interact(_player_interaction_component: PlayerInteractionComponent):


func pick_up(_player_interaction_component: PlayerInteractionComponent):
if _player_interaction_component.get_parent().inventory_data.pick_up_slot_data(slot_data):
_player_interaction_component.send_hint(slot_data.inventory_item.icon, slot_data.inventory_item.name + " added to inventory.")
was_interacted_with.emit(interaction_text,input_map_action)
Audio.play_sound(slot_data.inventory_item.sound_pickup)
self.get_parent().queue_free()
if not _player_interaction_component.get_parent().inventory_data.pick_up_slot_data(slot_data):
return

# Update wieldable UI if we have picked up ammo for current wieldable
# TODO: Possibly replace with a better solution, maybe by signaling the change
# to the UI instead of having the PlayerInteractionComponent doing it.
if _player_interaction_component.is_wielding:
var is_ammo: bool = "reload_amount" in slot_data.inventory_item
var is_current_ammo: bool = _player_interaction_component.equipped_wieldable_item.ammo_item_name == slot_data.inventory_item.name
if is_ammo and is_current_ammo:
_player_interaction_component.equipped_wieldable_item.update_wieldable_data(_player_interaction_component)

_player_interaction_component.send_hint(slot_data.inventory_item.icon, slot_data.inventory_item.name + " added to inventory.")
was_interacted_with.emit(interaction_text, input_map_action)
Audio.play_sound(slot_data.inventory_item.sound_pickup)
self.get_parent().queue_free()


func get_item_type() -> int:
if slot_data and slot_data.inventory_item:
Expand Down
Loading