diff --git a/assets/common/items/boss_drops/potions.ron b/assets/common/items/boss_drops/potions.ron index 94b1b89c42..50b169ac99 100644 --- a/assets/common/items/boss_drops/potions.ron +++ b/assets/common/items/boss_drops/potions.ron @@ -8,10 +8,7 @@ ItemDef( kind: Potion, data: ( strength: 100.0, - duration: Some(( - secs: 1, - nanos: 0, - )), + duration: Some(1), ), cat_ids: [Natural], )), @@ -19,8 +16,8 @@ ItemDef( kind: PotionSickness, data: ( strength: 0.33, - duration: Some(( secs: 45, nanos: 0, )), - delay: Some(( secs: 1, nanos: 0, )) + duration: Some(45), + delay: Some(1) ), cat_ids: [Natural], )), diff --git a/assets/common/items/consumable/potion_big.ron b/assets/common/items/consumable/potion_big.ron index 904532da5f..26352c6e4b 100644 --- a/assets/common/items/consumable/potion_big.ron +++ b/assets/common/items/consumable/potion_big.ron @@ -8,19 +8,15 @@ ItemDef( kind: Potion, data: ( strength: 100.0, - duration: Some(( - secs: 1, - nanos: 0, - )), - ), + duration: Some(1), + ), cat_ids: [Natural], )), Buff(( kind: PotionSickness, data: ( strength: 0.33, - duration: Some(( secs: 45, nanos: 0, )), - delay: Some(( secs: 1, nanos: 0, )) + duration: Some(45), ), cat_ids: [Natural], )), diff --git a/assets/common/items/consumable/potion_med.ron b/assets/common/items/consumable/potion_med.ron index 905d859fa5..63cf470144 100644 --- a/assets/common/items/consumable/potion_med.ron +++ b/assets/common/items/consumable/potion_med.ron @@ -8,19 +8,15 @@ ItemDef( kind: Potion, data: ( strength: 75.0, - duration: Some(( - secs: 1, - nanos: 0, - )), - ), + duration: Some(1), + ), cat_ids: [Natural], )), Buff(( kind: PotionSickness, data: ( strength: 0.33, - duration: Some(( secs: 45, nanos: 0, )), - delay: Some(( secs: 1, nanos: 0, )) + duration: Some(45), ), cat_ids: [Natural], )), diff --git a/assets/common/items/consumable/potion_minor.ron b/assets/common/items/consumable/potion_minor.ron index a032df7335..23f15272f0 100644 --- a/assets/common/items/consumable/potion_minor.ron +++ b/assets/common/items/consumable/potion_minor.ron @@ -8,19 +8,15 @@ ItemDef( kind: Potion, data: ( strength: 50.0, - duration: Some(( - secs: 1, - nanos: 0, - )), - ), + duration: Some(1), + ), cat_ids: [Natural], )), Buff(( kind: PotionSickness, data: ( strength: 0.33, - duration: Some(( secs: 45, nanos: 0, )), - delay: Some(( secs: 1, nanos: 0, )) + duration: Some(45), ), cat_ids: [Natural], )), diff --git a/assets/common/items/debug/golden_cheese.ron b/assets/common/items/debug/golden_cheese.ron index 37d23c0fa0..4f42797035 100644 --- a/assets/common/items/debug/golden_cheese.ron +++ b/assets/common/items/debug/golden_cheese.ron @@ -8,10 +8,7 @@ ItemDef( kind: Regeneration, data: ( strength: 1000, - duration: Some(( - secs: 999, - nanos: 0, - )), + duration: Some(999), ), cat_ids: [Natural], )), @@ -19,10 +16,7 @@ ItemDef( kind: EnergyRegen, data: ( strength: 1000, - duration: Some(( - secs: 999, - nanos: 0, - )), + duration: Some(999), ), cat_ids: [Natural], )), @@ -30,10 +24,7 @@ ItemDef( kind: IncreaseMaxHealth, data: ( strength: 50000, - duration: Some(( - secs: 999, - nanos: 0, - )), + duration: Some(999), ), cat_ids: [Natural], )), @@ -41,10 +32,7 @@ ItemDef( kind: IncreaseMaxEnergy, data: ( strength: 50000, - duration: Some(( - secs: 999, - nanos: 0, - )), + duration: Some(999), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/apple.ron b/assets/common/items/food/apple.ron index 54f285cdcb..9e8a9f0916 100644 --- a/assets/common/items/food/apple.ron +++ b/assets/common/items/food/apple.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 2.0, - duration: Some(( - secs: 5, - nanos: 0, - )), + duration: Some(5), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/apple_mushroom_curry.ron b/assets/common/items/food/apple_mushroom_curry.ron index 5a4a09d15b..5fc94e0306 100644 --- a/assets/common/items/food/apple_mushroom_curry.ron +++ b/assets/common/items/food/apple_mushroom_curry.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 10.0, - duration: Some(( - secs: 5, - nanos: 0, - )), + duration: Some(5), ), cat_ids: [Natural], )), @@ -19,10 +16,7 @@ ItemDef( kind: Regeneration, data: ( strength: 1.0, - duration: Some(( - secs: 70, - nanos: 0, - )), + duration: Some(70), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/apple_stick.ron b/assets/common/items/food/apple_stick.ron index dfea253a23..cbe5825987 100644 --- a/assets/common/items/food/apple_stick.ron +++ b/assets/common/items/food/apple_stick.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 5.0, - duration: Some(( - secs: 5, - nanos: 0, - )), + duration: Some(5), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/blue_cheese.ron b/assets/common/items/food/blue_cheese.ron index 98e8961909..972e17a484 100644 --- a/assets/common/items/food/blue_cheese.ron +++ b/assets/common/items/food/blue_cheese.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 3.0, - duration: Some(( - secs: 20, - nanos: 0, - )), + duration: Some(20), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/cactus_colada.ron b/assets/common/items/food/cactus_colada.ron index 08ccfa97ac..c0c1008d54 100644 --- a/assets/common/items/food/cactus_colada.ron +++ b/assets/common/items/food/cactus_colada.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 2.0, - duration: Some(( - secs: 5, - nanos: 0, - )), + duration: Some(5), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/carrot.ron b/assets/common/items/food/carrot.ron index 2bd7d19e05..38b34ee525 100644 --- a/assets/common/items/food/carrot.ron +++ b/assets/common/items/food/carrot.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 1.0, - duration: Some(( - secs: 5, - nanos: 0, - )), + duration: Some(5), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/cheese.ron b/assets/common/items/food/cheese.ron index b928aaff28..6ee054574a 100644 --- a/assets/common/items/food/cheese.ron +++ b/assets/common/items/food/cheese.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 1.5, - duration: Some(( - secs: 10, - nanos: 0, - )), + duration: Some(10), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/coconut.ron b/assets/common/items/food/coconut.ron index b955535c94..1284bb2432 100644 --- a/assets/common/items/food/coconut.ron +++ b/assets/common/items/food/coconut.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 4.0, - duration: Some(( - secs: 5, - nanos: 0, - )), + duration: Some(5), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/coltsfoot.ron b/assets/common/items/food/coltsfoot.ron index b5b414fd08..97a6c35f5f 100644 --- a/assets/common/items/food/coltsfoot.ron +++ b/assets/common/items/food/coltsfoot.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 1.0, - duration: Some(( - secs: 5, - nanos: 0, - )), + duration: Some(5), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/dandelion.ron b/assets/common/items/food/dandelion.ron index d613c32be4..bbcf5a0b54 100644 --- a/assets/common/items/food/dandelion.ron +++ b/assets/common/items/food/dandelion.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 1.0, - duration: Some(( - secs: 5, - nanos: 0, - )), + duration: Some(5), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/garlic.ron b/assets/common/items/food/garlic.ron index c21119a0cb..5ed180aeda 100644 --- a/assets/common/items/food/garlic.ron +++ b/assets/common/items/food/garlic.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 1.0, - duration: Some(( - secs: 5, - nanos: 0, - )), + duration: Some(5), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/honeycorn.ron b/assets/common/items/food/honeycorn.ron index 0ce7dd0fb5..bb4016cd13 100644 --- a/assets/common/items/food/honeycorn.ron +++ b/assets/common/items/food/honeycorn.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 4.0, - duration: Some(( - secs: 5, - nanos: 0, - )), + duration: Some(5), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/lettuce.ron b/assets/common/items/food/lettuce.ron index b6d4d32620..900a6c65d8 100644 --- a/assets/common/items/food/lettuce.ron +++ b/assets/common/items/food/lettuce.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 1.0, - duration: Some(( - secs: 5, - nanos: 0, - )), + duration: Some(5), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/meat.ron b/assets/common/items/food/meat.ron index c17296ef09..6cc634f0ec 100644 --- a/assets/common/items/food/meat.ron +++ b/assets/common/items/food/meat.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 1.0, - duration: Some(( - secs: 5, - nanos: 0, - )), + duration: Some(5), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/meat/beast_large_cooked.ron b/assets/common/items/food/meat/beast_large_cooked.ron index 33f70a47a1..f5998c1a2a 100644 --- a/assets/common/items/food/meat/beast_large_cooked.ron +++ b/assets/common/items/food/meat/beast_large_cooked.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 2.5, - duration: Some(( - secs: 10, - nanos: 0, - )), + duration: Some(10), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/meat/beast_large_raw.ron b/assets/common/items/food/meat/beast_large_raw.ron index 147730e61a..ffe1603bd0 100644 --- a/assets/common/items/food/meat/beast_large_raw.ron +++ b/assets/common/items/food/meat/beast_large_raw.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: .45, - duration: Some(( - secs: 10, - nanos: 0, - )), + duration: Some(10), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/meat/beast_small_cooked.ron b/assets/common/items/food/meat/beast_small_cooked.ron index a56471dd16..9f9d8252ee 100644 --- a/assets/common/items/food/meat/beast_small_cooked.ron +++ b/assets/common/items/food/meat/beast_small_cooked.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 1.5, - duration: Some(( - secs: 10, - nanos: 0, - )), + duration: Some(10), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/meat/beast_small_raw.ron b/assets/common/items/food/meat/beast_small_raw.ron index f09abd213e..e31f626410 100644 --- a/assets/common/items/food/meat/beast_small_raw.ron +++ b/assets/common/items/food/meat/beast_small_raw.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: .25, - duration: Some(( - secs: 10, - nanos: 0, - )), + duration: Some(10), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/meat/bird_cooked.ron b/assets/common/items/food/meat/bird_cooked.ron index 8c764a7a7b..636072fa34 100644 --- a/assets/common/items/food/meat/bird_cooked.ron +++ b/assets/common/items/food/meat/bird_cooked.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 2.5, - duration: Some(( - secs: 10, - nanos: 0, - )), + duration: Some(10), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/meat/bird_large_cooked.ron b/assets/common/items/food/meat/bird_large_cooked.ron index f838557284..7d01e98e69 100644 --- a/assets/common/items/food/meat/bird_large_cooked.ron +++ b/assets/common/items/food/meat/bird_large_cooked.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 5.5, - duration: Some(( - secs: 15, - nanos: 0, - )), + duration: Some(15), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/meat/bird_large_raw.ron b/assets/common/items/food/meat/bird_large_raw.ron index 9edbab0b55..d93551c9d9 100644 --- a/assets/common/items/food/meat/bird_large_raw.ron +++ b/assets/common/items/food/meat/bird_large_raw.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: .9, - duration: Some(( - secs: 10, - nanos: 0, - )), + duration: Some(10), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/meat/bird_raw.ron b/assets/common/items/food/meat/bird_raw.ron index bfd2bd963a..4e285af765 100644 --- a/assets/common/items/food/meat/bird_raw.ron +++ b/assets/common/items/food/meat/bird_raw.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: .45, - duration: Some(( - secs: 10, - nanos: 0, - )), + duration: Some(10), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/meat/fish_cooked.ron b/assets/common/items/food/meat/fish_cooked.ron index 4610ccec91..0d86c9acd9 100644 --- a/assets/common/items/food/meat/fish_cooked.ron +++ b/assets/common/items/food/meat/fish_cooked.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 2.5, - duration: Some(( - secs: 10, - nanos: 0, - )), + duration: Some(10), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/meat/fish_raw.ron b/assets/common/items/food/meat/fish_raw.ron index a627dd8ccb..b8d9075459 100644 --- a/assets/common/items/food/meat/fish_raw.ron +++ b/assets/common/items/food/meat/fish_raw.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: .45, - duration: Some(( - secs: 10, - nanos: 0, - )), + duration: Some(10), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/meat/tough_cooked.ron b/assets/common/items/food/meat/tough_cooked.ron index efa4d0f2fe..cf488b3473 100644 --- a/assets/common/items/food/meat/tough_cooked.ron +++ b/assets/common/items/food/meat/tough_cooked.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 2.0, - duration: Some(( - secs: 10, - nanos: 0, - )), + duration: Some(10), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/meat/tough_raw.ron b/assets/common/items/food/meat/tough_raw.ron index 0029bcae39..c4f2e12736 100644 --- a/assets/common/items/food/meat/tough_raw.ron +++ b/assets/common/items/food/meat/tough_raw.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: .36, - duration: Some(( - secs: 10, - nanos: 0, - )), + duration: Some(10), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/mushroom.ron b/assets/common/items/food/mushroom.ron index 8cca72e9ea..326b807249 100644 --- a/assets/common/items/food/mushroom.ron +++ b/assets/common/items/food/mushroom.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 1.0, - duration: Some(( - secs: 5, - nanos: 0, - )), + duration: Some(5), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/mushroom_stick.ron b/assets/common/items/food/mushroom_stick.ron index ec193f762b..e06cb12278 100644 --- a/assets/common/items/food/mushroom_stick.ron +++ b/assets/common/items/food/mushroom_stick.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 4.0, - duration: Some(( - secs: 5, - nanos: 0, - )), + duration: Some(5), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/onion.ron b/assets/common/items/food/onion.ron index 8c34c0c56b..39c20acb90 100644 --- a/assets/common/items/food/onion.ron +++ b/assets/common/items/food/onion.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 1.0, - duration: Some(( - secs: 5, - nanos: 0, - )), + duration: Some(5), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/plainsalad.ron b/assets/common/items/food/plainsalad.ron index dbd7511692..e16eeafc6f 100644 --- a/assets/common/items/food/plainsalad.ron +++ b/assets/common/items/food/plainsalad.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 2.0, - duration: Some(( - secs: 5, - nanos: 0, - )), + duration: Some(5), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/pumpkin_spice_brew.ron b/assets/common/items/food/pumpkin_spice_brew.ron index b06f848634..543a92cd1d 100644 --- a/assets/common/items/food/pumpkin_spice_brew.ron +++ b/assets/common/items/food/pumpkin_spice_brew.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 2.0, - duration: Some(( - secs: 10, - nanos: 0, - )), + duration: Some(10), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/sage.ron b/assets/common/items/food/sage.ron index e4b58f6751..269e172692 100644 --- a/assets/common/items/food/sage.ron +++ b/assets/common/items/food/sage.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 1.0, - duration: Some(( - secs: 5, - nanos: 0, - )), + duration: Some(5), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/spore_corruption.ron b/assets/common/items/food/spore_corruption.ron index f847f81e59..525d8ff927 100644 --- a/assets/common/items/food/spore_corruption.ron +++ b/assets/common/items/food/spore_corruption.ron @@ -8,10 +8,7 @@ ItemDef( kind: Frenzied, data: ( strength: 0.4, - duration: Some(( - secs: 60, - nanos: 0, - )), + duration: Some(60), ), cat_ids: [Natural], )), @@ -19,10 +16,7 @@ ItemDef( kind: Cursed, data: ( strength: 0.35, - duration: Some(( - secs: 60, - nanos: 0, - )), + duration: Some(60), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/sunflower_icetea.ron b/assets/common/items/food/sunflower_icetea.ron index 9be0ec35c3..5629fee79e 100644 --- a/assets/common/items/food/sunflower_icetea.ron +++ b/assets/common/items/food/sunflower_icetea.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 2.0, - duration: Some(( - secs: 10, - nanos: 0, - )), + duration: Some(10), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/tomato.ron b/assets/common/items/food/tomato.ron index 7924699b9f..b694ff6bdb 100644 --- a/assets/common/items/food/tomato.ron +++ b/assets/common/items/food/tomato.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 1.0, - duration: Some(( - secs: 5, - nanos: 0, - )), + duration: Some(5), ), cat_ids: [Natural], )), diff --git a/assets/common/items/food/tomatosalad.ron b/assets/common/items/food/tomatosalad.ron index 577decfba3..1d4075bd37 100644 --- a/assets/common/items/food/tomatosalad.ron +++ b/assets/common/items/food/tomatosalad.ron @@ -8,10 +8,7 @@ ItemDef( kind: Saturation, data: ( strength: 3.0, - duration: Some(( - secs: 5, - nanos: 0, - )), + duration: Some(5), ), cat_ids: [Natural], )), diff --git a/client/src/lib.rs b/client/src/lib.rs index 34812b897b..38b7e442f6 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -2135,9 +2135,10 @@ impl Client { return Err(Error::Other("Failed to find entity from uid.".into())); } }, - ServerGeneral::TimeOfDay(time_of_day, calendar) => { + ServerGeneral::TimeOfDay(time_of_day, calendar, time) => { self.target_time_of_day = Some(time_of_day); *self.state.ecs_mut().write_resource() = calendar; + *self.state.ecs_mut().write_resource() = time; }, ServerGeneral::EntitySync(entity_sync_package) => { self.state diff --git a/common/net/src/msg/server.rs b/common/net/src/msg/server.rs index f226d6d552..f3434e2352 100644 --- a/common/net/src/msg/server.rs +++ b/common/net/src/msg/server.rs @@ -11,7 +11,7 @@ use common::{ lod, outcome::Outcome, recipe::{ComponentRecipeBook, RecipeBook}, - resources::TimeOfDay, + resources::{Time, TimeOfDay}, terrain::{Block, TerrainChunk, TerrainChunkMeta, TerrainChunkSize}, trade::{PendingTrade, SitePrices, TradeId, TradeResult}, uid::Uid, @@ -192,7 +192,7 @@ pub enum ServerGeneral { ChatMsg(comp::ChatMsg), ChatMode(comp::ChatMode), SetPlayerEntity(Uid), - TimeOfDay(TimeOfDay, Calendar), + TimeOfDay(TimeOfDay, Calendar, Time), EntitySync(sync::EntitySyncPackage), CompSync(sync::CompSyncPackage, u64), CreateEntity(sync::EntityPackage), @@ -340,7 +340,7 @@ impl ServerMsg { | ServerGeneral::ChatMsg(_) | ServerGeneral::ChatMode(_) | ServerGeneral::SetPlayerEntity(_) - | ServerGeneral::TimeOfDay(_, _) + | ServerGeneral::TimeOfDay(_, _, _) | ServerGeneral::EntitySync(_) | ServerGeneral::CompSync(_, _) | ServerGeneral::CreateEntity(_) diff --git a/common/src/combat.rs b/common/src/combat.rs index 81f504b4b5..347343f6de 100644 --- a/common/src/combat.rs +++ b/common/src/combat.rs @@ -13,6 +13,7 @@ use crate::{ }, event::ServerEvent, outcome::Outcome, + resources::Secs, states::utils::StageSection, uid::{Uid, UidAllocator}, util::Dir, @@ -27,7 +28,7 @@ use crate::{comp::Group, resources::Time}; #[cfg(not(target_arch = "wasm32"))] use specs::{saveload::MarkerAllocator, Entity as EcsEntity, ReadStorage}; #[cfg(not(target_arch = "wasm32"))] -use std::{ops::MulAssign, time::Duration}; +use std::ops::MulAssign; #[cfg(not(target_arch = "wasm32"))] use vek::*; #[cfg(not(target_arch = "wasm32"))] @@ -363,7 +364,9 @@ impl Attack { emit(ServerEvent::Buff { entity: target.entity, buff_change: BuffChange::Add(b.to_buff( + time, attacker.map(|a| a.uid), + target.stats, applied_damage, strength_modifier, )), @@ -529,7 +532,9 @@ impl Attack { emit(ServerEvent::Buff { entity: target.entity, buff_change: BuffChange::Add(b.to_buff( + time, attacker.map(|a| a.uid), + target.stats, accumulated_damage, strength_modifier, )), @@ -1027,7 +1032,14 @@ impl MulAssign for CombatBuffStrength { #[cfg(not(target_arch = "wasm32"))] impl CombatBuff { - fn to_buff(self, uid: Option, damage: f32, strength_modifier: f32) -> Buff { + fn to_buff( + self, + time: Time, + uid: Option, + stats: Option<&Stats>, + damage: f32, + strength_modifier: f32, + ) -> Buff { // TODO: Generate BufCategoryId vec (probably requires damage overhaul?) let source = if let Some(uid) = uid { BuffSource::Character { by: uid } @@ -1038,11 +1050,13 @@ impl CombatBuff { self.kind, BuffData::new( self.strength.to_strength(damage, strength_modifier), - Some(Duration::from_secs_f32(self.dur_secs)), + Some(Secs(self.dur_secs as f64)), None, ), Vec::new(), source, + time, + stats, ) } } diff --git a/common/src/comp/ability.rs b/common/src/comp/ability.rs index 67479f0a59..de6bbdc6f7 100644 --- a/common/src/comp/ability.rs +++ b/common/src/comp/ability.rs @@ -20,6 +20,7 @@ use crate::{ }, Body, CharacterState, LightEmitter, StateUpdate, }, + resources::Secs, states::{ behavior::JoinData, utils::{AbilityInfo, StageSection}, @@ -696,7 +697,7 @@ pub enum CharacterAbility { recover_duration: f32, targets: combat::GroupTarget, auras: Vec, - aura_duration: f32, + aura_duration: Secs, range: f32, energy_cost: f32, scales_with_combo: bool, @@ -728,7 +729,7 @@ pub enum CharacterAbility { recover_duration: f32, buff_kind: buff::BuffKind, buff_strength: f32, - buff_duration: Option, + buff_duration: Option, energy_cost: f32, #[serde(default)] meta: AbilityMeta, @@ -2051,7 +2052,7 @@ impl CharacterAbility { if let Ok(level) = skillset.skill_level(Sceptre(HDuration)) { auras.iter_mut().for_each(|ref mut aura| { if let Some(ref mut duration) = aura.duration { - *duration *= modifiers.duration.powi(level.into()); + *duration *= modifiers.duration.powi(level.into()) as f64; } }); } @@ -2078,7 +2079,7 @@ impl CharacterAbility { if let Ok(level) = skillset.skill_level(Sceptre(ADuration)) { auras.iter_mut().for_each(|ref mut aura| { if let Some(ref mut duration) = aura.duration { - *duration *= modifiers.duration.powi(level.into()); + *duration *= modifiers.duration.powi(level.into()) as f64; } }); } @@ -2602,7 +2603,7 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState { recover_duration: Duration::from_secs_f32(*recover_duration), targets: *targets, auras: auras.clone(), - aura_duration: Duration::from_secs_f32(*aura_duration), + aura_duration: *aura_duration, range: *range, ability_info, scales_with_combo: *scales_with_combo, @@ -2667,7 +2668,7 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState { recover_duration: Duration::from_secs_f32(*recover_duration), buff_kind: *buff_kind, buff_strength: *buff_strength, - buff_duration: buff_duration.map(Duration::from_secs_f32), + buff_duration: *buff_duration, ability_info, }, timer: Duration::default(), diff --git a/common/src/comp/aura.rs b/common/src/comp/aura.rs index aa627f8ef4..618abddff4 100644 --- a/common/src/comp/aura.rs +++ b/common/src/comp/aura.rs @@ -1,12 +1,12 @@ use crate::{ combat::GroupTarget, comp::buff::{BuffCategory, BuffData, BuffKind, BuffSource}, + resources::{Secs, Time}, uid::Uid, }; use serde::{Deserialize, Serialize}; use slotmap::{new_key_type, SlotMap}; use specs::{Component, DerefFlaggedStorage, VecStorage}; -use std::time::Duration; new_key_type! { pub struct AuraKey; } @@ -36,8 +36,8 @@ pub struct Aura { pub aura_kind: AuraKind, /// The radius of the aura pub radius: f32, - /// How long the aura lasts. None corresponds to an indefinite length - pub duration: Option, + // None corresponds to an indefinite aura + pub end_time: Option