From bcf36d08b0822e0c839ebdb568119ebe9c78468f Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 9 May 2022 22:45:43 -0400 Subject: [PATCH] Add removed items to migration. --- common/src/combat.rs | 5 +++-- server/src/migrations/V49__modular_weapons.sql | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/common/src/combat.rs b/common/src/combat.rs index c026e05dac..dfeae2e5cb 100644 --- a/common/src/combat.rs +++ b/common/src/combat.rs @@ -976,7 +976,7 @@ pub fn weapon_rating(item: &T, _msm: &MaterialStatManifest) -> f32 const ENERGY_EFFICIENCY_WEIGHT: f32 = 1.5; const BUFF_STRENGTH_WEIGHT: f32 = 1.5; - if let ItemKind::Tool(tool) = &*item.kind() { + let rating = if let ItemKind::Tool(tool) = &*item.kind() { let stats = tool.stats; // TODO: Look into changing the 0.5 to reflect armor later maybe? @@ -1002,7 +1002,8 @@ pub fn weapon_rating(item: &T, _msm: &MaterialStatManifest) -> f32 + buff_strength_rating * BUFF_STRENGTH_WEIGHT } else { 0.0 - } + }; + rating.max(0.0) } #[cfg(not(target_arch = "wasm32"))] diff --git a/server/src/migrations/V49__modular_weapons.sql b/server/src/migrations/V49__modular_weapons.sql index 607176f72b..273f35bdb7 100644 --- a/server/src/migrations/V49__modular_weapons.sql +++ b/server/src/migrations/V49__modular_weapons.sql @@ -1,3 +1,12 @@ +-- Remove old test items +DELETE FROM item WHERE item_definition_id = 'common.items.crafting_ing.modular.damage.sword.metal_blade'; +DELETE FROM item WHERE item_definition_id = 'common.items.tag_examples.cloth_item'; +DELETE FROM item WHERE item_definition_id = 'common.items.tag_examples.leather'; +DELETE FROM item WHERE item_definition_id = 'common.items.tag_examples.leather_item'; +DELETE FROM item WHERE item_definition_id = 'common.items.tag_examples.metal_ingot'; +DELETE FROM item WHERE item_definition_id = 'common.items.tag_examples.placeholder'; +DELETE FROM item WHERE item_definition_id = 'common.items.tag_examples.textile'; + CREATE TEMP TABLE _temp_modular_items ( existing_item_definition_id TEXT NOT NULL,