From 35ec1d83537c41e35cc2622619e4b435d25bc22b Mon Sep 17 00:00:00 2001 From: epCode Date: Tue, 23 Mar 2021 22:22:52 +0000 Subject: [PATCH] Add files --- credits.txt | 1 + depends.txt | 1 + herobrine.lua | 88 +++++++++++++++++++++++++++++++ hoglin+zoglin.lua | 128 ++++++++++++++++++++++++++++++++++++++++++++++ init.lua | 17 ++++++ 5 files changed, 235 insertions(+) create mode 100644 credits.txt create mode 100644 depends.txt create mode 100644 herobrine.lua create mode 100644 hoglin+zoglin.lua create mode 100644 init.lua diff --git a/credits.txt b/credits.txt new file mode 100644 index 0000000..94fefba --- /dev/null +++ b/credits.txt @@ -0,0 +1 @@ +Strider textures -- [NO11] diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..493430b --- /dev/null +++ b/depends.txt @@ -0,0 +1 @@ +mcl_mobs diff --git a/herobrine.lua b/herobrine.lua new file mode 100644 index 0000000..3f382ba --- /dev/null +++ b/herobrine.lua @@ -0,0 +1,88 @@ +local S = minetest.get_translator("extra_mobs") + +local pr = PseudoRandom(os.time()*(-334)) + +minetest.register_entity("extra_mobs:hb_eye", { + visual = "mesh", + mesh = "mcl_armor_character.b3d", + textures = {"extra_mobs_herobrine_eyes.png", "extra_mobs_trans.png", "extra_mobs_trans.png" }, + visual_size = {x=1, y=1}, + on_activate = function(self) + for _,hb in pairs(minetest.get_objects_inside_radius(self.object:get_pos(), 1)) do + if not hb:is_player() then + minetest.chat_send_all(hb:get_luaentity().name) + end + if not hb:is_player() and hb:get_luaentity().name == "extra_mobs:herobrine" then + self.object:set_attach(hb, "Head", {x=0,y=-13.5,z=0}, {x=0,y=0,z=0}) + end + end + end, + do_custom = function(self) + if self.object:get_attach() == nil then + self.object:remove() + end + end, + glow = 10 +}) + +mobs:register_mob("extra_mobs:herobrine", { + type = "monster", + spawn_class = "hostile", + hp_min = 20, + hp_max = 20, + xp_min = 1000, + xp_max = 1000, + collisionbox = {-0.3, -0.01, -0.3, 0.3, 2, 0.3}, + visual = "mesh", + mesh = "mcl_armor_character.b3d", + textures = {"character.png", "extra_mobs_trans.png", "extra_mobs_trans.png" }, + visual_size = {x=1, y=1}, + makes_footstep_sound = false, + walk_velocity = 0, + run_velocity = 0, + damage = 10, + reach = 1, + armor = {fleshy = 0}, + view_range = 1000, + attack_type = "dogfight", + can_despawn = false, + on_spawn = function(self) + --if self.object:get_children() == nil then + minetest.add_entity(self.object:get_pos(), "extra_mobs:hb_eye") + --end + end, + do_custom = function(self) + for _,object in pairs(minetest.get_objects_inside_radius(self.object:get_pos(), 30)) do + if object:is_player() then + pos = self.object:get_pos() + local randomCube = vector.new( pos.x + 8*(pr:next(0,16)-8), pos.y + 8*(pr:next(0,16)-8), pos.z + 8*(pr:next(0,16)-8) ) + local nodes = minetest.find_nodes_in_area_under_air(vector.subtract(randomCube, 4), vector.add(randomCube, 4), {"group:solid", "group:cracky", "group:crumbly"}) + local telepos + if nodes ~= nil then + if #nodes > 0 then + -- Up to 64 attempts to teleport + for n=1, math.min(64, #nodes) do + local r = pr:next(1, #nodes) + local nodepos = nodes[r] + local node_ok = true + -- Selected node needs to have 3 nodes of free space above + for u=1, 3 do + local node = minetest.get_node({x=nodepos.x, y=nodepos.y+u, z=nodepos.z}) + if minetest.registered_nodes[node.name].walkable then + node_ok = false + break + end + end + if node_ok then + telepos = {x=nodepos.x, y=nodepos.y+1, z=nodepos.z} + end + end + if telepos then + self.object:set_pos(telepos) + end + end + end + end + end + end, +}) diff --git a/hoglin+zoglin.lua b/hoglin+zoglin.lua new file mode 100644 index 0000000..fec2ab4 --- /dev/null +++ b/hoglin+zoglin.lua @@ -0,0 +1,128 @@ +--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 dir_to_pitch = function(dir) + local dir2 = vector.normalize(dir) + local xz = math.abs(dir.x) + math.abs(dir.z) + return -math.atan2(-dir.y, xz) +end + + +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_core: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:hoglin", S("Hoglin"), "extra_mobs_spawn_icon_hoglin.png", 0) diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..5769db8 --- /dev/null +++ b/init.lua @@ -0,0 +1,17 @@ +--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") + +--Animals +dofile(path .. "/strider.lua")