continuously set/update chat variable $$player_oxygen_seconds
This commit is contained in:
parent
3b540b290d
commit
625bf21c84
10
src/chat.rs
10
src/chat.rs
|
@ -79,6 +79,7 @@ impl Plugin for ChatPlugin {
|
|||
handle_new_conversations.before(handle_chat_events),
|
||||
handle_chat_events.before(handle_chat_scripts),
|
||||
handle_chat_scripts,
|
||||
update_chat_variables,
|
||||
),
|
||||
);
|
||||
app.add_event::<StartConversationEvent>();
|
||||
|
@ -939,3 +940,12 @@ pub fn handle_chat_scripts(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update_chat_variables(
|
||||
mut vars: ResMut<var::GameVars>,
|
||||
q_player: Query<&actor::Suit, With<actor::Player>>,
|
||||
) {
|
||||
if let Ok(suit) = q_player.get_single() {
|
||||
vars.set_in_scope("$", "player_oxygen_seconds", (suit.oxygen / nature::OXY_S).to_string());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue