[Fix Issue #11] Rotten flesh has more uses

This commit is contained in:
sys4-fr 2018-01-07 04:02:07 +01:00
parent 6a6cc58506
commit b5e8b52218
7 changed files with 161 additions and 88 deletions

View File

@ -26,3 +26,4 @@ mtfoods?
mush45? mush45?
mushroom? mushroom?
seaplants? seaplants?
pclasses?

View File

@ -20,6 +20,11 @@ HUNGER_EXHAUST_PLACE = 1 -- exhaustion increased this value after placed
HUNGER_EXHAUST_MOVE = 0.3 -- exhaustion increased this value if player movement detected HUNGER_EXHAUST_MOVE = 0.3 -- exhaustion increased this value if player movement detected
HUNGER_EXHAUST_LVL = 160 -- at what exhaustion player satiation gets lowerd HUNGER_EXHAUST_LVL = 160 -- at what exhaustion player satiation gets lowerd
-- NALC : Fix MFF pclasses behaviour
local pc = false
if minetest.get_modpath("pclasses") and pclasses then
pc = true
end
--load custom settings --load custom settings
local set = io.open(minetest.get_modpath("hbhunger").."/hbhunger.conf", "r") local set = io.open(minetest.get_modpath("hbhunger").."/hbhunger.conf", "r")
@ -106,13 +111,14 @@ local function hunger_step()
local hp = player:get_hp() local hp = player:get_hp()
local timerquot = 1 -- By default regen 0.5 hearth every 10sec local timerquot = 1 -- By default regen 0.5 hearth every 10sec
if pclasses.api.get_player_class(name) == "warrior" then if pc then -- NALC : Fix MFF modif
timerquot = 1.42 -- Black_Mithril armor = 0.5 hearth every 7.0sec if pclasses.api.get_player_class(name) == "warrior" then
elseif pclasses.api.util.does_wear_full_armor(name, "mithril", false) then timerquot = 1.42 -- Black_Mithril armor = 0.5 hearth every 7.0sec
timerquot = 1.17 -- Mithril armor = 0.5 hearth every 8.5sec elseif pclasses.api.util.does_wear_full_armor(name, "mithril", false) then
timerquot = 1.17 -- Mithril armor = 0.5 hearth every 8.5sec
end
end end
if timer > 10/timerquot then if timer > 10/timerquot then
-- heal player by 1 hp if not dead and satiation is > 15 (of 30) -- heal player by 1 hp if not dead and satiation is > 15 (of 30)
if h > 15 and hp > 0 and player:get_breath() > 0 then if h > 15 and hp > 0 and player:get_breath() > 0 then

@ -1 +1 @@
Subproject commit 71aa7b6d83f3e7edeac72678eedbeb002cd639e6 Subproject commit 2e77df9a8cee745ac2ce28a2aaa4fb4e3bfe02d2

View File

@ -1,2 +1,4 @@
default default
mobs mobs
maptools?
zombie?

View File

@ -1,10 +1,19 @@
-- Wolf by KrupnoPavel -- Wolf by KrupnoPavel
local drop_coin = nil -- NALC : Drop silver coin by chance if maptools mod loaded
if minetest.get_modpath("maptools") then
drop_coin = {
name = "maptools:silver_coin",
chance = 4, min = 1, max = 1,
}
end
mobs:register_mob( mobs:register_mob(
"pmobs:wolf", "pmobs:wolf",
{ {
type = "monster", type = "monster",
docile_by_day = true,
passive = false, passive = false,
pathfinding = false, pathfinding = false,
reach = 2, reach = 2,
@ -30,21 +39,23 @@ mobs:register_mob(
damage = 3, damage = 3,
attack_type = "dogfight", attack_type = "dogfight",
drops = { drops = {
{name = "mobs:meat_raw", {
chance = 1, name = "mobs:meat_raw",
min = 2, chance = 1,
max = 3,}, min = 2,
{name = "maptools:silver_coin", max = 3,
chance = 4, min = 1, max = 1,}, },
drop_coin -- NALC
}, },
drawtype = "front", drawtype = "front",
water_damage = 0, water_damage = 0,
lava_damage = 5, lava_damage = 5,
light_damage = 0, light_damage = 0,
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
local tool = clicker:get_wielded_item() local tool = clicker:get_wielded_item():get_name()
if tool:get_name() == "mobs:meat_raw" then if tool == "mobs:meat_raw" or
clicker:get_inventory():remove_item("main", "mobs:meat_raw") (minetest.get_modpath("zombie") and tool == "zombie:rotten_flesh") then
clicker:get_inventory():remove_item("main", tool)
minetest.add_entity(self.object:getpos(), "pmobs:dog") minetest.add_entity(self.object:getpos(), "pmobs:dog")
self.object:remove() self.object:remove()
end end

View File

@ -1,2 +1,5 @@
default default
mobs mobs
nether?
maptools?
hbhunger?

View File

@ -1,81 +1,131 @@
-- Zombie by BlockMen -- Zombie by BlockMen
mobs:register_mob("zombie:zombie", { local drop_coin = nil -- NALC : Drop silver coin if maptools mod
-- animal, monster, npc, barbarian local drop_napple = nil -- NALC : Drop nether apple if nether
type = "monster",
-- aggressive, deals 6 damage to player when hit if minetest.get_modpath("maptools") then
passive = false, drop_coin = {
attack_type = "dogfight", name = "maptools:silver_coin",
pathfinding = false, chance = 1, min = 1, max = 1
damage = 3, }
-- health & armor end
hp_min = 12,
hp_max = 35, if minetest.get_modpath("nether") then
armor = 150, drop_napple = {
-- textures and model name = "nether:apple",
collisionbox = {-0.25, -1, -0.3, 0.25, 0.75, 0.3}, chance = 8, min = 1, max = 1
visual = "mesh", }
mesh = "mobs_zombie.x", end
textures = {
{"mobs_zombie.png"}, mobs:register_mob(
}, "zombie:zombie",
visual_size = {x=1, y=1}, {
blood_texture = "mobs_blood.png", -- animal, monster, npc, barbarian
-- sounds type = "monster",
makes_footstep_sound = true, -- aggressive, deals 6 damage to player when hit
sounds = { passive = false,
random = "mobs_zombie", attack_type = "dogfight",
damage = "mobs_zombie_hit", pathfinding = false,
attack = "mobs_zombie_attack", damage = 3,
death = "mobs_zombie_death", -- health & armor
}, hp_min = 12,
-- speed and jump hp_max = 35,
view_range = 10, armor = 150,
walk_velocity = 1, -- textures and model
run_velocity = 3, collisionbox = {-0.25, -1, -0.3, 0.25, 0.75, 0.3},
jump = true, visual = "mesh",
floats = 0, mesh = "mobs_zombie.x",
-- drops nether fruit and silver coin when dead textures = {
drops = { {"mobs_zombie.png"},
{name = "nether:apple", },
chance = 2, min = 1, max = 2,}, visual_size = {x=1, y=1},
{name = "zombie:zombie_tibia", blood_texture = "mobs_blood.png",
chance = 10, min = 1, max = 1,}, -- sounds
{name = "maptools:silver_coin", makes_footstep_sound = true,
chance = 1, min = 1, max = 1,}, sounds = {
{name = "zombie:rotten_flesh", random = "mobs_zombie",
chance = 2, min = 3, max = 5,}, damage = "mobs_zombie_hit",
}, attack = "mobs_zombie_attack",
-- damaged by death = "mobs_zombie_death",
water_damage = 1, },
lava_damage = 5, -- speed and jump
light_damage = 2, view_range = 10,
-- model animation walk_velocity = 1,
animation = { run_velocity = 3,
speed_normal = 10, speed_run = 15, jump = true,
stand_start = 0, stand_end = 79, floats = 0,
walk_start = 168, walk_end = 188, -- drops nether fruit and silver coin when dead
run_start = 168, run_end = 188, drops = {
-- punch_start = 168, punch_end = 188, {name = "zombie:rotten_flesh",
}, chance = 2, min = 3, max = 5,},
}) {name = "zombie:zombie_tibia",
chance = 10, min = 1, max = 1,},
drop_napple, -- NALC
drop_coin -- NALC
},
-- damaged by
water_damage = 1,
lava_damage = 5,
light_damage = 2,
-- model animation
animation = {
speed_normal = 10, speed_run = 15,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 188,
run_start = 168, run_end = 188,
-- punch_start = 168, punch_end = 188,
},
})
mobs:alias_mob("mobs:zombie", "zombie:zombie") mobs:alias_mob("mobs:zombie", "zombie:zombie")
-- spawn in nether forest between -1 and 5 light, 1 in 7000 change, 1 zombie in area up to 31000 in height -- spawn in nether forest between -1 and 5 light, 1 in 7000 chance, 1 zombie in area up to 31000 in height
mobs:spawn_specific("zombie:zombie", {"nether:dirt_top", "default:dirt_with_grass", "default:stone"}, {"air"}, -1, 5, 30, 7000, 1, -31000, 31000, false) mobs:spawn_specific("zombie:zombie", {"nether:dirt_top", "default:dirt_with_grass", "default:dirt", "default:stone"}, {"air"}, -1, 5, 30, 7000, 1, -31000, 31000, false)
-- register spawn egg -- register spawn egg
mobs:register_egg("zombie:zombie", "Zombie", "mobs_zombie_inv.png", 1) mobs:register_egg("zombie:zombie", "Zombie", "mobs_zombie_inv.png", 1)
minetest.register_craftitem("zombie:zombie_tibia", { minetest.register_craftitem(
description = "Zombie Tibia", "zombie:zombie_tibia",
inventory_image = "mobs_zombie_tibia.png", {
groups = {magic = 1}, description = "Zombie Tibia",
}) inventory_image = "mobs_zombie_tibia.png",
groups = {magic = 1},
})
minetest.register_alias("mobs:zombie_tibia", "zombie:zombie_tibia") minetest.register_alias("mobs:zombie_tibia", "zombie:zombie_tibia")
minetest.register_craftitem("zombie:rotten_flesh", { minetest.register_craftitem(
description = "Rotten Flesh", "zombie:rotten_flesh",
inventory_image = "mobs_rotten_flesh.png", {
on_use = minetest.item_eat(1), description = "Rotten Flesh",
inventory_image = "mobs_rotten_flesh.png",
on_use = function(itemstack, user) -- NALC : Augmente la faim de 5 points mais augmente la vie de 1 point
local inv = user:get_inventory()
if not inv then return end
itemstack:take_item()
-- Augmente la vie de 1 point
user:set_hp(user:get_hp() + 1)
-- Si hbhunger alors augmente la faim de 5 points (Réduction de la barre de faim)
if minetest.get_modpath("hbhunger") then
local p_hunger = tonumber(hbhunger.hunger[user:get_player_name()])
if not p_hunger then return end
p_hunger = p_hunger - 5
if p_hunger < 0 then p_hunger = 0 end
hbhunger.hunger[user:get_player_name()] = p_hunger
local save_hunger = hbhunger.save_hunger
if not save_hunger then save_hunger = hbhunger.set_hunger end
save_hunger(user)
end
return itemstack
end
})
minetest.register_craft({
type = "cooking",
output = "mobs:meat",
recipe = "zombie:rotten_flesh",
cooktime = 5,
}) })