From da7240d6c1863e04e84f7297e1801ed5361eea4b Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 23 Dec 2020 17:41:42 +0100 Subject: [PATCH] looting --- mods/ENTITIES/mcl_mobs/api.lua | 38 +++++++++++++++---- mods/ENTITIES/mobs_mc/blaze.lua | 3 +- mods/ENTITIES/mobs_mc/chicken.lua | 6 ++- mods/ENTITIES/mobs_mc/cow+mooshroom.lua | 6 ++- mods/ENTITIES/mobs_mc/creeper.lua | 5 ++- mods/ENTITIES/mobs_mc/enderman.lua | 3 +- mods/ENTITIES/mobs_mc/ghast.lua | 4 +- mods/ENTITIES/mobs_mc/guardian.lua | 25 ++++++++---- mods/ENTITIES/mobs_mc/guardian_elder.lua | 25 ++++++++---- mods/ENTITIES/mobs_mc/horse.lua | 3 +- mods/ENTITIES/mobs_mc/llama.lua | 3 +- mods/ENTITIES/mobs_mc/parrot.lua | 3 +- mods/ENTITIES/mobs_mc/pig.lua | 3 +- mods/ENTITIES/mobs_mc/polar_bear.lua | 6 ++- mods/ENTITIES/mobs_mc/rabbit.lua | 8 ++-- mods/ENTITIES/mobs_mc/sheep.lua | 6 ++- mods/ENTITIES/mobs_mc/shulker.lua | 8 ++-- mods/ENTITIES/mobs_mc/skeleton+stray.lua | 26 +++++++++---- mods/ENTITIES/mobs_mc/skeleton_wither.lua | 9 +++-- mods/ENTITIES/mobs_mc/spider.lua | 6 ++- mods/ENTITIES/mobs_mc/squid.lua | 3 +- mods/ENTITIES/mobs_mc/villager_evoker.lua | 3 +- mods/ENTITIES/mobs_mc/villager_vindicator.lua | 8 ++-- mods/ENTITIES/mobs_mc/villager_zombie.lua | 15 ++++++-- mods/ENTITIES/mobs_mc/witch.lua | 14 +++---- mods/ENTITIES/mobs_mc/zombie.lua | 15 ++++++-- mods/ENTITIES/mobs_mc/zombiepig.lua | 14 ++++--- mods/ITEMS/mcl_enchanting/enchantments.lua | 7 ++-- 28 files changed, 188 insertions(+), 87 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 596843ac6..c769fee05 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -643,11 +643,13 @@ end -- drop items -local item_drop = function(self, cooked) +local item_drop = function(self, cooked, looting_level) -- no drops if disabled by setting if not mobs_drop_items then return end - + + looting_level = looting_level or 0 + -- no drops for child mobs (except monster) if (self.child and self.type ~= "monster") then return @@ -659,11 +661,33 @@ local item_drop = function(self, cooked) self.drops = self.drops or {} -- nil check for n = 1, #self.drops do - - if random(1, self.drops[n].chance) == 1 then - - num = random(self.drops[n].min or 1, self.drops[n].max or 1) - item = self.drops[n].name + local dropdef = self.drops[n] + local chance = 1 / dropdef.chance + local looting_type = dropdef.looting + + if looting_level > 0 then + local chance_function = dropdef.looting_chance_function + if chance_function then + chance = chance_function(looting_level) + elseif looting_type == "rare" then + chance = chance + (dropdef.looting_factor or 0.01) * looting_level + end + end + + local num = 0 + local do_common_looting = (looting_level > 0 and looting_type == "common") + if random() < chance then + num = random(dropdef.min or 1, dropdef.max or 1) + elseif not dropdef.looting_ignore_chance then + do_common_looting = false + end + + if do_common_looting then + num = num + math.floor(math.random(0, looting_level) + 0.5) + end + + if num > 0 then + item = dropdef.name -- cook items when true if cooked then diff --git a/mods/ENTITIES/mobs_mc/blaze.lua b/mods/ENTITIES/mobs_mc/blaze.lua index aae82a39b..3e0af9ab1 100644 --- a/mods/ENTITIES/mobs_mc/blaze.lua +++ b/mods/ENTITIES/mobs_mc/blaze.lua @@ -41,7 +41,8 @@ mobs:register_mob("mobs_mc:blaze", { {name = mobs_mc.items.blaze_rod, chance = 1, min = 0, - max = 1,}, + max = 1, + looting = "common",}, }, animation = { stand_speed = 25, diff --git a/mods/ENTITIES/mobs_mc/chicken.lua b/mods/ENTITIES/mobs_mc/chicken.lua index 618d1e0f0..325371e2b 100644 --- a/mods/ENTITIES/mobs_mc/chicken.lua +++ b/mods/ENTITIES/mobs_mc/chicken.lua @@ -32,11 +32,13 @@ mobs:register_mob("mobs_mc:chicken", { {name = mobs_mc.items.chicken_raw, chance = 1, min = 1, - max = 1,}, + max = 1, + looting = "common",}, {name = mobs_mc.items.feather, chance = 1, min = 0, - max = 2,}, + max = 2, + looting = "common",}, }, fall_damage = 0, fall_speed = -2.25, diff --git a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua index e8482d820..005af2980 100644 --- a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua +++ b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua @@ -23,11 +23,13 @@ local cow_def = { {name = mobs_mc.items.beef_raw, chance = 1, min = 1, - max = 3,}, + max = 3, + looting = "common",}, {name = mobs_mc.items.leather, chance = 1, min = 0, - max = 2,}, + max = 2, + looting = "common",}, }, runaway = true, sounds = { diff --git a/mods/ENTITIES/mobs_mc/creeper.lua b/mods/ENTITIES/mobs_mc/creeper.lua index a52e6e1e1..325d78b15 100644 --- a/mods/ENTITIES/mobs_mc/creeper.lua +++ b/mods/ENTITIES/mobs_mc/creeper.lua @@ -78,7 +78,7 @@ mobs:register_mob("mobs_mc:creeper", { end, on_die = function(self, pos) -- Drop a random music disc - -- TODO: Only do this if killed by skeleton + -- TODO: Only do this if killed by skeleton or stray if math.random(1, 200) == 1 then local r = math.random(1, #mobs_mc.items.music_discs) minetest.add_item({x=pos.x, y=pos.y+1, z=pos.z}, mobs_mc.items.music_discs[r]) @@ -89,7 +89,8 @@ mobs:register_mob("mobs_mc:creeper", { {name = mobs_mc.items.gunpowder, chance = 1, min = 0, - max = 2,}, + max = 2, + looting = "common",}, -- Head -- TODO: Only drop if killed by charged creeper diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index 934497a10..1b572fac6 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -220,7 +220,8 @@ mobs:register_mob("mobs_mc:enderman", { {name = mobs_mc.items.ender_pearl, chance = 1, min = 0, - max = 1,}, + max = 1, + looting = "common"}, }, animation = select_enderman_animation("normal"), _taken_node = "", diff --git a/mods/ENTITIES/mobs_mc/ghast.lua b/mods/ENTITIES/mobs_mc/ghast.lua index 713333085..5bd05b860 100644 --- a/mods/ENTITIES/mobs_mc/ghast.lua +++ b/mods/ENTITIES/mobs_mc/ghast.lua @@ -38,8 +38,8 @@ mobs:register_mob("mobs_mc:ghast", { walk_velocity = 1.6, run_velocity = 3.2, drops = { - {name = mobs_mc.items.gunpowder, chance = 1, min = 0, max = 2,}, - {name = mobs_mc.items.ghast_tear, chance = 3,min = 0,max = 1,}, + {name = mobs_mc.items.gunpowder, chance = 1, min = 0, max = 2, looting = "common"}, + {name = mobs_mc.items.ghast_tear, chance = 10/6, min = 0, max = 1, looting = "common", looting_ignore_chance = true}, }, animation = { stand_speed = 50, walk_speed = 50, run_speed = 50, diff --git a/mods/ENTITIES/mobs_mc/guardian.lua b/mods/ENTITIES/mobs_mc/guardian.lua index dd273c1eb..13c857ea3 100644 --- a/mods/ENTITIES/mobs_mc/guardian.lua +++ b/mods/ENTITIES/mobs_mc/guardian.lua @@ -46,7 +46,8 @@ mobs:register_mob("mobs_mc:guardian", { {name = mobs_mc.items.prismarine_shard, chance = 1, min = 0, - max = 32,}, + max = 32, + looting = "common",}, -- TODO: Reduce of drops when ocean monument is ready. -- The following drops are approximations @@ -54,29 +55,39 @@ mobs:register_mob("mobs_mc:guardian", { {name = mobs_mc.items.fish_raw, chance = 4, min = 1, - max = 1,}, + max = 1, + looting = "common",}, {name = mobs_mc.items.prismarine_crystals, chance = 4, min = 1, - max = 2,}, + max = 2, + looting = "common",}, -- Rare drop: fish {name = mobs_mc.items.fish_raw, chance = 160, -- 2.5% / 4 min = 1, - max = 1,}, + max = 1, + looting = "rare", + looting_factor = 0.0025,}, {name = mobs_mc.items.salmon_raw, chance = 160, min = 1, - max = 1,}, + max = 1, + looting = "rare", + looting_factor = 0.0025,}, {name = mobs_mc.items.clownfish_raw, chance = 160, min = 1, - max = 1,}, + max = 1, + looting = "rare", + looting_factor = 0.0025,}, {name = mobs_mc.items.pufferfish_raw, chance = 160, min = 1, - max = 1,}, + max = 1, + looting = "rare", + looting_factor = 0.0025,}, }, fly = true, makes_footstep_sound = false, diff --git a/mods/ENTITIES/mobs_mc/guardian_elder.lua b/mods/ENTITIES/mobs_mc/guardian_elder.lua index 7094dee24..a58a4a5b7 100644 --- a/mods/ENTITIES/mobs_mc/guardian_elder.lua +++ b/mods/ENTITIES/mobs_mc/guardian_elder.lua @@ -51,7 +51,8 @@ mobs:register_mob("mobs_mc:guardian_elder", { {name = mobs_mc.items.prismarine_shard, chance = 1, min = 1, - max = 64,}, + max = 64, + looting = "common",}, -- TODO: Only drop if killed by player {name = mobs_mc.items.wet_sponge, @@ -64,29 +65,39 @@ mobs:register_mob("mobs_mc:guardian_elder", { {name = mobs_mc.items.fish_raw, chance = 4, min = 1, - max = 1,}, + max = 1, + looting = "common",}, {name = mobs_mc.items.prismarine_crystals, chance = 1, min = 1, - max = 10,}, + max = 10, + looting = "common",}, -- Rare drop: fish {name = mobs_mc.items.fish_raw, chance = 160, -- 2.5% / 4 min = 1, - max = 1,}, + max = 1, + looting = "rare", + looting_factor = 0.01 / 4,}, {name = mobs_mc.items.salmon_raw, chance = 160, min = 1, - max = 1,}, + max = 1, + looting = "rare", + looting_factor = 0.01 / 4,}, {name = mobs_mc.items.clownfish_raw, chance = 160, min = 1, - max = 1,}, + max = 1, + looting = "rare", + looting_factor = 0.01 / 4,}, {name = mobs_mc.items.pufferfish_raw, chance = 160, min = 1, - max = 1,}, + max = 1, + looting = "rare", + looting_factor = 0.01 / 4,}, }, fly = true, makes_footstep_sound = false, diff --git a/mods/ENTITIES/mobs_mc/horse.lua b/mods/ENTITIES/mobs_mc/horse.lua index 95a02bfca..b9d82660c 100644 --- a/mods/ENTITIES/mobs_mc/horse.lua +++ b/mods/ENTITIES/mobs_mc/horse.lua @@ -127,7 +127,8 @@ local horse = { {name = mobs_mc.items.leather, chance = 1, min = 0, - max = 2,}, + max = 2, + looting = "common",}, }, do_custom = function(self, dtime) diff --git a/mods/ENTITIES/mobs_mc/llama.lua b/mods/ENTITIES/mobs_mc/llama.lua index 58a70de2f..36d020a65 100644 --- a/mods/ENTITIES/mobs_mc/llama.lua +++ b/mods/ENTITIES/mobs_mc/llama.lua @@ -54,7 +54,8 @@ mobs:register_mob("mobs_mc:llama", { {name = mobs_mc.items.leather, chance = 1, min = 0, - max = 2,}, + max = 2, + looting = "common",}, }, fear_height = 4, sounds = { diff --git a/mods/ENTITIES/mobs_mc/parrot.lua b/mods/ENTITIES/mobs_mc/parrot.lua index 90bf215ed..407cb4466 100644 --- a/mods/ENTITIES/mobs_mc/parrot.lua +++ b/mods/ENTITIES/mobs_mc/parrot.lua @@ -37,7 +37,8 @@ mobs:register_mob("mobs_mc:parrot", { {name = mobs_mc.items.feather, chance = 1, min = 1, - max = 2,}, + max = 2, + looting = "common",}, }, animation = { stand_speed = 50, diff --git a/mods/ENTITIES/mobs_mc/pig.lua b/mods/ENTITIES/mobs_mc/pig.lua index 09bda3199..38700b6ca 100644 --- a/mods/ENTITIES/mobs_mc/pig.lua +++ b/mods/ENTITIES/mobs_mc/pig.lua @@ -27,7 +27,8 @@ mobs:register_mob("mobs_mc:pig", { {name = mobs_mc.items.porkchop_raw, chance = 1, min = 1, - max = 3,}, + max = 3, + looting = "common",}, }, fear_height = 4, sounds = { diff --git a/mods/ENTITIES/mobs_mc/polar_bear.lua b/mods/ENTITIES/mobs_mc/polar_bear.lua index d974c7a60..459ca29b4 100644 --- a/mods/ENTITIES/mobs_mc/polar_bear.lua +++ b/mods/ENTITIES/mobs_mc/polar_bear.lua @@ -36,12 +36,14 @@ mobs:register_mob("mobs_mc:polar_bear", { {name = mobs_mc.items.fish_raw, chance = 2, min = 0, - max = 2,}, + max = 2, + looting = "common",}, -- 1/4 to drop raw salmon {name = mobs_mc.items.salmon_raw, chance = 4, min = 0, - max = 2,}, + max = 2, + looting = "common",}, }, floats = 1, diff --git a/mods/ENTITIES/mobs_mc/rabbit.lua b/mods/ENTITIES/mobs_mc/rabbit.lua index e2f9d213f..e167649f6 100644 --- a/mods/ENTITIES/mobs_mc/rabbit.lua +++ b/mods/ENTITIES/mobs_mc/rabbit.lua @@ -41,11 +41,9 @@ local rabbit = { runaway = true, jump = true, drops = { - {name = mobs_mc.items.rabbit_raw, chance = 1, min = 0, max = 1}, - {name = mobs_mc.items.rabbit_hide, chance = 1, min = 0, max = 1}, - {name = mobs_mc.items.rabbit_foot, chance = 10, min = 0, max = 1}, - -- TODO: Drop rabbit's foot when it's useful - --{name = mobs_mc.items.rabbit_foot, chance = 10, min = 1, max = 1}, + {name = mobs_mc.items.rabbit_raw, chance = 1, min = 0, max = 1, looting = "common",}, + {name = mobs_mc.items.rabbit_hide, chance = 1, min = 0, max = 1, looting = "common",}, + {name = mobs_mc.items.rabbit_foot, chance = 10, min = 0, max = 1, looting = "rare", looting_factor = 0.03,}, }, fear_height = 4, animation = { diff --git a/mods/ENTITIES/mobs_mc/sheep.lua b/mods/ENTITIES/mobs_mc/sheep.lua index ecf3ad5c0..681c68e1b 100644 --- a/mods/ENTITIES/mobs_mc/sheep.lua +++ b/mods/ENTITIES/mobs_mc/sheep.lua @@ -63,11 +63,13 @@ mobs:register_mob("mobs_mc:sheep", { {name = mobs_mc.items.mutton_raw, chance = 1, min = 1, - max = 2,}, + max = 2, + looting = "common",}, {name = colors["unicolor_white"][1], chance = 1, min = 1, - max = 1,}, + max = 1, + looting = "common",}, }, fear_height = 4, sounds = { diff --git a/mods/ENTITIES/mobs_mc/shulker.lua b/mods/ENTITIES/mobs_mc/shulker.lua index 97de5aba6..faaf2ac40 100644 --- a/mods/ENTITIES/mobs_mc/shulker.lua +++ b/mods/ENTITIES/mobs_mc/shulker.lua @@ -35,9 +35,11 @@ mobs:register_mob("mobs_mc:shulker", { jump = false, drops = { {name = mobs_mc.items.shulker_shell, - chance = 1, - min = 0, - max = 1,}, + chance = 2, + min = 1, + max = 1, + looting = "rare", + looting_factor = 0.0625}, }, animation = { stand_speed = 25, walk_speed = 25, run_speed = 50, punch_speed = 25, diff --git a/mods/ENTITIES/mobs_mc/skeleton+stray.lua b/mods/ENTITIES/mobs_mc/skeleton+stray.lua index 45cc6b979..f3ef3c4b1 100644 --- a/mods/ENTITIES/mobs_mc/skeleton+stray.lua +++ b/mods/ENTITIES/mobs_mc/skeleton+stray.lua @@ -46,15 +46,18 @@ local skeleton = { {name = mobs_mc.items.arrow, chance = 1, min = 0, - max = 2,}, + max = 2, + looting = "common",}, {name = mobs_mc.items.bow, - chance = 11, + chance = 100 / 8.5, min = 1, - max = 1,}, + max = 1, + looting = "rare",}, {name = mobs_mc.items.bone, chance = 1, min = 0, - max = 2,}, + max = 2, + looting = "common",}, -- Head -- TODO: Only drop if killed by charged creeper @@ -116,12 +119,21 @@ stray.textures = { -- TODO: different sound (w/ echo) -- TODO: stray's arrow inflicts slowness status table.insert(stray.drops, { - -- Chance to drop additional arrow. - -- TODO: Should be tipped arrow of slowness - name = mobs_mc.items.arrow, + name = "mcl_potions:slowness_arrow", chance = 2, min = 1, max = 1, + looting = "rare", + looting_chance_function = function(lvl) + local chance = 0.5 + for i = 1, lvl do + if chance > 1 then + return 1 + end + chance = chance + (1 - chance) / 2 + end + return chance + end, }) mobs:register_mob("mobs_mc:stray", stray) diff --git a/mods/ENTITIES/mobs_mc/skeleton_wither.lua b/mods/ENTITIES/mobs_mc/skeleton_wither.lua index 6dd2fcdbe..7684dc409 100644 --- a/mods/ENTITIES/mobs_mc/skeleton_wither.lua +++ b/mods/ENTITIES/mobs_mc/skeleton_wither.lua @@ -45,17 +45,20 @@ mobs:register_mob("mobs_mc:witherskeleton", { {name = mobs_mc.items.coal, chance = 1, min = 0, - max = 1,}, + max = 1, + looting = "common",}, {name = mobs_mc.items.bone, chance = 1, min = 0, - max = 2,}, + max = 2, + looting = "common",}, -- Head {name = mobs_mc.items.head_wither_skeleton, chance = 40, -- 2.5% chance min = 1, - max = 1,}, + max = 1, + looting = "rare",}, }, animation = { stand_start = 0, diff --git a/mods/ENTITIES/mobs_mc/spider.lua b/mods/ENTITIES/mobs_mc/spider.lua index 72a996038..0bb03a9c7 100644 --- a/mods/ENTITIES/mobs_mc/spider.lua +++ b/mods/ENTITIES/mobs_mc/spider.lua @@ -49,8 +49,10 @@ local spider = { view_range = 16, floats = 1, drops = { - {name = mobs_mc.items.string, chance = 1, min = 0, max = 2,}, - {name = mobs_mc.items.spider_eye, chance = 3, min = 1, max = 1,}, + {name = mobs_mc.items.string, chance = 1, min = 0, max = 2, looting = "common"}, + {name = mobs_mc.items.spider_eye, chance = 3, min = 1, max = 1, looting = "common", looting_chance_function = function(lvl) + return 1 - 2 / (lvl + 3) + end}, }, specific_attack = { "player", "mobs_mc:iron_golem" }, fear_height = 4, diff --git a/mods/ENTITIES/mobs_mc/squid.lua b/mods/ENTITIES/mobs_mc/squid.lua index 392143321..1877a2104 100644 --- a/mods/ENTITIES/mobs_mc/squid.lua +++ b/mods/ENTITIES/mobs_mc/squid.lua @@ -42,7 +42,8 @@ mobs:register_mob("mobs_mc:squid", { {name = mobs_mc.items.black_dye, chance = 1, min = 1, - max = 3,}, + max = 3, + looting = "common",}, }, visual_size = {x=3, y=3}, makes_footstep_sound = false, diff --git a/mods/ENTITIES/mobs_mc/villager_evoker.lua b/mods/ENTITIES/mobs_mc/villager_evoker.lua index b865a2bd5..226c82a32 100644 --- a/mods/ENTITIES/mobs_mc/villager_evoker.lua +++ b/mods/ENTITIES/mobs_mc/villager_evoker.lua @@ -55,7 +55,8 @@ mobs:register_mob("mobs_mc:evoker", { {name = mobs_mc.items.emerald, chance = 1, min = 0, - max = 1,}, + max = 1, + looting = "common",}, {name = mobs_mc.items.totem, chance = 1, min = 1, diff --git a/mods/ENTITIES/mobs_mc/villager_vindicator.lua b/mods/ENTITIES/mobs_mc/villager_vindicator.lua index 825ffd88f..31ff597ba 100644 --- a/mods/ENTITIES/mobs_mc/villager_vindicator.lua +++ b/mods/ENTITIES/mobs_mc/villager_vindicator.lua @@ -41,11 +41,13 @@ mobs:register_mob("mobs_mc:vindicator", { {name = mobs_mc.items.emerald, chance = 1, min = 0, - max = 1,}, + max = 1, + looting = "common",}, {name = mobs_mc.items.iron_axe, - chance = 11, + chance = 100 / 8.5, min = 1, - max = 1,}, + max = 1, + looting = "rare",}, }, -- TODO: sounds animation = { diff --git a/mods/ENTITIES/mobs_mc/villager_zombie.lua b/mods/ENTITIES/mobs_mc/villager_zombie.lua index 524a918de..e385185d5 100644 --- a/mods/ENTITIES/mobs_mc/villager_zombie.lua +++ b/mods/ENTITIES/mobs_mc/villager_zombie.lua @@ -44,19 +44,26 @@ mobs:register_mob("mobs_mc:villager_zombie", { {name = mobs_mc.items.rotten_flesh, chance = 1, min = 0, - max = 2,}, + max = 2, + looting = "common",}, {name = mobs_mc.items.iron_ingot, chance = 120, -- 2.5% / 3 min = 1, - max = 1,}, + max = 1, + looting = "rare", + looting_factor = 0.01 / 3,}, {name = mobs_mc.items.carrot, chance = 120, -- 2.5% / 3 min = 1, - max = 1,}, + max = 1, + looting = "rare", + looting_factor = 0.01 / 3,}, {name = mobs_mc.items.potato, chance = 120, -- 2.5% / 3 min = 1, - max = 1,}, + max = 1, + looting = "rare", + looting_factor = 0.01 / 3,}, }, sounds = { random = "mobs_mc_zombie_growl", diff --git a/mods/ENTITIES/mobs_mc/witch.lua b/mods/ENTITIES/mobs_mc/witch.lua index 5cddd5b42..d301fcb59 100644 --- a/mods/ENTITIES/mobs_mc/witch.lua +++ b/mods/ENTITIES/mobs_mc/witch.lua @@ -41,13 +41,13 @@ mobs:register_mob("mobs_mc:witch", { dogshoot_count_max =1.8, max_drops = 3, drops = { - {name = mobs_mc.items.glass_bottle, chance = 8, min = 0, max = 2,}, - {name = mobs_mc.items.glowstone_dust, chance = 8, min = 0, max = 2,}, - {name = mobs_mc.items.gunpowder, chance = 8, min = 0, max = 2,}, - {name = mobs_mc.items.redstone, chance = 8, min = 0, max = 2,}, - {name = mobs_mc.items.spider_eye, chance = 8, min = 0, max = 2,}, - {name = mobs_mc.items.sugar, chance = 8, min = 0, max = 2,}, - {name = mobs_mc.items.stick, chance = 4, min = 0, max = 2,}, + {name = mobs_mc.items.glass_bottle, chance = 8, min = 0, max = 2, looting = "common",}, + {name = mobs_mc.items.glowstone_dust, chance = 8, min = 0, max = 2, looting = "common",}, + {name = mobs_mc.items.gunpowder, chance = 8, min = 0, max = 2, looting = "common",}, + {name = mobs_mc.items.redstone, chance = 8, min = 0, max = 2, looting = "common",}, + {name = mobs_mc.items.spider_eye, chance = 8, min = 0, max = 2, looting = "common",}, + {name = mobs_mc.items.sugar, chance = 8, min = 0, max = 2, looting = "common",}, + {name = mobs_mc.items.stick, chance = 4, min = 0, max = 2, looting = "common",}, }, -- TODO: sounds animation = { diff --git a/mods/ENTITIES/mobs_mc/zombie.lua b/mods/ENTITIES/mobs_mc/zombie.lua index beb51d89f..75c8273c6 100644 --- a/mods/ENTITIES/mobs_mc/zombie.lua +++ b/mods/ENTITIES/mobs_mc/zombie.lua @@ -13,19 +13,26 @@ local drops_common = { {name = mobs_mc.items.rotten_flesh, chance = 1, min = 0, - max = 2,}, + max = 2, + looting = "common",}, {name = mobs_mc.items.iron_ingot, chance = 120, -- 2.5% / 3 min = 1, - max = 1,}, + max = 1, + looting = "rare", + looting_factor = 0.01 / 3,}, {name = mobs_mc.items.carrot, chance = 120, -- 2.5% / 3 min = 1, - max = 1,}, + max = 1, + looting = "rare", + looting_factor = 0.01 / 3,}, {name = mobs_mc.items.potato, chance = 120, -- 2.5% / 3 min = 1, - max = 1,}, + max = 1, + looting = "rare", + looting_factor = 0.01 / 3,}, } local drops_zombie = table.copy(drops_common) diff --git a/mods/ENTITIES/mobs_mc/zombiepig.lua b/mods/ENTITIES/mobs_mc/zombiepig.lua index a552f6d23..5b79e53b5 100644 --- a/mods/ENTITIES/mobs_mc/zombiepig.lua +++ b/mods/ENTITIES/mobs_mc/zombiepig.lua @@ -50,19 +50,23 @@ local pigman = { {name = mobs_mc.items.rotten_flesh, chance = 1, min = 1, - max = 1,}, + max = 1, + looting = "common"}, {name = mobs_mc.items.gold_nugget, chance = 1, min = 0, - max = 1,}, + max = 1, + looting = "common"}, {name = mobs_mc.items.gold_ingot, chance = 40, -- 2.5% min = 1, - max = 1,}, + max = 1, + looting = "rare"}, {name = mobs_mc.items.gold_sword, - chance = 12, -- 8.333%, approximation to 8.5% + chance = 100 / 8.5, min = 1, - max = 1,}, + max = 1, + looting = "rare"}, }, animation = { stand_speed = 25, diff --git a/mods/ITEMS/mcl_enchanting/enchantments.lua b/mods/ITEMS/mcl_enchanting/enchantments.lua index 7d53f012b..709a647f8 100644 --- a/mods/ITEMS/mcl_enchanting/enchantments.lua +++ b/mods/ITEMS/mcl_enchanting/enchantments.lua @@ -341,8 +341,8 @@ function minetest.calculate_knockback(player, hitter, time_from_last_punch, tool return knockback end --- unimplemented ---[[mcl_enchanting.enchantments.looting = { +-- implemented in mcl_mobs and mobs_mc +mcl_enchanting.enchantments.looting = { name = S("Looting"), max_level = 3, primary = {sword = true}, @@ -356,7 +356,7 @@ end requires_tool = false, treasure = false, power_range_table = {{15, 61}, {24, 71}, {33, 81}}, -}]]-- +} -- requires missing MineClone2 feature --[[mcl_enchanting.enchantments.loyalty = { @@ -375,6 +375,7 @@ end power_range_table = {{12, 50}, {19, 50}, {26, 50}}, }]]-- +-- implemented in mcl_fishing mcl_enchanting.enchantments.luck_of_the_sea = { name = S("Luck of the Sea"), max_level = 3,