From 89aa934c3c863ba35aa9b5b092080f0334b8e03c Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 7 Mar 2023 22:22:54 -0500 Subject: [PATCH] Initial work --- assets/common/items/boss_drops/potions.ron | 9 +- assets/common/items/consumable/potion_big.ron | 9 +- assets/common/items/consumable/potion_med.ron | 9 +- .../common/items/consumable/potion_minor.ron | 9 +- assets/common/items/debug/golden_cheese.ron | 20 +- assets/common/items/food/apple.ron | 5 +- .../items/food/apple_mushroom_curry.ron | 10 +- assets/common/items/food/apple_stick.ron | 5 +- assets/common/items/food/blue_cheese.ron | 5 +- assets/common/items/food/cactus_colada.ron | 5 +- assets/common/items/food/carrot.ron | 5 +- assets/common/items/food/cheese.ron | 5 +- assets/common/items/food/coconut.ron | 5 +- assets/common/items/food/coltsfoot.ron | 5 +- assets/common/items/food/dandelion.ron | 5 +- assets/common/items/food/garlic.ron | 5 +- assets/common/items/food/honeycorn.ron | 5 +- assets/common/items/food/lettuce.ron | 5 +- assets/common/items/food/meat.ron | 5 +- .../items/food/meat/beast_large_cooked.ron | 5 +- .../items/food/meat/beast_large_raw.ron | 5 +- .../items/food/meat/beast_small_cooked.ron | 5 +- .../items/food/meat/beast_small_raw.ron | 5 +- assets/common/items/food/meat/bird_cooked.ron | 5 +- .../items/food/meat/bird_large_cooked.ron | 5 +- .../common/items/food/meat/bird_large_raw.ron | 5 +- assets/common/items/food/meat/bird_raw.ron | 5 +- assets/common/items/food/meat/fish_cooked.ron | 5 +- assets/common/items/food/meat/fish_raw.ron | 5 +- .../common/items/food/meat/tough_cooked.ron | 5 +- assets/common/items/food/meat/tough_raw.ron | 5 +- assets/common/items/food/mushroom.ron | 5 +- assets/common/items/food/mushroom_stick.ron | 5 +- assets/common/items/food/onion.ron | 5 +- assets/common/items/food/plainsalad.ron | 5 +- .../common/items/food/pumpkin_spice_brew.ron | 5 +- assets/common/items/food/sage.ron | 5 +- assets/common/items/food/spore_corruption.ron | 10 +- assets/common/items/food/sunflower_icetea.ron | 5 +- assets/common/items/food/tomato.ron | 5 +- assets/common/items/food/tomatosalad.ron | 5 +- client/src/lib.rs | 3 +- common/net/src/msg/server.rs | 6 +- common/src/combat.rs | 9 +- common/src/comp/ability.rs | 8 +- common/src/comp/aura.rs | 4 +- common/src/comp/buff.rs | 293 ++++++++---------- common/src/states/behavior.rs | 5 +- common/src/states/self_buff.rs | 3 +- common/state/src/state.rs | 9 +- common/systems/src/aura.rs | 9 +- common/systems/src/buff.rs | 81 ++--- common/systems/src/character_behavior.rs | 2 + server/agent/src/action_nodes.rs | 3 +- server/src/client.rs | 2 +- server/src/cmd.rs | 19 +- server/src/events/entity_creation.rs | 5 +- server/src/events/entity_manipulation.rs | 4 +- server/src/state_ext.rs | 6 +- server/src/sys/entity_sync.rs | 10 +- voxygen/egui/src/lib.rs | 4 +- voxygen/src/hud/buffs.rs | 65 ++-- voxygen/src/hud/group.rs | 26 +- voxygen/src/hud/mod.rs | 21 +- voxygen/src/hud/overhead.rs | 26 +- voxygen/src/hud/util.rs | 2 +- voxygen/src/scene/particle.rs | 4 +- 67 files changed, 352 insertions(+), 523 deletions(-) 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..574e9df041 100644 --- a/assets/common/items/consumable/potion_big.ron +++ b/assets/common/items/consumable/potion_big.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_med.ron b/assets/common/items/consumable/potion_med.ron index 905d859fa5..b3130f157e 100644 --- a/assets/common/items/consumable/potion_med.ron +++ b/assets/common/items/consumable/potion_med.ron @@ -8,10 +8,7 @@ ItemDef( kind: Potion, data: ( strength: 75.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_minor.ron b/assets/common/items/consumable/potion_minor.ron index a032df7335..82840b1064 100644 --- a/assets/common/items/consumable/potion_minor.ron +++ b/assets/common/items/consumable/potion_minor.ron @@ -8,10 +8,7 @@ ItemDef( kind: Potion, data: ( strength: 50.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/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..cc5401e551 100644 --- a/common/src/combat.rs +++ b/common/src/combat.rs @@ -27,7 +27,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,6 +363,7 @@ impl Attack { emit(ServerEvent::Buff { entity: target.entity, buff_change: BuffChange::Add(b.to_buff( + time, attacker.map(|a| a.uid), applied_damage, strength_modifier, @@ -529,6 +530,7 @@ impl Attack { emit(ServerEvent::Buff { entity: target.entity, buff_change: BuffChange::Add(b.to_buff( + time, attacker.map(|a| a.uid), accumulated_damage, strength_modifier, @@ -1027,7 +1029,7 @@ 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, 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 +1040,12 @@ impl CombatBuff { self.kind, BuffData::new( self.strength.to_strength(damage, strength_modifier), - Some(Duration::from_secs_f32(self.dur_secs)), + Some(self.dur_secs as f64), None, ), Vec::new(), source, + time, ) } } diff --git a/common/src/comp/ability.rs b/common/src/comp/ability.rs index 67479f0a59..8b6b5a1714 100644 --- a/common/src/comp/ability.rs +++ b/common/src/comp/ability.rs @@ -728,7 +728,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 +2051,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 +2078,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; } }); } @@ -2667,7 +2667,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..a6d9558650 100644 --- a/common/src/comp/aura.rs +++ b/common/src/comp/aura.rs @@ -142,7 +142,7 @@ impl Auras { pub struct AuraBuffConstructor { pub kind: BuffKind, pub strength: f32, - pub duration: Option, + pub duration: Option, pub category: BuffCategory, } @@ -158,7 +158,7 @@ impl AuraBuffConstructor { kind: self.kind, data: BuffData { strength: self.strength, - duration: self.duration.map(Duration::from_secs_f32), + duration: self.duration, delay: None, }, category: self.category, diff --git a/common/src/comp/buff.rs b/common/src/comp/buff.rs index f1c9224a6d..36398865ac 100644 --- a/common/src/comp/buff.rs +++ b/common/src/comp/buff.rs @@ -1,6 +1,6 @@ #![allow(clippy::nonstandard_macro_braces)] //tmp as of false positive !? -use crate::uid::Uid; -use core::{cmp::Ordering, time::Duration}; +use crate::{resources::Time, uid::Uid}; +use core::cmp::Ordering; #[cfg(not(target_arch = "wasm32"))] use hashbrown::HashMap; use itertools::Either; @@ -143,13 +143,13 @@ impl BuffKind { #[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] pub struct BuffData { pub strength: f32, - pub duration: Option, - pub delay: Option, + pub duration: Option, + pub delay: Option, } #[cfg(not(target_arch = "wasm32"))] impl BuffData { - pub fn new(strength: f32, duration: Option, delay: Option) -> Self { + pub fn new(strength: f32, duration: Option, delay: Option) -> Self { Self { strength, duration, @@ -233,8 +233,8 @@ pub struct Buff { pub kind: BuffKind, pub data: BuffData, pub cat_ids: Vec, - pub time: Option, - pub delay: Option, + pub end_time: Option