[Merged by Bors] - feat: add slippery seaweed#641
[Merged by Bors] - feat: add slippery seaweed#641Zac8668 wants to merge 4 commits intofishfolk:mainfrom
Conversation
| collision_world: CollisionWorld, | ||
| mut player_states: CompMut<PlayerState>, | ||
| ) { | ||
| for (seaweed_ent, _) in entities.iter_with(&slippery_seaweeds) { |
There was a problem hiding this comment.
Could you move this code to the slippery_seaweed.rs module?
That way if we add new items or things that can send the player into the incapacitated state, they can each be in their own module, and we don't have to keep making this system bigger to account for each new item.
core/src/player/state.rs
Outdated
| add_state_module!(session, midair); | ||
| add_state_module!(session, walk); | ||
| add_state_module!(session, dead); | ||
| add_state_module!(session, incapacitaded); |
There was a problem hiding this comment.
Since we don't need a player_state_transition system in the incapacitated state, don't use the module here and just register the state handler system:
| add_state_module!(session, incapacitaded); | |
| session | |
| .stages | |
| .add_system_to_stage(CoreStage::PreUpdate, incapacitated::handle_player_state); |
core/src/player/state.rs
Outdated
| .add_system_to_stage(CoreStage::PreUpdate, incapacitated::handle_player_state) | ||
| .add_system_to_stage(PlayerStateStage, slippery_seaweed::update); |
There was a problem hiding this comment.
Tiniest little change: it'd be good to move the registration of the slippery seaweed system to it's own install function.
That should be the last thing!
| .add_system_to_stage(CoreStage::PreUpdate, incapacitated::handle_player_state) | |
| .add_system_to_stage(PlayerStateStage, slippery_seaweed::update); | |
| .add_system_to_stage(CoreStage::PreUpdate, incapacitated::handle_player_state); |
There was a problem hiding this comment.
I tried to do this first actually, as it makes more sense, but I get this error:
thread 'main' panicked at 'Stage with label 'PlayerStateStage' ( 01GP72HD5B1S7VDNE9B2SAGWVX ) doesn't exist.'
Looks like this install function runs before the PlayerStateStage is created, not sure how to get around this.
There was a problem hiding this comment.
Ah, I see. It must be because we haven't installed the player stage yet, when we install the elements.
You should be able to fix it by re-ordering these two lines here, so that the player systems are installed first:
Lines 53 to 54 in dfba51a
There was a problem hiding this comment.
It worked now :)
(not sure how often you check discord, but I've asked you something on the jumpy channel, as you're awnsering fast here, just letting you know)
| pub fn install(session: &mut GameSession) { | ||
| session | ||
| .stages | ||
| .add_system_to_stage(CoreStage::PreUpdate, hydrate); |
There was a problem hiding this comment.
| .add_system_to_stage(CoreStage::PreUpdate, hydrate); | |
| .add_system_to_stage(CoreStage::PreUpdate, hydrate) | |
| .add_system_to_stage(PlayerStateStage, update); |
|
Pull request successfully merged into main. Build succeeded: |
No description provided.