mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Interactable campfires
This commit is contained in:
parent
38ecfe7c8b
commit
0e2808a8fd
@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Put date at the begining of the log file instead of the end to allow MIME type recognition
|
- Put date at the begining of the log file instead of the end to allow MIME type recognition
|
||||||
- Tweaked CR and exp calculation formula
|
- Tweaked CR and exp calculation formula
|
||||||
- Sprite spawn rates
|
- Sprite spawn rates
|
||||||
|
- The Interact button can be used on campfires to sit
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
@ -150,6 +150,8 @@ impl<
|
|||||||
impl Body {
|
impl Body {
|
||||||
pub fn is_humanoid(&self) -> bool { matches!(self, Body::Humanoid(_)) }
|
pub fn is_humanoid(&self) -> bool { matches!(self, Body::Humanoid(_)) }
|
||||||
|
|
||||||
|
pub fn is_campfire(&self) -> bool { matches!(self, Body::Object(object::Body::CampfireLit)) }
|
||||||
|
|
||||||
/// Average density of the body
|
/// Average density of the body
|
||||||
// Units are based on kg/m³
|
// Units are based on kg/m³
|
||||||
pub fn density(&self) -> Density {
|
pub fn density(&self) -> Density {
|
||||||
|
@ -27,7 +27,7 @@ pub enum BuffKind {
|
|||||||
/// Strength should be the healing per second
|
/// Strength should be the healing per second
|
||||||
Potion,
|
Potion,
|
||||||
/// Applied when sitting at a campfire
|
/// Applied when sitting at a campfire
|
||||||
/// Strength is fraction of health resotred per second
|
/// Strength is fraction of health restored per second
|
||||||
CampfireHeal,
|
CampfireHeal,
|
||||||
/// Raises maximum energy
|
/// Raises maximum energy
|
||||||
/// Strength should be 10x the effect to max energy
|
/// Strength should be 10x the effect to max energy
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
combat::Attack,
|
combat::Attack,
|
||||||
comp::{tool::ToolKind, ControlAction, Density, Energy, InputAttr, InputKind, Ori, Pos, Vel},
|
comp::{
|
||||||
|
item::ConsumableKind, tool::ToolKind, ControlAction, Density, Energy, InputAttr, InputKind,
|
||||||
|
Ori, Pos, Vel,
|
||||||
|
},
|
||||||
event::{LocalEvent, ServerEvent},
|
event::{LocalEvent, ServerEvent},
|
||||||
states::{
|
states::{
|
||||||
self,
|
self,
|
||||||
@ -219,6 +222,23 @@ impl CharacterState {
|
|||||||
|| matches!(self, CharacterState::Roll(s) if s.stage_section == StageSection::Movement)
|
|| matches!(self, CharacterState::Roll(s) if s.stage_section == StageSection::Movement)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_sitting(&self) -> bool {
|
||||||
|
use use_item::{Data, ItemUseKind, StaticData};
|
||||||
|
matches!(
|
||||||
|
self,
|
||||||
|
CharacterState::Sit
|
||||||
|
| CharacterState::UseItem(Data {
|
||||||
|
static_data: StaticData {
|
||||||
|
item_kind: ItemUseKind::Consumable(
|
||||||
|
ConsumableKind::ComplexFood | ConsumableKind::Food
|
||||||
|
),
|
||||||
|
..
|
||||||
|
},
|
||||||
|
..
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/// Compares for shallow equality (does not check internal struct equality)
|
/// Compares for shallow equality (does not check internal struct equality)
|
||||||
pub fn same_variant(&self, other: &Self) -> bool {
|
pub fn same_variant(&self, other: &Self) -> bool {
|
||||||
// Check if state is the same without looking at the inner data
|
// Check if state is the same without looking at the inner data
|
||||||
|
@ -163,11 +163,12 @@ fn activate_aura(
|
|||||||
let should_activate = match aura.aura_kind {
|
let should_activate = match aura.aura_kind {
|
||||||
AuraKind::Buff { kind, source, .. } => {
|
AuraKind::Buff { kind, source, .. } => {
|
||||||
let conditions_held = match kind {
|
let conditions_held = match kind {
|
||||||
BuffKind::CampfireHeal => {
|
BuffKind::CampfireHeal => read_data
|
||||||
let target_state = read_data.char_states.get(target);
|
.char_states
|
||||||
matches!(target_state, Some(CharacterState::Sit))
|
.get(target)
|
||||||
&& health.current() < health.maximum()
|
.map_or(false, |target_state| {
|
||||||
},
|
target_state.is_sitting() && health.current() < health.maximum()
|
||||||
|
}),
|
||||||
// Add other specific buff conditions here
|
// Add other specific buff conditions here
|
||||||
_ => true,
|
_ => true,
|
||||||
};
|
};
|
||||||
@ -175,7 +176,7 @@ fn activate_aura(
|
|||||||
// TODO: this check will disable friendly fire with PvE switch.
|
// TODO: this check will disable friendly fire with PvE switch.
|
||||||
//
|
//
|
||||||
// Which means that you can't apply debuffs on you and your group
|
// Which means that you can't apply debuffs on you and your group
|
||||||
// even if it's intented mechanic.
|
// even if it's intended mechanic.
|
||||||
//
|
//
|
||||||
// We don't have this for now, but think about this
|
// We don't have this for now, but think about this
|
||||||
// when we will add this.
|
// when we will add this.
|
||||||
|
@ -35,7 +35,7 @@ impl Interactable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Select interactable to hightlight, display interaction text for, and to
|
/// Select interactable to highlight, display interaction text for, and to
|
||||||
/// interact with if the interact key is pressed
|
/// interact with if the interact key is pressed
|
||||||
/// Selected in the following order:
|
/// Selected in the following order:
|
||||||
/// 1) Targeted items, in order of nearest under cursor:
|
/// 1) Targeted items, in order of nearest under cursor:
|
||||||
|
@ -732,6 +732,15 @@ impl PlayState for SessionState {
|
|||||||
.is_some()
|
.is_some()
|
||||||
{
|
{
|
||||||
client.pick_up(entity);
|
client.pick_up(entity);
|
||||||
|
} else if client
|
||||||
|
.state()
|
||||||
|
.ecs()
|
||||||
|
.read_storage::<comp::Body>()
|
||||||
|
.get(entity)
|
||||||
|
.map_or(false, |b| b.is_campfire())
|
||||||
|
{
|
||||||
|
// TODO: maybe start crafting instead?
|
||||||
|
client.toggle_sit();
|
||||||
} else {
|
} else {
|
||||||
client.npc_interact(entity);
|
client.npc_interact(entity);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user