Upload files to 'mc_extra_mobs'

This commit is contained in:
TechDudie 2021-03-30 23:34:03 +00:00
parent ab629263df
commit 2eb00fe099
5 changed files with 709 additions and 0 deletions

125
mc_extra_mobs/fox.lua Normal file
View File

@ -0,0 +1,125 @@
--MCmobs v0.4
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
local pi = math.pi
local atann = math.atan
local atan = function(x)
if not x or x ~= x then
return 0
else
return atann(x)
end
end
local S = minetest.get_translator("extra_mobs")
--###################
--################### fox
--###################
local fox = {
type = "monster",
passive = false,
spawn_class = "hostile",
hp_min = 10,
hp_max = 10,
xp_min = 1,
xp_max = 2,
armor = {fleshy = 90},
attack_type = "dogfight",
damage = 2,
reach = 1.5,
collisionbox = {-0.3, -0.01, -0.3, 0.3, 0.84, 0.3},
visual = "mesh",
mesh = "extra_mobs_fox.b3d",
textures = { {
"extra_mobs_fox.png",
"extra_mobs_trans.png",
} },
visual_size = {x=3, y=3},
sounds = {
},
jump = true,
makes_footstep_sound = true,
walk_velocity = 3,
run_velocity = 6,
drops = {
},
animation = {
stand_speed = 7,
walk_speed = 7,
run_speed = 15,
stand_start = 11,
stand_end = 11,
walk_start = 0,
walk_end = 10,
run_start = 0,
run_end = 10,
pounce_start = 11,
pounce_end = 31,
lay_start = 34,
lay_end = 34,
},
runaway = true,
on_spawn = function(self)
if minetest.find_node_near(self.object:get_pos(), 4, "mcl_core:snow") ~= nil or minetest.find_node_near(self.object:get_pos(), 4, "mcl_core:dirt_with_grass_snow") ~= nil then
minetest.chat_send_all("true")
self.object:set_properties({textures={"extra_mobs_artic_fox.png", "extra_mobs_trans.png"}})
end
end,
do_custom = function(self)
if self.child == true then
self.object:set_properties({textures={self.base_texture[1], self.base_texture[1]}})
end
if self.state ~= "attack" and math.random(1, 5000) == 1 then
self.state = "lay"
self.object:set_animation({x= 12, y=16})
minetest.after(math.random(10, 500), function()
if self.state == "lay" then
self.state = "stand"
end
end)
end
for _,object in pairs(minetest.get_objects_inside_radius(self.object:get_pos(), 8)) do
if not object:is_player() and object:get_luaentity().name == "extra_mobs:fox" and self.state ~= "attack" and math.random(1, 500) == 1 then
self.horny = true
end
local lp = object:get_pos()
local s = self.object:get_pos()
local vec = {
x = lp.x - s.x,
y = lp.y - s.y,
z = lp.z - s.z
}
if object:is_player() and not object:get_player_control().sneak or not object:is_player() and object:get_luaentity().name == "mobs_mc:wolf" then
self.state = "runaway"
self.object:set_rotation({x=0,y=(atan(vec.z / vec.x) + 3 * pi / 2) - self.rotate,z=0})
if self.reach > vector.distance(self.object:get_pos(), object:get_pos()) and self.timer > .9 then
self.timer = 0
object:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = self.damage}
}, nil)
end
end
end
end,
do_punch = function(self)
self.state = "runaway"
end,
fear_height = 4,
view_range = 16,
specific_attack = { "mobs_mc:cow", "mobs_mc:sheep", "mobs_mc:chicken" },
}
mobs:register_mob("extra_mobs:fox", fox)
-- Regular spawning in the Nether
mobs:spawn_specific("extra_mobs:fox", {"mcl_core:dirt_with_grass"}, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 6000, 3, 0, 500)
mobs:spawn_specific("extra_mobs:fox", {"mcl_core:dirt_with_grass_snow"}, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 6000, 3, 0, 500)
mobs:spawn_specific("extra_mobs:artic_fox", {"mcl_core:snow"}, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 6000, 3, 0, 500)
-- spawn eggs
mobs:register_egg("extra_mobs:fox", S("Fox"), "extra_mobs_spawn_icon_fox.png", 0)

View File

@ -0,0 +1,121 @@
--MCmobs v0.4
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
local S = minetest.get_translator("extra_mobs")
--###################
--################### hoglin
--###################
local hoglin = {
type = "monster",
passive = false,
spawn_class = "hostile",
hp_min = 40,
hp_max = 40,
xp_min = 9,
xp_max = 9,
armor = {fleshy = 90},
attack_type = "dogfight",
damage = 4,
reach = 3,
collisionbox = {-.6, -0.01, -.6, .6, 1.4, .6},
visual = "mesh",
mesh = "extra_mobs_hoglin.b3d",
textures = { {
"extra_mobs_hoglin.png",
} },
visual_size = {x=3, y=3},
sounds = {
random = "extra_mobs_hoglin",
damage = "extra_mobs_hoglin_hurt",
distance = 16,
},
jump = true,
makes_footstep_sound = true,
walk_velocity = 1,
run_velocity = 4,
drops = {
{name = "mcl_mobsitems:leather",
chance = 1,
min = 0,
max = 1,},
},
drops = {
{name = "mcl_mobitems:porkchop",
chance = 1,
min = 2,
max = 4,},
},
animation = {
stand_speed = 7,
walk_speed = 7,
run_speed = 15,
stand_start = 24,
stand_end = 24,
walk_start = 11,
walk_end = 21,
run_start = 1,
run_end = 10,
punch_start = 22,
punch_end = 32,
},
fear_height = 4,
view_range = 32,
floats = 0,
custom_attack = function(self)
if self.state == "attack" and self.reach > vector.distance(self.object:get_pos(), self.attack:get_pos()) then
self.attack:add_velocity({x=0,y=13,z=0})
self.attack:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = self.damage}
}, nil)
end
end,
do_custom = function(self)
if self.object:get_pos().y > -100 then
local zog = minetest.add_entity(self.object:get_pos(), "extra_mobs:zoglin")
zog:set_rotation(self.object:get_rotation())
self.object:remove()
end
end,
attack_animals = true,
}
mobs:register_mob("extra_mobs:hoglin", hoglin)
local zoglin = table.copy(hoglin)
zoglin.fire_resistant = 1
zoglin.textures = {"extra_mobs_zoglin.png"}
zoglin.do_custom = function()
return
end
zoglin.attacks_monsters = true
zoglin.lava_damage = 0
zoglin.fire_damage = 0
mobs:register_mob("extra_mobs:zoglin", zoglin)
-- Baby hoglin.
--[[
local baby_hoglin = table.copy(hoglin)
baby_hoglin.collisionbox = {-.3, -0.01, -.3, .3, 0.94, .3}
baby_hoglin.xp_min = 20
baby_hoglin.xp_max = 20
baby_hoglin.visual_size = {x=hoglin.visual_size.x/2, y=hoglin.visual_size.y/2}
textures = { {
"extra_mobs_hoglin.png",
"extra_mobs_trans.png",
} }
baby_hoglin.walk_velocity = 1.2
baby_hoglin.run_velocity = 2.4
baby_hoglin.child = 1
mobs:register_mob("extra_mobs:baby_hoglin", baby_hoglin)]]
-- Regular spawning in the Nether
mobs:spawn_specific("extra_mobs:hoglin", {"mcl_nether:netherrack"}, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 6000, 3, mcl_vars.mg_nether_min, mcl_vars.mg_nether_max)
-- spawn eggs
mobs:register_egg("extra_mobs:hoglin", S("Hoglin"), "extra_mobs_spawn_icon_hoglin.png", 0)

19
mc_extra_mobs/init.lua Normal file
View File

@ -0,0 +1,19 @@
--MCmobs v0.4
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
local path = minetest.get_modpath("extra_mobs")
if not minetest.get_modpath("mobs_mc_gameconfig") then
mobs_mc = {}
end
--Monsters
dofile(path .. "/herobrine.lua")
dofile(path .. "/hoglin+zoglin.lua")
dofile(path .. "/piglin.lua")
--Animals
dofile(path .. "/strider.lua")
dofile(path .. "/fox.lua")

221
mc_extra_mobs/piglin.lua Normal file
View File

@ -0,0 +1,221 @@
--MCmobs v0.4
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
local trading_items = {
{ itemstring = "mcl_core:obsidian", amount_min = 1, amount_max = 1 },
{ itemstring = "mcl_core:gravel", amount_min = 8, amount_max = 16 },
{ itemstring = "mcl_mobitems:leather", amount_min = 4, amount_max = 10 },
{ itemstring = "mcl_nether:soul_sand", amount_min = 4, amount_max = 16 },
{ itemstring = "mcl_nether:nether_brick", amount_min = 4, amount_max = 16 },
{ itemstring = "mcl_mobitems:string", amount_min = 3, amount_max = 9 },
{ itemstring = "mcl_nether:quartz", amount_min = 4, amount_max = 10 },
{ itemstring = "mcl_potions:water", amount_min = 1, amount_max = 1 },
{ itemstring = "mcl_core:iron_nugget", amount_min = 10, amount_max = 36 },
{ itemstring = "mcl_throwing:ender_pearl", amount_min = 2, amount_max = 6 },
{ itemstring = "mcl_potions:fire_resistance", amount_min = 1, amount_max = 1 },
{ itemstring = "mcl_potions:fire_resistance_splash", amount_min = 1, amount_max = 1 },
}
local S = minetest.get_translator("extra_mobs")
local mod_bows = minetest.get_modpath("mcl_bows") ~= nil
--###################
--################### piglin
--###################
local piglin = {
type = "monster",
passive = false,
spawn_class = "hostile",
hp_min = 16,
hp_max = 16,
xp_min = 9,
xp_max = 9,
armor = {fleshy = 90},
damage = 4,
reach = 3,
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.94, 0.3},
visual = "mesh",
mesh = "extra_mobs_piglin.b3d",
textures = { {
"extra_mobs_piglin.png",
"mcl_bows_crossbow_2.png",
} },
visual_size = {x=1, y=1},
sounds = {
random = "extra_mobs_piglin",
damage = "extra_mobs_piglin_hurt",
distance = 16,
},
jump = true,
makes_footstep_sound = true,
walk_velocity = 4.317,
run_velocity = 5.6121,
drops = {
{name = "mcl_bows:crossbow",
chance = 10,
min = 1,
max = 1,},
},
animation = {
stand_speed = 30,
walk_speed = 30,
run_speed = 30,
stand_start = 0,
stand_end = 79,
walk_start = 168,
walk_end = 187,
run_start = 440,
run_end = 459,
},
fear_height = 4,
view_range = 16,
on_spawn = function(self)
self.gold_items = 0
self.weapon = self.base_texture[2]
end,
do_custom = function(self)
if self.trading == true then
self.state = "trading"
self.object:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(20,-20,18))
self.object:set_bone_position("Head", vector.new(0,6.3,0), vector.new(-40,0,0))
self.base_texture[2] = "default_gold_ingot.png"
self.object:set_properties({textures = self.base_texture})
else
self.object:set_bone_position("Wield_Item", vector.new(-1.5,7,1.5), vector.new(170,90,90))
self.base_texture[2] = self.weapon
self.object:set_properties({textures = self.base_texture})
self.object:set_bone_position("Head", vector.new(0,6.3,0), vector.new(0,0,0))
self.object:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(0,0,0))
end
if self.state ~= "attack" then
self._attacked_by_player = false
end
if self.state == "attack" and self.attack:is_player() then
for i=1, 6 do
local stack = self.attack:get_inventory():get_stack("armor", i)
local item = stack:get_name()
if item == "mcl_armor:chestplate_gold" or item == "mcl_armor:leggings_gold" or item == "mcl_armor:helmet_gold" or item == "mcl_armor:boots_gold" then
if self._attacked_by_player == false then
self.state = "stand"
end
end
end
end
end,
on_rightclick = function(self, clicker)
if clicker:is_player() and clicker:get_wielded_item():get_name() == "mcl_core:gold_ingot" and self.state ~= "attack" and self.gold_items < 3 then
local item_gold = clicker:get_wielded_item()
item_gold:take_item(1)
clicker:set_wielded_item(item_gold)
self.state = "stand"
self.object:set_animation({x=0,y=79})
self.trading = true
self.gold_items = self.gold_items + 1
self.object:set_bone_position("Wield_Item", vector.new(-1.5,4.9,1.8), vector.new(135,0,90))
minetest.after(5, function()
self.gold_items = self.gold_items - 1
if self.gold_items == 0 then
self.trading = false
self.state = "stand"
end
local c_pos = self.object:get_pos()
self.what_traded = trading_items[math.random(#trading_items)]
for x = 1, math.random(self.what_traded.amount_min, self.what_traded.amount_max) do
minetest.add_item({x=math.random(c_pos.x - 1, c_pos.x + 1), y=math.random(c_pos.y - 1, c_pos.y + 1), z= math.random(c_pos.z - 1, c_pos.z + 1)}, self.what_traded.itemstring)
end
end)
end
end,
do_punch = function(self, hitter)
if hitter:is_player() then
self._attacked_by_player = true
end
end,
attack_type = "dogshoot",
arrow = "mcl_bows:arrow_entity",
shoot_arrow = function(self, pos, dir)
if mod_bows then
-- 2-4 damage per arrow
local dmg = math.max(4, math.random(2, 8))
mcl_bows.shoot_arrow("mcl_bows:arrow", pos, dir, self.object:get_yaw(), self.object, nil, dmg)
end
end,
shoot_interval = 1.2,
shoot_offset = 1.5,
dogshoot_switch = 1,
dogshoot_count_max =1.8,
}
mobs:register_mob("extra_mobs:piglin", piglin)
local sword_piglin = table.copy(piglin)
sword_piglin.mesh = "extra_mobs_sword_piglin.b3d"
sword_piglin.textures = {"extra_mobs_piglin.png", "default_tool_goldsword.png"}
sword_piglin.on_spawn = function(self)
self.gold_items = 0
self.weapon = self.base_texture[2]
self.object:set_bone_position("Wield_Item", vector.new(0,3.9,1.3), vector.new(90,0,0))
end
sword_piglin.drops = {
{name = "mcl_tools:sword_gold",
chance = 10,
min = 1,
max = 1,},
}
sword_piglin.attack_type = "dogfight"
sword_piglin.animation = {
stand_speed = 30,
walk_speed = 30,
punch_speed = 45,
run_speed = 30,
stand_start = 0,
stand_end = 79,
walk_start = 168,
walk_end = 187,
run_start = 440,
run_end = 459,
punch_start = 189,
punch_end = 198,
}
mobs:register_mob("extra_mobs:sword_piglin", sword_piglin)
local zombified_piglin = table.copy(piglin)
zombified_piglin.fire_resistant = 1
zombified_piglin.do_custom = function()
return
end
zombified_piglin.attacks_monsters = true
zombified_piglin.lava_damage = 0
zombified_piglin.fire_damage = 0
zombified_piglin.attack_animals = true
zombified_piglin.mesh = "extra_mobs_sword_piglin.b3d"
zombified_piglin.textures = {"extra_mobs_zombified_piglin.png", "default_tool_goldsword.png", "extra_mobs_trans.png"}
zombified_piglin.on_spawn = function()
return
end
zombified_piglin.attack_type = "dogfight"
zombified_piglin.animation = {
stand_speed = 30,
walk_speed = 30,
punch_speed = 45,
run_speed = 30,
stand_start = 0,
stand_end = 79,
walk_start = 168,
walk_end = 187,
run_start = 440,
run_end = 459,
punch_start = 189,
punch_end = 198,
}
mobs:register_mob("extra_mobs:zombified_piglin", zombified_piglin)
-- Regular spawning in the Nether
mobs:spawn_specific("extra_mobs:piglin", {"mcl_nether:netherrack"}, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 6000, 3, mcl_vars.mg_nether_min, mcl_vars.mg_nether_max)
-- spawn eggs
mobs:register_egg("extra_mobs:piglin", S("piglin"), "extra_mobs_spawn_icon_piglin.png", 0)

223
mc_extra_mobs/strider.lua Normal file
View File

@ -0,0 +1,223 @@
--MCmobs v0.4
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
local S = minetest.get_translator("extra_mobs")
--###################
--################### STRIDER
--###################
local strider = {
type = "animal",
passive = true,
spawn_class = "passive",
hp_min = 20,
hp_max = 20,
xp_min = 9,
xp_max = 9,
armor = {fleshy = 90},
attack_type = "dogfight",
damage = 2,
reach = 2,
collisionbox = {-.6, -0.01, -.6, .6, 1.94, .6},
visual = "mesh",
mesh = "extra_mobs_strider.b3d",
textures = { {
"extra_mobs_strider.png",
} },
visual_size = {x=3, y=3},
sounds = {
},
jump = true,
makes_footstep_sound = true,
walk_velocity = 2,
run_velocity = 4,
runaway = true,
drops = {
{name = "mcl_mobsitems:string",
chance = 1,
min = 2,
max = 5,},
},
animation = {
stand_speed = 15,
walk_speed = 15,
run_speed = 30,
stand_start = 5,
stand_end = 5,
walk_start = 1,
walk_end = 20,
},
lava_damage = 0,
fire_damage = 0,
light_damage = 0,
water_damage = 5,
fear_height = 4,
view_range = 16,
fire_resistant = true,
floats_on_lava = 1,
floats = 0,
do_custom = function(self, dtime)
if minetest.find_node_near(self.object:get_pos(), 2, "mcl_core:lava_source") ~= nil or minetest.find_node_near(self.object:get_pos(), 2, "mcl_core:lava_flowing") ~= nil or minetest.find_node_near(self.object:get_pos(), 2, "mcl_nether:nether_lava_source") ~= nil or minetest.find_node_near(self.object:get_pos(), 2, "mcl_nether:nether_lava_flowing") ~= nil then
self.walk_velocity = 2
self.run_velocity = 4
self.base_texture[1] = "extra_mobs_strider.png"
self.shaking = false
else
self.base_texture[1] = "extra_mobs_strider_cold.png"
self.walk_velocity = .5
self.run_velocity = 1
self.shaking = true
end
self.object:set_properties({textures=self.base_texture, shaking=self.shaking, run_velocity=self.run_velocity, walk_velocity=self.walk_velocity})
-- set needed values if not already present
if not self.v2 then
self.v2 = 0
self.max_speed_forward = 8
self.max_speed_reverse = 4
self.accel = 2
self.terrain_type = 3
self.driver_attach_at = {x = 0, y = 5.5, z = -1.75}
self.driver_eye_offset = {x = 0, y = 10, z = 0}
self.driver_scale = {x = 1/self.visual_size.x, y = 1/self.visual_size.y}
end
-- if driver present allow control of horse
if self.driver then
mobs.drive(self, "walk", "stand", false, dtime)
return false -- skip rest of mob functions
end
return true
end,
on_die = function(self, pos)
-- drop saddle when horse is killed while riding
-- also detach from horse properly
if self.driver then
mobs.detach(self.driver, {x = 1, y = 0, z = 1})
end
end,
on_rightclick = function(self, clicker)
if not clicker or not clicker:is_player() then
return
end
local wielditem = clicker:get_wielded_item()
local controlitem = ""
if minetest.get_modpath("mc") then
controlitem = "mc:warped_fungus_stick"
else
controlitem = mobs_mc.items.carrot_on_a_stick
end
if wielditem:get_name() ~= controlitem then
if mobs:feed_tame(self, clicker, 1, true, true) then return end
end
if mobs:protect(self, clicker) then return end
if self.child then
return
end
local item = clicker:get_wielded_item()
if item:get_name() == mobs_mc.items.saddle and self.saddle ~= "yes" then
self.base_texture = {
"extra_mobs_strider.png",
"mobs_mc_pig_saddle.png", -- saddle
}
self.object:set_properties({
textures = self.base_texture
})
self.saddle = "yes"
self.tamed = true
self.drops = {
{name = "mcl_mobitems:string",
chance = 1,
min = 1,
max = 3,},
{name = "mcl_mobitems:saddle",
chance = 1,
min = 1,
max = 1,},
}
if not minetest.is_creative_enabled(clicker:get_player_name()) then
local inv = clicker:get_inventory()
local stack = inv:get_stack("main", clicker:get_wield_index())
stack:take_item()
inv:set_stack("main", clicker:get_wield_index(), stack)
end
minetest.sound_play({name = "mcl_armor_equip_leather"}, {gain=0.5, max_hear_distance=8, pos=self.object:get_pos()}, true)
return
end
-- Mount or detach player
local name = clicker:get_player_name()
if self.driver and clicker == self.driver then
-- Detach if already attached
mobs.detach(clicker, {x=1, y=0, z=0})
return
elseif not self.driver and self.saddle == "yes" and wielditem:get_name() == controlitem then
-- Ride pig if it has a saddle and player uses a carrot on a stick
mobs.attach(self, clicker)
if not minetest.is_creative_enabled(clicker:get_player_name()) then
local inv = self.driver:get_inventory()
-- 26 uses
if wielditem:get_wear() > 63000 then
-- Break carrot on a stick
local def = wielditem:get_definition()
if def.sounds and def.sounds.breaks then
minetest.sound_play(def.sounds.breaks, {pos = clicker:get_pos(), max_hear_distance = 8, gain = 0.5}, true)
end
wielditem = {name = mobs_mc.items.fishing_rod, count = 1}
else
wielditem:add_wear(2521)
end
inv:set_stack("main",self.driver:get_wield_index(), wielditem)
end
return
elseif not self.driver and clicker:get_wielded_item():get_name() ~= "" then
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
end
end,
}
mobs:register_mob("extra_mobs:strider", strider)
-- Baby strider.
local baby_strider = table.copy(strider)
baby_strider.collisionbox = {-.3, -0.01, -.3, .3, 0.94, .3}
baby_strider.xp_min = 13
baby_strider.xp_max = 13
baby_strider.visual_size = {x=strider.visual_size.x/2, y=strider.visual_size.y/2}
textures = { {
"extra_mobs_strider.png",
"extra_mobs_trans.png",
} }
baby_strider.walk_velocity = 1.2
baby_strider.run_velocity = 2.4
baby_strider.child = 1
mobs:register_mob("extra_mobs:baby_strider", baby_strider)
-- Regular spawning in the Nether
mobs:spawn_specific("extra_mobs:strider", {"mcl_nether:nether_lava_source"}, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 6000, 3, mcl_vars.mg_nether_min, mcl_vars.mg_nether_max)
-- spawn eggs
mobs:register_egg("extra_mobs:strider", S("Strider"), "extra_mobs_spawn_icon_strider.png", 0)