diff --git a/games/default/files/beds/spawns.lua b/games/default/files/beds/spawns.lua index f3980a7a0..48b8a6694 100644 --- a/games/default/files/beds/spawns.lua +++ b/games/default/files/beds/spawns.lua @@ -41,10 +41,12 @@ function beds.save_spawns() if not beds.spawn then return end + local data = {} local output = io.open(org_file, "w") - for i, v in pairs(beds.spawn) do - output:write(v.x .. " " .. v.y .. " " .. v.z .. " " .. i .. "\n") + for k, v in pairs(beds.spawn) do + table.insert(data, string.format("%.1f %.1f %.1f %s\n", v.x, v.y, v.z, k)) end + output:write(table.concat(data)) io.close(output) end diff --git a/games/default/files/crafting/textures/crafting_hotbar.png b/games/default/files/crafting/textures/crafting_hotbar.png index 79893b235..805cd4953 100644 Binary files a/games/default/files/crafting/textures/crafting_hotbar.png and b/games/default/files/crafting/textures/crafting_hotbar.png differ diff --git a/games/default/files/fire/textures/fire_flint_steel.png b/games/default/files/fire/textures/fire_flint_steel.png index 4b2a6a184..287bf9e57 100644 Binary files a/games/default/files/fire/textures/fire_flint_steel.png and b/games/default/files/fire/textures/fire_flint_steel.png differ diff --git a/games/default/files/flowers/textures/flowers_oxeye_daisy.png b/games/default/files/flowers/textures/flowers_oxeye_daisy.png index 2089d8574..aeb3a09b8 100644 Binary files a/games/default/files/flowers/textures/flowers_oxeye_daisy.png and b/games/default/files/flowers/textures/flowers_oxeye_daisy.png differ diff --git a/games/default/files/hud/README.txt b/games/default/files/hud/README.txt index 992bde9dd..a14ed8eb8 100644 --- a/games/default/files/hud/README.txt +++ b/games/default/files/hud/README.txt @@ -15,7 +15,6 @@ Changes in builtin HUD items: - Uses better textures for Hotbar - Uses texture for crosshair - Positions of builtin statbars can be changed via "hud.conf" file -- Experimental "ItemWheel" that replaces the hotbar (must be enabled by adding "hud_item_wheel = true" in minetest.conf) This mod gets provided as Modpack aswell, which includes the hunger mod (https://github.com/BlockMen/hunger) More information concerning the hunger mechanics can be get there. diff --git a/games/default/files/hud/builtin.lua b/games/default/files/hud/builtin.lua index 0683da2d9..39c7786d5 100644 --- a/games/default/files/hud/builtin.lua +++ b/games/default/files/hud/builtin.lua @@ -15,19 +15,6 @@ HUD_HUNGER_OFFSET = {x = 6, y = -124} HUD_ARMOR_POS = {x = 0.5, y = 1} HUD_ARMOR_OFFSET = {x = -248, y = -124} --- Reorder everything when using ItemWeel -hud.item_wheel = minetest.setting_getbool("hud_item_wheel") -if hud.item_wheel then - HUD_HEALTH_POS = {x = 0.5,y = 1} - HUD_HEALTH_OFFSET = {x = -385, y = -77} - HUD_AIR_POS = {x = 0.5, y = 1} - HUD_AIR_OFFSET = {x = 150, y = -77} - HUD_HUNGER_POS = {x = 0.5, y = 1} - HUD_HUNGER_OFFSET = {x = 180, y = -44} - HUD_ARMOR_POS = {x = 0.5, y = 1} - HUD_ARMOR_OFFSET = {x = -415, y = -44} -end - -- read hud.conf settings hud.read_conf() diff --git a/games/default/files/hud/init.lua b/games/default/files/hud/init.lua index fe0f41fa7..9edb5ebd4 100644 --- a/games/default/files/hud/init.lua +++ b/games/default/files/hud/init.lua @@ -5,7 +5,3 @@ dofile(modpath .. "/api.lua") dofile(modpath .. "/functions.lua") dofile(modpath .. "/builtin.lua") dofile(modpath .. "/legacy.lua") -if hud.item_wheel then - dofile(modpath .. "/itemwheel.lua") -end - diff --git a/games/default/files/mobs/README.txt b/games/default/files/mobs/README.txt deleted file mode 100644 index 8ecc086d0..000000000 --- a/games/default/files/mobs/README.txt +++ /dev/null @@ -1,67 +0,0 @@ --= MOBS-MOD for MINETEST =- -by PilzAdam, KrupnovPavel, Zeg9, TenPlus1, kaadmy and MoNTE48 - - -https://forum.minetest.net/viewtopic.php?f=9&t=9917 - -This mod contains the following additions: - -- Giant Spiders (found in desert caves, drop string when killed) -- Bee's (found around flowers, drop honey when killed, right-click to pick up, also Beehives) -- Chicken (lays eggs, added fried egg, raw & cooked chicken, right-click to pick up) -- Cow (right-click with empty bucket to get bucket of milk, feed 8 wheat to replenish milk) -- Sheep (right-click for wool, feed 8 wheat to replenish wool) -- Warthog (the local pig that gives raw and cooked port) -- Rats (right-click to pick up and place, cook for a tasty treat) -- Sand, Dirt, Stone, Tree Monsters, Oerkki and Dungeon Masters as standard -- Lava Flan, Mese Monsters added to spice things up a bit -- Cook milk in furnace to get cheese wedge, 9 wedges make 1 cheese block - -..with the following new features: - -- Hitting a mob has knock-back effect like in minecraft, and with blood effect -- Mobs float in water, so monsters can still chase you -- Mobs can die from falling from a height -- Mobs have better health and drops -- Hitting a mob also puts them into fight mode (apart from animals) -- Compatible with Ethereal mod, mobs now spawn on ethereal worlds - -Changelog: - -1.26- Pathfinding feature added thanks to rnd, when monsters attack they become scary smart in finding you :) also, beehive produces honey now :) -1.25- Mobs no longer spawn within 12 blocks of player or despawn within same range, spawners now have player detection, Code tidy and tweak. -1.24- Added feature where certain animals run away when punched (runaway = true in mob definition) -1.23- Added mob spawner block for admin to setup spawners in-game (place and right click to enter settings) -1.22- Added ability to name tamed animals and npc using nametags, also npc will attack anyone who punches them apart from owner -1.21- Added some more error checking to reduce serialize.h error and added height checks for falling off cliffs (thanks cmdskp) -1.20- Error checking added to remove bad mobs, out of map limit mobs and stop serialize.h error -1.19- Chickens now drop egg items instead of placing the egg, also throwing eggs result in 1/8 chance of spawning chick -1.18- Added docile_by_day flag so that monsters will not attack automatically during daylight hours unless hit first -1.17- Added 'dogshoot' attack type, shoots when out of reach, melee attack when in reach, also api tweaks and self.reach added -1.16- Mobs follow multiple items now, Npc's can breed -1.15- Added Feeding/Taming/Breeding function, right-click to pick up any sheep with X mark on them and replace with new one to fix compatibility. -1.14- All .self variables saved in staticdata, Fixed self.health bug -1.13- Added capture function (thanks blert2112) chance of picking up mob with hand; net; magic lasso, replaced some .x models with newer .b3d one's -1.12- Added animal ownership so that players cannot steal your tamed animals -1.11- Added flying mobs (and swimming), fly=true and fly_in="air" or "deafult:water_source" for fishy -1,10- Footstep removed (use replace), explosion routine added for exploding mobs. -1.09- reworked breeding routine, added mob rotation value, added footstep feature, added jumping mobs with sounds feature, added magic lasso for picking up animals -1.08- Mob throwing attack has been rehauled so that they can damage one another, also drops and on_die function added -1.07- Npc's can now be set to follow player or stand by using self.order and self.owner variables -beta- Npc mob added, kills monsters, attacks player when punched, right click with food to heal or gold lump for drop -1.06- Changed recovery times after breeding, and time taken to grow up (can be sped up by feeding baby animal) -1.05- Added ExeterDad's bunny's which can be picked up and tamed with 4 carrots from farming redo or farming_plus, also shears added to get wool from sheep and lastly Jordach/BSD's kitten -1.04- Added mating for sheep, cows and hogs... feed animals to make horny and hope for a baby which is half size, will grow up quick though :) -1.03- Added mob drop/replace feature so that chickens can drop eggs, cow/sheep can eat grass/wheat etc. -1.02- Sheared sheep are remembered and spawn shaven, Warthogs will attack when threatened, Api additions -1.01- Mobs that suffer fall damage or die in water/lava/sunlight will now drop items -1.0 - more work on Api so that certain mobs can float in water while some sink like a brick :) -0.9 - Spawn eggs added for all mobs (admin only, cannot be placed in protected areas)... Api tweaked -0.8 - Added sounds to monster mobs (thanks Cyberpangolin for the sfx) and also chicken sound -0.7 - mobs.protected switch added to api.lua, when set to 1 mobs no longer spawn in protected areas, also bug fixes -0.6 - Api now supports multi-textured mobs, e.g oerkki, dungeon master, rats and chickens have random skins when spawning (sheep fix TODO), also new Honey block -0.5 - Mobs now float in water, die from falling, and some code improvements -0.4 - Dungeon Masters and Mese Monsters have much better aim due to shoot_offset, also they can both shoot through nodes that aren't walkable (flowers, grass etc) plus new sheep sound :) -0.3 - Added LOTT's Spider mob, made Cobwebs, added KPavel's Bee with Honey and Beehives (made texture), Warthogs now have sound and can be tamed, taming of shaved sheep or milked cow with 8 wheat so it will not despawn, many bug fixes :) -0.2 - Cooking bucket of milk into cheese now returns empty bucket -0.1 - Initial Release \ No newline at end of file diff --git a/games/default/files/mobs/chicken.lua b/games/default/files/mobs/chicken.lua deleted file mode 100644 index 956ba97de..000000000 --- a/games/default/files/mobs/chicken.lua +++ /dev/null @@ -1,120 +0,0 @@ --- Chicken by JK Murray - -mobs:register_mob("mobs:chicken", { - type = "animal", - passive = true, - reach = 1, - hp_min = 3, - hp_max = 6, - armor = 100, - collisionbox = {-0.3, -0.75, -0.3, 0.3, 0.1, 0.3}, - visual = "mesh", - mesh = "mobs_chicken.x", - -- seems a lot of textures but this fixes the problem with the model - textures = { - {"mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", - "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png"}, - {"mobs_chicken_black.png", "mobs_chicken_black.png", "mobs_chicken_black.png", "mobs_chicken_black.png", - "mobs_chicken_black.png", "mobs_chicken_black.png", "mobs_chicken_black.png", "mobs_chicken_black.png", "mobs_chicken_black.png"}, - }, - child_texture = { - {"mobs_chick.png", "mobs_chick.png", "mobs_chick.png", "mobs_chick.png", - "mobs_chick.png", "mobs_chick.png", "mobs_chick.png", "mobs_chick.png", "mobs_chick.png"}, - }, - makes_footstep_sound = true, - sounds = { - random = "mobs_chicken", - }, - walk_velocity = 1, - jump = true, - drops = { - {name = "mobs:chicken_raw", - chance = 1, min = 1, max = 2}, - }, - water_damage = 1, - lava_damage = 5, - light_damage = 0, - fall_damage = 0, - fall_speed = -8, - animation = { - speed_normal = 15, - stand_start = 0, - stand_end = 1, -- 20 - walk_start = 20, - walk_end = 40, - }, - follow = {"farming:seed_wheat", "farming:seed_cotton"}, - view_range = 5, - replace_rate = 8000, - replace_what = {"air"}, - replace_with = "mobs:egg", - on_rightclick = function(self, clicker) - mobs:feed_tame(self, clicker, 8, true, true) - mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) - end, -}) - -mobs:spawn_specific("mobs:chicken", - {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, - {"air"}, - 5, 20, 0, 4000, 1, 1, 31000 - ) - -mobs:register_egg("mobs:chicken", "Chicken", "mobs_chicken_inv.png", 0) - --- egg -minetest.register_node("mobs:egg", { - description = "Chicken Egg", - tiles = {"mobs_chicken_egg.png"}, - inventory_image = "mobs_chicken_egg.png", - visual_scale = 0.7, - drawtype = "plantlike", - wield_image = "mobs_chicken_egg.png", - paramtype = "light", - walkable = false, - is_ground_content = true, - sunlight_propagates = true, - selection_box = { - type = "fixed", - fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2} - }, - groups = {snappy=2, dig_immediate=3}, - after_place_node = function(pos, placer, itemstack) - if placer:is_player() then - minetest.set_node(pos, {name = "mobs:egg", param2 = 1}) - end - end -}) - --- fried egg -minetest.register_craftitem("mobs:chicken_egg_fried", { -description = "Fried Egg", - inventory_image = "mobs_chicken_egg_fried.png", - on_use = minetest.item_eat(2), -}) - -minetest.register_craft({ - type = "cooking", - recipe = "mobs:egg", - output = "mobs:chicken_egg_fried", -}) - --- raw chicken -minetest.register_craftitem("mobs:chicken_raw", { -description = "Raw Chicken", - inventory_image = "mobs_chicken_raw.png", - on_use = minetest.item_eat(2), -}) - --- cooked chicken -minetest.register_craftitem("mobs:chicken_cooked", { -description = "Cooked Chicken", - inventory_image = "mobs_chicken_cooked.png", - on_use = minetest.item_eat(6), -}) - -minetest.register_craft({ - type = "cooking", - recipe = "mobs:chicken_raw", - output = "mobs:chicken_cooked", -}) \ No newline at end of file diff --git a/games/default/files/mobs/init.lua b/games/default/files/mobs/init.lua deleted file mode 100644 index e557fe815..000000000 --- a/games/default/files/mobs/init.lua +++ /dev/null @@ -1,32 +0,0 @@ -local path = minetest.get_modpath("mobs") - --- Mob Api - -dofile(path.."/api.lua") - --- Animals - -dofile(path.."/chicken.lua") -- JKmurray -dofile(path.."/cow.lua") -- KrupnoPavel -dofile(path.."/rat.lua") -- PilzAdam -dofile(path.."/sheep.lua") -- PilzAdam -dofile(path.."/bunny.lua") -- ExeterDad -dofile(path.."/bear.lua") -- KrupnoPavel -dofile(path.."/dog.lua") -- KrupnoPavel -dofile(path.."/pig.lua") -- KrupnoPavel -dofile(path.."/kitten.lua") -- Jordach/BFD - --- Monsters - -dofile(path.."/spider.lua") -- AspireMint -dofile(path.."/zombie.lua") -- Blockmen -dofile(path.."/skeleton.lua") -- Blockmen - --- Mob Items -dofile(path.."/crafts.lua") - --- Spawner -dofile(path.."/spawner.lua") - --- Remove -dofile(path.."/npc.lua") \ No newline at end of file diff --git a/games/default/files/mobs/models/mobs_rat.b3d b/games/default/files/mobs/models/mobs_rat.b3d deleted file mode 100644 index 64376b909..000000000 Binary files a/games/default/files/mobs/models/mobs_rat.b3d and /dev/null differ diff --git a/games/default/files/mobs/npc.lua b/games/default/files/mobs/npc.lua deleted file mode 100644 index 82951ae75..000000000 --- a/games/default/files/mobs/npc.lua +++ /dev/null @@ -1,3 +0,0 @@ -mobs:register_mob("mobs:npc", { - lifetimer = 1, -}) \ No newline at end of file diff --git a/games/default/files/mobs/pig.lua b/games/default/files/mobs/pig.lua deleted file mode 100644 index 701ad718f..000000000 --- a/games/default/files/mobs/pig.lua +++ /dev/null @@ -1,63 +0,0 @@ --- Warthog(Boar) by KrupnoPavel (MIT) --- Changed to Boar and tweaked by Kaadmy (WTFPL) and MoNTE48 (LGPLv3) -mobs:register_mob("mobs:pig", { - type = "animal", - passive = false, - attack_type = "dogfight", - group_attack = true, - reach = 2, - damage = 2, - hp_min = 5, - hp_max = 15, - armor = 100, - collisionbox = {-0.4, -1, -0.4, 0.4, 0.1, 0.4}, - visual = "mesh", - mesh = "mobs_pig.x", - textures = { - {"mobs_pig.png"}, - }, - makes_footstep_sound = true, - sounds = { - random = "mobs_pig", - attack = "mobs_pig_angry", - death = "mobs_pig_angry", - }, - walk_velocity = 2, - run_velocity = 3, - jump = true, - follow = {"default:apple", "farming:potato"}, - view_range = 10, - drops = { - {name = "mobs:pork_raw", - chance = 1, min = 1, max = 1}, - {name = "mobs:pork_raw", - chance = 2, min = 1, max = 1}, - {name = "mobs:pork_raw", - chance = 2, min = 1, max = 1}, - }, - water_damage = 1, - lava_damage = 5, - light_damage = 0, - fear_height = 2, - animation = { - speed_normal = 20, - stand_start = 0, - stand_end = 60, - walk_start = 61, - walk_end = 80, - punch_start = 90, - punch_end = 110, - }, - on_rightclick = function(self, clicker) - mobs:feed_tame(self, clicker, 8, true, true) - mobs:capture_mob(self, clicker, 0, 5, 50, false, nil) - end, -}) - -mobs:spawn_specific("mobs:pig", - {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, - {"air"}, - 0, 20, 0, 5000, 1, -31000, 31000 - ) - -mobs:register_egg("mobs:pig", "Pig", "wool_pink.png", 1) diff --git a/games/default/files/mobs/rat.lua b/games/default/files/mobs/rat.lua deleted file mode 100644 index dd400441b..000000000 --- a/games/default/files/mobs/rat.lua +++ /dev/null @@ -1,60 +0,0 @@ - --- Rat by PilzAdam - -mobs:register_mob("mobs:rat", { - type = "animal", - passive = true, - hp_min = 1, - hp_max = 4, - armor = 100, - collisionbox = {-0.25, -1, -0.25, 0.25, -0.8, 0.25}, - visual = "mesh", - mesh = "mobs_rat.b3d", - textures = { - {"mobs_rat.png"}, - {"mobs_rat2.png"}, - }, - makes_footstep_sound = false, - sounds = { - random = "mobs_rat", - }, - drops = { - {name = "mobs:rat_meat", - chance = 1, min = 1, max = 1}, - }, - walk_velocity = 1, - run_velocity = 2, - runaway = true, - jump = true, - water_damage = 0, - lava_damage = 4, - light_damage = 0, - fear_height = 2, -}) - -mobs:spawn_specific("mobs:rat", - {"default:dirt", "default:sandstone", "default:sand", "default:stone", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, - {"air"}, - 0, 20, 0, 4000, 1, -31000, 31000 - ) - -mobs:register_egg("mobs:rat", "Rat", "mobs_rat_inventory.png", 0) - -minetest.register_craftitem("mobs:rat_cooked", { - description = "Cooked Rat", - inventory_image = "mobs_cooked_rat.png", - on_use = minetest.item_eat(3), -}) - -minetest.register_craftitem("mobs:rat_meat", { - description = "Meat Rat", - inventory_image = "mobs_rat_inventory.png", - on_use = minetest.item_eat(1), -}) - -minetest.register_craft({ - type = "cooking", - output = "mobs:rat_cooked", - recipe = "mobs:rat", - cooktime = 5, -}) \ No newline at end of file diff --git a/games/default/files/mobs/sheep.lua b/games/default/files/mobs/sheep.lua deleted file mode 100644 index 4a21076a6..000000000 --- a/games/default/files/mobs/sheep.lua +++ /dev/null @@ -1,142 +0,0 @@ -local all_colours = { - "grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta", - "white", "orange", "violet", "brown", "pink", "dark_grey", "dark_green" -} - --- Sheep by PilzAdam - -for _, col in ipairs(all_colours) do - - mobs:register_mob("mobs:sheep_"..col, { - type = "animal", - passive = true, - hp_min = 6, - hp_max = 10, - armor = 100, - collisionbox = {-0.4, -1, -0.4, 0.4, 0.3, 0.4}, - visual = "mesh", - mesh = "mobs_sheep.b3d", - textures = { - {"mobs_sheep_"..col..".png"}, - }, - gotten_texture = {"mobs_sheep_shaved.png"}, - gotten_mesh = "mobs_sheep_shaved.b3d", - makes_footstep_sound = true, - sounds = { - random = "mobs_sheep", - damage = "mobs_sheep_angry", - death = "mobs_sheep_angry", - }, - walk_velocity = 1, - jump = true, - drops = { - {name = "mobs:meat_raw", - chance = 1, min = 1, max = 2}, - {name = "wool:"..col, - chance = 1, min = 1, max = 1}, - }, - water_damage = 1, - lava_damage = 5, - light_damage = 0, - fear_height = 2, - animation = { - speed_normal = 15, - speed_run = 15, - stand_start = 0, - stand_end = 80, - walk_start = 81, - walk_end = 100, - }, - follow = {"farming:wheat", "default:grass_5"}, - view_range = 8, - replace_rate = 10, - replace_what = {"default:grass_3", "default:grass_4", "default:grass_5", "farming:wheat_8"}, - replace_with = "air", - replace_offset = -1, - on_rightclick = function(self, clicker) - local shpcolor = string.split(self.name,"_")[2] - if shpcolor =="dark" then - shpcolor = shpcolor.."_"..string.split(self.name,"_")[3] - end - - --are we feeding? - if mobs:feed_tame(self, clicker, 8, true, true) then - --if full grow fuzz - if self.gotten == false then - self.object:set_properties({ - textures = {"mobs_sheep_"..shpcolor..".png"}, - mesh = "mobs_sheep.b3d", - }) - end - return - end - - local item = clicker:get_wielded_item() - local itemname = item:get_name() - - --are we giving a haircut> - if itemname == "mobs:shears" then - if self.gotten == false and self.child == false then - self.gotten = true -- shaved - if minetest.get_modpath("wool") then - local pos = self.object:getpos() - pos.y = pos.y + 0.5 - local obj = minetest.add_item(pos, ItemStack("wool:"..shpcolor.." "..math.random(1,3))) - if obj then - obj:setvelocity({ - x = math.random(-1,1), - y = 5, - z = math.random(-1,1) - }) - end - item:add_wear(650) -- 100 uses - clicker:set_wielded_item(item) - end - self.object:set_properties({ - textures = {"mobs_sheep_shaved.png"}, - mesh = "mobs_sheep_shaved.b3d", - }) - end - return - end - - local name = clicker:get_player_name() - - --are we coloring? - if itemname:find("dye:") then - if self.gotten == false and self.child == false and self.tamed == true and name == self.owner then - local col = string.split(itemname,":")[2] - for _,c in pairs(all_colours) do - if c == col then - local pos = self.object:getpos() - self.object:remove() - local mob = minetest.add_entity(pos, "mobs:sheep_"..col) - local ent = mob:get_luaentity() - ent.owner = name - ent.tamed = true - -- take item - if not minetest.setting_getbool("creative_mode") then - item:take_item() - clicker:set_wielded_item(item) - end - break - end - end - end - return - end - - --are we capturing? - mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) - end - }) - - mobs:register_egg("mobs:sheep_"..col, "Sheep ("..col..")", "wool_"..col..".png", 1) - -end - -mobs:spawn_specific("mobs:sheep_white", - {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, - {"air"}, - 0, 20, 0, 5000, 1, -31000, 31000 - ) \ No newline at end of file diff --git a/games/default/files/mobs/sounds/mobs_fireball.ogg b/games/default/files/mobs/sounds/mobs_fireball.ogg deleted file mode 100644 index bdc4ac21f..000000000 Binary files a/games/default/files/mobs/sounds/mobs_fireball.ogg and /dev/null differ diff --git a/games/default/files/mobs/sounds/mobs_rat.ogg b/games/default/files/mobs/sounds/mobs_rat.ogg deleted file mode 100644 index 0e992671e..000000000 Binary files a/games/default/files/mobs/sounds/mobs_rat.ogg and /dev/null differ diff --git a/games/default/files/mobs/sounds/mobs_wolf_attack.ogg b/games/default/files/mobs/sounds/mobs_wolf_attack.ogg deleted file mode 100644 index 4b06f5154..000000000 Binary files a/games/default/files/mobs/sounds/mobs_wolf_attack.ogg and /dev/null differ diff --git a/games/default/files/mobs/spawner.lua b/games/default/files/mobs/spawner.lua deleted file mode 100644 index 762f1204e..000000000 --- a/games/default/files/mobs/spawner.lua +++ /dev/null @@ -1,157 +0,0 @@ --- mob spawner - -local spawner_default = "mobs:pumba 10 15 0 0" - -minetest.register_node("mobs:spawner", { - tiles = {"mob_spawner.png"}, - drawtype = "glasslike", - paramtype = "light", - walkable = true, - description = "Mob Spawner", - groups = {cracky = 1}, - - on_construct = function(pos) - - local meta = minetest.get_meta(pos) - - -- text entry formspec - meta:set_string("formspec", "field[text;Mob MinLight MaxLight Amount PlayerDist;${command}]") - meta:set_string("infotext", "Spawner Not Active (enter settings)") - meta:set_string("command", spawner_default) - end, - - on_right_click = function(pos, placer) - - if minetest.is_protected(pos, placer:get_player_name()) then - return - end - --- local meta = minetest.get_meta(pos) - end, - - on_receive_fields = function(pos, formname, fields, sender) - - if not fields.text or fields.text == "" then - return - end - - local meta = minetest.get_meta(pos) - local comm = fields.text:split(" ") - local name = sender:get_player_name() - - if minetest.is_protected(pos, name) then - minetest.record_protection_violation(pos, name) - return - end - - local mob = comm[1] -- mob to spawn - local mlig = tonumber(comm[2]) -- min light - local xlig = tonumber(comm[3]) -- max light - local num = tonumber(comm[4]) -- total mobs in area - local pla = tonumber(comm[5])-- player distance (0 to disable) - - if mob and mob ~= "" and mobs.spawning_mobs[mob] == true - and num and num >= 0 and num <= 10 - and mlig and mlig >= 0 and mlig <= 15 - and xlig and xlig >= 0 and xlig <= 15 - and pla and pla >=0 and pla <= 20 then - - meta:set_string("command", fields.text) - meta:set_string("infotext", "Spawner Active (" .. mob .. ")") - - else - minetest.chat_send_player(name, "Mob Spawner settings failed!") - end - end, -}) - --- spawner abm -minetest.register_abm({ - nodenames = {"mobs:spawner"}, - interval = 10, - chance = 4, - catch_up = false, - - action = function(pos, node, active_object_count, active_object_count_wider) - - -- check objects inside 9x9 area around spawner - local objs = minetest.get_objects_inside_radius(pos, 9) - - -- get meta and command - local meta = minetest.get_meta(pos) - local comm = meta:get_string("command"):split(" ") - - -- get settings from command - local mob = comm[1] - local mlig = tonumber(comm[2]) - local xlig = tonumber(comm[3]) - local num = tonumber(comm[4]) - local pla = tonumber(comm[5]) or 0 - - -- if amount is 0 then do nothing - if num == 0 then - return - end - - local count = 0 - local ent = nil - - -- count mob objects of same type in area - for k, obj in pairs(objs) do - - ent = obj:get_luaentity() - - if ent and ent.name == mob then - count = count + 1 - end - end - - -- is there too many of same type? - if count >= num then - return - end - - -- spawn mob if player detected and in range - if pla > 0 then - - local in_range = 0 - local objs = minetest.get_objects_inside_radius(pos, pla) - - for _,oir in pairs(objs) do - - if oir:is_player() then - - in_range = 1 - - break - end - end - - -- player not found - if in_range == 0 then - return - end - end - - -- find air blocks within 5 nodes of spawner - local air = minetest.find_nodes_in_area( - {x = pos.x - 5, y = pos.y, z = pos.z - 5}, - {x = pos.x + 5, y = pos.y, z = pos.z + 5}, - {"air"}) - - -- spawn in random air block - if air and #air > 0 then - - local pos2 = air[math.random(#air)] - local lig = minetest.get_node_light(pos2) or 0 - - pos2.y = pos2.y + 0.5 - - -- only if light levels are within range - if lig >= mlig and lig <= xlig then - minetest.add_entity(pos2, mob) - end - end - - end -}) \ No newline at end of file diff --git a/games/default/files/mobs/textures/mob_spawner.png b/games/default/files/mobs/textures/mob_spawner.png deleted file mode 100644 index fbb3da49e..000000000 Binary files a/games/default/files/mobs/textures/mob_spawner.png and /dev/null differ diff --git a/games/default/files/mobs/textures/mobs_bear.png b/games/default/files/mobs/textures/mobs_bear.png deleted file mode 100644 index f78810eed..000000000 Binary files a/games/default/files/mobs/textures/mobs_bear.png and /dev/null differ diff --git a/games/default/files/mobs/textures/mobs_blood.png b/games/default/files/mobs/textures/mobs_blood.png deleted file mode 100644 index d2ea7b601..000000000 Binary files a/games/default/files/mobs/textures/mobs_blood.png and /dev/null differ diff --git a/games/default/files/mobs/textures/mobs_bunny_brown.png b/games/default/files/mobs/textures/mobs_bunny_brown.png deleted file mode 100644 index f272bae50..000000000 Binary files a/games/default/files/mobs/textures/mobs_bunny_brown.png and /dev/null differ diff --git a/games/default/files/mobs/textures/mobs_bunny_grey.png b/games/default/files/mobs/textures/mobs_bunny_grey.png deleted file mode 100644 index 4ba7b7573..000000000 Binary files a/games/default/files/mobs/textures/mobs_bunny_grey.png and /dev/null differ diff --git a/games/default/files/mobs/textures/mobs_bunny_white.png b/games/default/files/mobs/textures/mobs_bunny_white.png deleted file mode 100644 index df232a531..000000000 Binary files a/games/default/files/mobs/textures/mobs_bunny_white.png and /dev/null differ diff --git a/games/default/files/mobs/textures/mobs_chick.png b/games/default/files/mobs/textures/mobs_chick.png deleted file mode 100644 index 826662d61..000000000 Binary files a/games/default/files/mobs/textures/mobs_chick.png and /dev/null differ diff --git a/games/default/files/mobs/textures/mobs_chicken.png b/games/default/files/mobs/textures/mobs_chicken.png deleted file mode 100644 index 7bbc7a448..000000000 Binary files a/games/default/files/mobs/textures/mobs_chicken.png and /dev/null differ diff --git a/games/default/files/mobs/textures/mobs_chicken_black.png b/games/default/files/mobs/textures/mobs_chicken_black.png deleted file mode 100644 index f872f465e..000000000 Binary files a/games/default/files/mobs/textures/mobs_chicken_black.png and /dev/null differ diff --git a/games/default/files/mobs/textures/mobs_cooked_rat.png b/games/default/files/mobs/textures/mobs_cooked_rat.png deleted file mode 100644 index 7ba9fe2b3..000000000 Binary files a/games/default/files/mobs/textures/mobs_cooked_rat.png and /dev/null differ diff --git a/games/default/files/mobs/textures/mobs_dog.png b/games/default/files/mobs/textures/mobs_dog.png deleted file mode 100644 index 43362a96c..000000000 Binary files a/games/default/files/mobs/textures/mobs_dog.png and /dev/null differ diff --git a/games/default/files/mobs/textures/mobs_rat.png b/games/default/files/mobs/textures/mobs_rat.png deleted file mode 100644 index 3d419250d..000000000 Binary files a/games/default/files/mobs/textures/mobs_rat.png and /dev/null differ diff --git a/games/default/files/mobs/textures/mobs_rat2.png b/games/default/files/mobs/textures/mobs_rat2.png deleted file mode 100644 index 22a2fcbd2..000000000 Binary files a/games/default/files/mobs/textures/mobs_rat2.png and /dev/null differ diff --git a/games/default/files/mobs/textures/mobs_rat_inventory.png b/games/default/files/mobs/textures/mobs_rat_inventory.png deleted file mode 100644 index c8acc7969..000000000 Binary files a/games/default/files/mobs/textures/mobs_rat_inventory.png and /dev/null differ diff --git a/games/default/files/mobs/textures/mobs_wolf.png b/games/default/files/mobs/textures/mobs_wolf.png deleted file mode 100644 index 128ca6f81..000000000 Binary files a/games/default/files/mobs/textures/mobs_wolf.png and /dev/null differ diff --git a/games/default/files/mobs/zombie.lua b/games/default/files/mobs/zombie.lua deleted file mode 100644 index fbc8ddf37..000000000 --- a/games/default/files/mobs/zombie.lua +++ /dev/null @@ -1,76 +0,0 @@ -mobs:register_mob("mobs:zombie", { - type = "monster", - visual = "mesh", - mesh = "zombie.x", - textures = { - {"mobs_zombie.png"}, - }, - collisionbox = {-0.25, -1, -0.3, 0.25, 0.75, 0.3}, - 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 - }, - makes_footstep_sound = true, - sounds = { - random = "mobs_zombie.1", - war_cry = "mobs_zombie.3", - attack = "mobs_zombie.2", - damage = "mobs_zombie_hit", - death = "mobs_zombie_death", - }, - hp_min = 15, - hp_max = 25, - armor = 100, - knock_back = 1, - light_damage = 1, - lava_damage = 10, - fear_height = 2, - damage = 2, - reach = 2, - attack_type = "dogfight", - group_attack = true, - view_range = 15, - walk_chance = 75, - walk_velocity = 0.5, - run_velocity = 0.5, - jump = false, - drops = { - {name = "mobs:rotten_flesh", chance = 1, min = 1, max = 3,} - }, - }) - - --name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height - mobs:spawn_specific("mobs:zombie", - {"default:dirt", "default:sandstone", "default:sand", "default:stone", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass", "default:cobble", "default:mossycobble"}, - {"air"}, - 0, 7, 0, 4000, 1, -31000, 31000 - ) - mobs:register_egg("mobs:zombie", "Zombie", "zombie_head.png", 0) - --- rotten flesh - minetest.register_craftitem("mobs:rotten_flesh", { - description = "Rotten Flesh", - inventory_image = "mobs_rotten_flesh.png", - on_use = minetest.item_eat(1), - }) - --- spawner block - minetest.register_node("mobs:zombie_spawner", { - description = "Zombie Spawner", - tiles = {"zombie_head.png"}, - is_ground_content = false, - groups = {cracky=3, stone=1, mob_spawner=1}, - sounds = default.node_sound_stone_defaults({ - dug = {name="mobs_zombie_death", gain=0.25} - }) - }) - minetest.register_abm({ - nodenames = {"mobs:zombie_spawner"}, - interval = 60.0, - chance = 1, - action = function(pos, node, active_object_count, active_object_count_wider) - minetest.add_entity(pos, "mobs:zombie") - end - }) \ No newline at end of file diff --git a/games/default/files/mobs/bear.lua b/games/default/files/mobs_animal/bear.lua similarity index 61% rename from games/default/files/mobs/bear.lua rename to games/default/files/mobs_animal/bear.lua index 54e16698b..47b19e768 100644 --- a/games/default/files/mobs/bear.lua +++ b/games/default/files/mobs_animal/bear.lua @@ -1,5 +1,5 @@ -- bear - mobs:register_mob("mobs:bear", { +mobs:register_mob("mobs_animal:bear", { type = "npc", visual = "mesh", mesh = "mobs_bear.x", @@ -7,12 +7,12 @@ {"mobs_bear.png"}, }, collisionbox = {-0.5, -0.01, -0.5, 0.5, 1.49, 0.5}, - animation = { - speed_normal = 15, speed_run = 24, - stand_start = 0, stand_end = 30, - walk_start = 35, walk_end = 65, - run_start = 105, run_end = 135, - punch_start = 70, punch_end = 100 + animation = { + speed_normal = 15, speed_run = 24, + stand_start = 0, stand_end = 30, + walk_start = 35, walk_end = 65, + run_start = 105, run_end = 135, + punch_start = 70, punch_end = 100 }, makes_footstep_sound = true, sounds = { @@ -20,14 +20,14 @@ attack = "mobs_bear_angry", }, reach = 2, - hp_min= 10, - hp_max = 15, + hp_min = 8, + hp_max = 12, armor = 100, knock_back = 1, lava_damage = 10, fall_damage = 5, fear_height = 2, - damage = 6, + damage = 4, reach = 3, attack_type = "dogfight", attacks_monsters = true, @@ -35,8 +35,8 @@ stepheight = 1.1, jump = false, drops = { - {name = "mobs:meat_raw", chance = 1, min = 3, max = 6}, - {name = "mobs:leather", chance = 1, min = 1, max = 2} + {name = "mobs:meat_raw", chance = 1, min = 2, max = 4}, + {name = "mobs:leather", chance = 1, min = 1, max = 2} }, follow = {"mobs:honey", "farming:raspberries", "farming:blueberries", "farming_plus:strawberry_item", "bushes:strawberry", "bushes:blackberry", "bushes:blueberry", "bushes:raspberry", @@ -46,7 +46,7 @@ "bushes:strawberry_bush", "bushes:blackberry_bush", "bushes:blueberry_bush", "bushes:raspberry_bush", "bushes:gooseberry_bush", "bushes:mixed_berry_bush"}, replace_with = "air", - on_rightclick = function(self, clicker) + on_rightclick = function (self, clicker) if mobs:feed_tame(self, clicker, 10, true) then return end @@ -69,16 +69,17 @@ end }) - local l_spawn_elevation_min = minetest.setting_get("water_level") - if l_spawn_elevation_min then - l_spawn_elevation_min = l_spawn_elevation_min - 10 - else - l_spawn_elevation_min = -10 - end - --name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height - mobs:spawn_specific("mobs:bear", - {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, - {"air"}, - 5, 20, 0, 6000, 1, 1, 31000 - ) - mobs:register_egg("mobs:bear", "Bear", "wool_brown.png", 1) \ No newline at end of file +local l_spawn_elevation_min = minetest.setting_get("water_level") +if l_spawn_elevation_min then + l_spawn_elevation_min = l_spawn_elevation_min - 10 +else + l_spawn_elevation_min = -10 +end + +mobs:register_spawn("mobs_animal:bear", + {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 4000, 1, 31000, true) + +mobs:register_egg("mobs_animal:bear", "Bear", "wool_brown.png", 1) + +-- compatibility +mobs:alias_mob("mobs:bear", "mobs_animal:bear") \ No newline at end of file diff --git a/games/default/files/mobs/bunny.lua b/games/default/files/mobs_animal/bunny.lua similarity index 81% rename from games/default/files/mobs/bunny.lua rename to games/default/files/mobs_animal/bunny.lua index 980d205b8..298754b19 100644 --- a/games/default/files/mobs/bunny.lua +++ b/games/default/files/mobs_animal/bunny.lua @@ -1,7 +1,7 @@ -- Bunny by ExeterDad -mobs:register_mob("mobs:bunny", { +mobs:register_mob("mobs_animal:bunny", { type = "animal", passive = true, reach = 1, @@ -40,7 +40,7 @@ mobs:register_mob("mobs:bunny", { punch_end = 24, }, follow = {"farming:carrot", "farming_plus:carrot_item"}, - view_range = 10, + view_range = 8, replace_rate = 10, replace_what = {"farming:carrot_7", "farming:carrot_8", "farming_plus:carrot"}, replace_with = "air", @@ -59,8 +59,8 @@ mobs:register_mob("mobs:bunny", { if not minetest.setting_getbool("creative_mode") then item:take_item() clicker:set_wielded_item(item) - end - + end + self.object:set_properties({ textures = {"mobs_bunny_evil.png"}, }) @@ -73,15 +73,15 @@ mobs:register_mob("mobs:bunny", { mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) end, + attack_type = "dogfight", damage = 5, }) +mobs:register_spawn("mobs_animal:bunny", + {"default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 0, 3000, 2, 31000, true) -mobs:spawn_specific("mobs:bunny", - {"default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, - {"air"}, - 0, 20, 0, 4000, 1, 1, 31000 - ) +mobs:register_egg("mobs_animal:bunny", "Bunny", "mobs_bunny_inv.png", 0) -mobs:register_egg("mobs:bunny", "Bunny", "mobs_bunny_inv.png", 0) \ No newline at end of file +-- compatibility +mobs:alias_mob("mobs:bunny", "mobs_animal:bunny") diff --git a/games/default/files/mobs_animal/chicken.lua b/games/default/files/mobs_animal/chicken.lua new file mode 100644 index 000000000..f60691d72 --- /dev/null +++ b/games/default/files/mobs_animal/chicken.lua @@ -0,0 +1,253 @@ + +-- Chicken by JK Murray + +mobs:register_mob("mobs_animal:chicken", { + type = "animal", + passive = true, + hp_min = 3, + hp_max = 6, + armor = 100, + collisionbox = {-0.3, -0.75, -0.3, 0.3, 0.1, 0.3}, + visual = "mesh", + mesh = "mobs_chicken.x", + -- seems a lot of textures but this fixes the problem with the model + textures = { + {"mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", + "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png"}, + }, + child_texture = { + {"mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", + "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png"}, + }, + makes_footstep_sound = true, + sounds = { + random = "mobs_chicken", + }, + walk_velocity = 1, + run_velocity = 3, + runaway = true, + jump = true, + drops = { + {name = "mobs:chicken_raw", chance = 1, min = 1, max = 1}, + }, + water_damage = 1, + lava_damage = 5, + light_damage = 0, + fall_damage = 0, + fall_speed = -8, + fear_height = 5, + animation = { + speed_normal = 15, + stand_start = 0, + stand_end = 1, -- 20 + walk_start = 20, + walk_end = 40, + }, + follow = {"farming:seed_wheat", "farming:seed_cotton"}, + view_range = 5, + + on_rightclick = function(self, clicker) + + if mobs:feed_tame(self, clicker, 8, true, true) then + return + end + + mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) + end, + + do_custom = function(self) + + if not self.child + and math.random(1, 500) == 1 then + + local pos = self.object:getpos() + + minetest.add_item(pos, "mobs:egg") + + minetest.sound_play("default_place_node_hard", { + pos = pos, + gain = 1.0, + max_hear_distance = 5, + }) + end + end, +}) + +mobs:register_spawn("mobs_animal:chicken", + {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 3000, 1, 31000, true) + +mobs:register_egg("mobs_animal:chicken", "Chicken", "mobs_chicken_inv.png", 0) + +-- compatibility +mobs:alias_mob("mobs:chicken", "mobs_animal:chicken") + +-- egg entity + +mobs:register_arrow("mobs_animal:egg_entity", { + visual = "sprite", + visual_size = {x=.5, y=.5}, + textures = {"mobs_chicken_egg.png"}, + velocity = 6, + + hit_player = function(self, player) + player:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = 1}, + }, nil) + end, + + hit_mob = function(self, player) + player:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = 1}, + }, nil) + end, + + hit_node = function(self, pos, node) + + local num = math.random(1, 5) + + if num == 1 then + + pos.y = pos.y + 1 + + local nod = minetest.get_node_or_nil(pos) + + if not nod + or not minetest.registered_nodes[nod.name] + or minetest.registered_nodes[nod.name].walkable == true then + return + end + + local mob = minetest.add_entity(pos, "mobs_animal:chicken") + local ent2 = mob:get_luaentity() + + mob:set_properties({ + textures = ent2.child_texture[1], + visual_size = { + x = ent2.base_size.x / 2, + y = ent2.base_size.y / 2 + }, + collisionbox = { + ent2.base_colbox[1] / 2, + ent2.base_colbox[2] / 2, + ent2.base_colbox[3] / 2, + ent2.base_colbox[4] / 2, + ent2.base_colbox[5] / 2, + ent2.base_colbox[6] / 2 + }, + }) + + ent2.child = true + ent2.tamed = true + ent2.owner = self.playername + end + end +}) + +-- egg throwing item + +local egg_GRAVITY = 9 +local egg_VELOCITY = 19 + +-- shoot egg +local mobs_shoot_egg = function (item, player, pointed_thing) + + local playerpos = player:getpos() + + minetest.sound_play("default_place_node_hard", { + pos = playerpos, + gain = 1.0, + max_hear_distance = 5, + }) + + local obj = minetest.add_entity({ + x = playerpos.x, + y = playerpos.y +1.5, + z = playerpos.z + }, "mobs_animal:egg_entity") + + local ent = obj:get_luaentity() + local dir = player:get_look_dir() + + ent.velocity = egg_VELOCITY -- needed for api internal timing + ent.switch = 1 -- needed so that egg doesn't despawn straight away + + obj:setvelocity({ + x = dir.x * egg_VELOCITY, + y = dir.y * egg_VELOCITY, + z = dir.z * egg_VELOCITY + }) + + obj:setacceleration({ + x = dir.x * -3, + y = -egg_GRAVITY, + z = dir.z * -3 + }) + + -- pass player name to egg for chick ownership + local ent2 = obj:get_luaentity() + ent2.playername = player:get_player_name() + + item:take_item() + + return item +end + +-- egg +minetest.register_node(":mobs:egg", { + description = "Chicken Egg", + tiles = {"mobs_chicken_egg.png"}, + inventory_image = "mobs_chicken_egg.png", + visual_scale = 0.7, + drawtype = "plantlike", + wield_image = "mobs_chicken_egg.png", + paramtype = "light", + walkable = false, + is_ground_content = true, + sunlight_propagates = true, + selection_box = { + type = "fixed", + fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2} + }, + groups = {snappy = 2, dig_immediate = 3}, + after_place_node = function(pos, placer, itemstack) + if placer:is_player() then + minetest.set_node(pos, {name = "mobs:egg", param2 = 1}) + end + end, + on_use = mobs_shoot_egg +}) + +-- fried egg +minetest.register_craftitem(":mobs:chicken_egg_fried", { +description = "Fried Egg", + inventory_image = "mobs_chicken_egg_fried.png", + on_use = minetest.item_eat(2), +}) + +minetest.register_craft({ + type = "cooking", + recipe = "mobs:egg", + output = "mobs:chicken_egg_fried", +}) + +-- raw chicken +minetest.register_craftitem(":mobs:chicken_raw", { +description = "Raw Chicken", + inventory_image = "mobs_chicken_raw.png", + on_use = minetest.item_eat(2), +}) + +-- cooked chicken +minetest.register_craftitem(":mobs:chicken_cooked", { +description = "Cooked Chicken", + inventory_image = "mobs_chicken_cooked.png", + on_use = minetest.item_eat(6), +}) + +minetest.register_craft({ + type = "cooking", + recipe = "mobs:chicken_raw", + output = "mobs:chicken_cooked", +}) diff --git a/games/default/files/mobs/cow.lua b/games/default/files/mobs_animal/cow.lua similarity index 76% rename from games/default/files/mobs/cow.lua rename to games/default/files/mobs_animal/cow.lua index 8a23666b7..43e0f17ac 100644 --- a/games/default/files/mobs/cow.lua +++ b/games/default/files/mobs_animal/cow.lua @@ -1,18 +1,21 @@ --- Cow by Krupnovpavel -mobs:register_mob("mobs:cow", { + +-- Cow by Krupnopavel (additional texture by JurajVajda) + +mobs:register_mob("mobs_animal:cow", { type = "animal", passive = false, attack_type = "dogfight", reach = 2, - damage = 4, - hp_min = 10, - hp_max = 15, + damage = 2, + hp_min = 8, + hp_max = 12, armor = 100, collisionbox = {-0.8, -0.01, -0.8, 0.8, 1.3, 0.8}, visual = "mesh", mesh = "mobs_cow.x", textures = { {"mobs_cow.png"}, + {"mobs_cow2.png"}, }, makes_footstep_sound = true, sounds = { @@ -22,10 +25,8 @@ mobs:register_mob("mobs:cow", { run_velocity = 2, jump = true, drops = { - {name = "mobs:meat_raw", - chance = 1, min = 1, max = 3}, - {name = "mobs:leather", - chance = 1, min = 0, max = 2}, + {name = "mobs:meat_raw", chance = 1, min = 1, max = 3}, + {name = "mobs:leather", chance = 1, min = 0, max = 2}, }, water_damage = 1, lava_damage = 5, @@ -45,7 +46,7 @@ mobs:register_mob("mobs:cow", { follow = "farming:wheat", view_range = 7, replace_rate = 10, - replace_what = {"farming:wheat_8"}, + replace_what = {"default:grass_3", "default:grass_4", "default:grass_5", "farming:wheat_8"}, replace_with = "air", fear_height = 2, on_rightclick = function(self, clicker) @@ -92,16 +93,16 @@ mobs:register_mob("mobs:cow", { end, }) -mobs:spawn_specific("mobs:cow", - {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, - {"air"}, - 5, 20, 0, 6000, 1, 1, 31000 - ) +mobs:register_spawn("mobs_animal:cow", + {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 4000, 1, 31000, true) -mobs:register_egg("mobs:cow", "Cow", "default_grass.png", 1) +mobs:register_egg("mobs_animal:cow", "Cow", "default_grass.png", 1) + +-- compatibility +mobs:alias_mob("mobs:cow", "mobs_animal:cow") -- bucket of milk -minetest.register_craftitem("mobs:bucket_milk", { +minetest.register_craftitem(":mobs:bucket_milk", { description = "Bucket of Milk", inventory_image = "mobs_bucket_milk.png", stack_max = 1, @@ -109,7 +110,7 @@ minetest.register_craftitem("mobs:bucket_milk", { }) -- cheese wedge -minetest.register_craftitem("mobs:cheese", { +minetest.register_craftitem(":mobs:cheese", { description = "Cheese", inventory_image = "mobs_cheese.png", on_use = minetest.item_eat(4), @@ -124,7 +125,7 @@ minetest.register_craft({ }) -- cheese block -minetest.register_node("mobs:cheeseblock", { +minetest.register_node(":mobs:cheeseblock", { description = "Cheese Block", tiles = {"mobs_cheeseblock.png"}, is_ground_content = false, @@ -146,4 +147,4 @@ minetest.register_craft({ recipe = { {'mobs:cheeseblock'}, } -}) \ No newline at end of file +}) diff --git a/games/default/files/mobs_animal/depends.txt b/games/default/files/mobs_animal/depends.txt new file mode 100644 index 000000000..cc0339808 --- /dev/null +++ b/games/default/files/mobs_animal/depends.txt @@ -0,0 +1,2 @@ +default +mobs diff --git a/games/default/files/mobs/dog.lua b/games/default/files/mobs_animal/dog.lua similarity index 61% rename from games/default/files/mobs/dog.lua rename to games/default/files/mobs_animal/dog.lua index cffa2454a..e63880838 100644 --- a/games/default/files/mobs/dog.lua +++ b/games/default/files/mobs_animal/dog.lua @@ -1,8 +1,6 @@ -if mobs.mod and mobs.mod == "redo" then - -- wolf - mobs:register_mob("mobs:wolf", { +mobs:register_mob("mobs_animal:wolf", { type = "animal", visual = "mesh", mesh = "mobs_wolf.x", @@ -11,18 +9,18 @@ if mobs.mod and mobs.mod == "redo" then }, collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4}, animation = { - speed_normal = 20, speed_run = 30, - stand_start = 10, stand_end = 20, - walk_start = 75, walk_end = 100, - run_start = 100, run_end = 130, - punch_start = 135, punch_end = 155 + speed_normal = 20, speed_run = 30, + stand_start = 10, stand_end = 20, + walk_start = 75, walk_end = 100, + run_start = 100, run_end = 130, + punch_start = 135, punch_end = 155 }, makes_footstep_sound = true, sounds = { war_cry = "mobs_wolf_attack" }, reach = 2, - hp_min = 6, + hp_min = 8, hp_max = 10, armor = 100, lava_damage = 5, @@ -36,10 +34,10 @@ if mobs.mod and mobs.mod == "redo" then run_velocity = 3, stepheight = 1.1, follow = "mobs:meat_raw", - on_rightclick = function(self, clicker) + on_rightclick = function (self, clicker) if mobs:feed_tame(self, clicker, 2, false) then if self.food == 0 then - local mob = minetest.add_entity(self.object:getpos(), "mobs:dog") + local mob = minetest.add_entity(self.object:getpos(), "mobs_animal:dog") local ent = mob:get_luaentity() ent.owner = clicker:get_player_name() ent.following = clicker @@ -52,22 +50,20 @@ if mobs.mod and mobs.mod == "redo" then end }) - local l_spawn_elevation_min = minetest.setting_get("water_level") - if l_spawn_elevation_min then - l_spawn_elevation_min = l_spawn_elevation_min - 5 - else - l_spawn_elevation_min = -5 - end - --name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height - mobs:spawn_specific("mobs:wolf", - {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, - {"air"}, - 0, 20, 0, 6000, 1, 1, 31000 - ) - mobs:register_egg("mobs:wolf", "Wolf", "wool_grey.png", 1) +local l_spawn_elevation_min = minetest.setting_get("water_level") +if l_spawn_elevation_min then + l_spawn_elevation_min = l_spawn_elevation_min - 5 +else + l_spawn_elevation_min = -5 +end + +mobs:register_spawn("mobs_animal:wolf", + {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 0, 4000, 1, 31000, true) + +mobs:register_egg("mobs_animal:wolf", "Wolf", "wool_grey.png", 1) -- Dog - mobs:register_mob("mobs:dog", { +mobs:register_mob("mobs_animal:dog", { type = "npc", visual = "mesh", mesh = "mobs_wolf.x", @@ -76,11 +72,11 @@ if mobs.mod and mobs.mod == "redo" then }, collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4}, animation = { - speed_normal = 20, speed_run = 30, - stand_start = 10, stand_end = 20, - walk_start = 75, walk_end = 100, - run_start = 100, run_end = 130, - punch_start = 135, punch_end = 155 + speed_normal = 20, speed_run = 30, + stand_start = 10, stand_end = 20, + walk_start = 75, walk_end = 100, + run_start = 100, run_end = 130, + punch_start = 135, punch_end = 155 }, makes_footstep_sound = true, sounds = { @@ -100,8 +96,8 @@ if mobs.mod and mobs.mod == "redo" then walk_velocity = 2, run_velocity = 4, stepheight = 1.1, - follow = "mobs:raw_meat", - on_rightclick = function(self, clicker) + follow = "mobs_animal:raw_meat", + on_rightclick = function (self, clicker) if mobs:feed_tame(self, clicker, 6, true) then return end @@ -124,6 +120,8 @@ if mobs.mod and mobs.mod == "redo" then end }) - mobs:register_egg("mobs:dog", "Dog", "wool_brown.png", 1) +mobs:register_egg("mobs_animal:dog", "Dog", "wool_brown.png", 1) -end \ No newline at end of file +-- compatibility +mobs:alias_mob("mobs:wolf", "mobs_animal:wolf") +mobs:alias_mob("mobs:dog", "mobs_animal:dog") \ No newline at end of file diff --git a/games/default/files/mobs_animal/init.lua b/games/default/files/mobs_animal/init.lua new file mode 100644 index 000000000..d3af2341e --- /dev/null +++ b/games/default/files/mobs_animal/init.lua @@ -0,0 +1,17 @@ + +local path = minetest.get_modpath("mobs_animal") + +-- Animals + +dofile(path .. "/chicken.lua") -- JKmurray +dofile(path .. "/cow.lua") -- KrupnoPavel +dofile(path .. "/sheep.lua") -- PilzAdam +dofile(path .. "/bunny.lua") -- ExeterDad +dofile(path .. "/kitten.lua") -- Jordach/BFD +dofile(path .. "/dog.lua") -- KrupnoPavel +dofile(path .. "/pig.lua") -- KrupnoPavel +dofile(path .. "/bear.lua") -- KrupnoPavel + +-- Removed +dofile(path .. "/rat.lua") -- Jordach/BFD + diff --git a/games/default/files/mobs/kitten.lua b/games/default/files/mobs_animal/kitten.lua similarity index 62% rename from games/default/files/mobs/kitten.lua rename to games/default/files/mobs_animal/kitten.lua index c3e54720f..fcb5121fe 100644 --- a/games/default/files/mobs/kitten.lua +++ b/games/default/files/mobs_animal/kitten.lua @@ -1,11 +1,10 @@ -- Kitten by Jordach / BFD -mobs:register_mob("mobs:kitten", { +mobs:register_mob("mobs_animal:kitten", { type = "animal", passive = true, - reach = 2, - hp_min = 5, + hp_min = 8, hp_max = 10, armor = 100, collisionbox = {-0.3, -0.3, -0.3, 0.3, 0.1, 0.3}, @@ -26,10 +25,9 @@ mobs:register_mob("mobs:kitten", { run_velocity = 2, runaway = true, jump = false, - drops = { - {name = "farming:string", - chance = 1, min = 1, max = 1}, - }, + --drops = { + -- {name = "farming:string", chance = 1, min = 1, max = 1}, + --}, water_damage = 1, lava_damage = 5, fear_height = 3, @@ -40,22 +38,22 @@ mobs:register_mob("mobs:kitten", { walk_start = 0, walk_end = 96, }, - follow = {"mobs:rat"}, + follow = {"mobs:rat", "default:fish_raw"}, view_range = 8, on_rightclick = function(self, clicker) - + if mobs:feed_tame(self, clicker, 4, true, true) then return end - + mobs:capture_mob(self, clicker, 50, 50, 90, false, nil) end }) - --name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height - mobs:spawn_specific("mobs:kitten", - {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, - {"air"}, - 5, 20, 0, 5000, 1, 1, 31000 - ) -mobs:register_egg("mobs:kitten", "Kitten", "mobs_kitten_inv.png", 0) \ No newline at end of file +mobs:register_spawn("mobs_animal:kitten", + {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 5000, 1, 31000, true) + +mobs:register_egg("mobs_animal:kitten", "Kitten", "mobs_kitten_inv.png", 0) + +-- compatibility +mobs:alias_mob("mobs:kitten", "mobs_animal:kitten") diff --git a/games/default/files/mobs/models/mobs_bear.x b/games/default/files/mobs_animal/models/mobs_bear.x similarity index 100% rename from games/default/files/mobs/models/mobs_bear.x rename to games/default/files/mobs_animal/models/mobs_bear.x diff --git a/games/default/files/mobs/models/mobs_bunny.b3d b/games/default/files/mobs_animal/models/mobs_bunny.b3d similarity index 100% rename from games/default/files/mobs/models/mobs_bunny.b3d rename to games/default/files/mobs_animal/models/mobs_bunny.b3d diff --git a/games/default/files/mobs/models/mobs_chicken.x b/games/default/files/mobs_animal/models/mobs_chicken.x similarity index 100% rename from games/default/files/mobs/models/mobs_chicken.x rename to games/default/files/mobs_animal/models/mobs_chicken.x diff --git a/games/default/files/mobs/models/mobs_cow.x b/games/default/files/mobs_animal/models/mobs_cow.x similarity index 100% rename from games/default/files/mobs/models/mobs_cow.x rename to games/default/files/mobs_animal/models/mobs_cow.x diff --git a/games/default/files/mobs/models/mobs_kitten.b3d b/games/default/files/mobs_animal/models/mobs_kitten.b3d similarity index 100% rename from games/default/files/mobs/models/mobs_kitten.b3d rename to games/default/files/mobs_animal/models/mobs_kitten.b3d diff --git a/games/default/files/mobs/models/mobs_pig.x b/games/default/files/mobs_animal/models/mobs_pig.x similarity index 100% rename from games/default/files/mobs/models/mobs_pig.x rename to games/default/files/mobs_animal/models/mobs_pig.x diff --git a/games/default/files/mobs/models/mobs_sheep.b3d b/games/default/files/mobs_animal/models/mobs_sheep.b3d similarity index 100% rename from games/default/files/mobs/models/mobs_sheep.b3d rename to games/default/files/mobs_animal/models/mobs_sheep.b3d diff --git a/games/default/files/mobs/models/mobs_sheep_shaved.b3d b/games/default/files/mobs_animal/models/mobs_sheep_shaved.b3d similarity index 100% rename from games/default/files/mobs/models/mobs_sheep_shaved.b3d rename to games/default/files/mobs_animal/models/mobs_sheep_shaved.b3d diff --git a/games/default/files/mobs/models/mobs_wolf.x b/games/default/files/mobs_animal/models/mobs_wolf.x similarity index 100% rename from games/default/files/mobs/models/mobs_wolf.x rename to games/default/files/mobs_animal/models/mobs_wolf.x diff --git a/games/default/files/mobs_animal/pig.lua b/games/default/files/mobs_animal/pig.lua new file mode 100644 index 000000000..4a061723f --- /dev/null +++ b/games/default/files/mobs_animal/pig.lua @@ -0,0 +1,63 @@ +-- Warthog(Boar) by KrupnoPavel (MIT) +-- Changed to Boar and tweaked by Kaadmy (WTFPL) and MoNTE48 (LGPLv3) +mobs:register_mob("mobs_animal:pig", { + type = "animal", + passive = false, + attack_type = "dogfight", + group_attack = true, + reach = 2, + damage = 2, + hp_min = 5, + hp_max = 15, + armor = 100, + collisionbox = {-0.4, -1, -0.4, 0.4, 0.1, 0.4}, + visual = "mesh", + mesh = "mobs_pig.x", + textures = { + {"mobs_pig.png"}, + }, + makes_footstep_sound = true, + sounds = { + random = "mobs_pig", + attack = "mobs_pig_angry", + }, + walk_velocity = 2, + run_velocity = 3, + jump = true, + follow = {"default:apple", "farming:potato"}, + view_range = 5, + drops = { + {name = "mobs:pork_raw", + chance = 1, min = 1, max = 1}, + {name = "mobs:pork_raw", + chance = 2, min = 1, max = 1}, + {name = "mobs:pork_raw", + chance = 2, min = 1, max = 1}, + }, + water_damage = 1, + lava_damage = 5, + light_damage = 0, + fear_height = 2, + animation = { + speed_normal = 20, + stand_start = 0, + stand_end = 60, + walk_start = 61, + walk_end = 80, + punch_start = 90, + punch_end = 110, + }, + on_rightclick = function (self, clicker) + mobs:feed_tame(self, clicker, 8, true, true) + mobs:capture_mob(self, clicker, 0, 5, 50, false, nil) + end, + }) + +mobs:register_spawn("mobs_animal:pig", + {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 4000, 1, 31000, true) + + +mobs:register_egg("mobs_animal:pig", "Pig", "wool_pink.png", 1) + +-- compatibility +mobs:alias_mob("mobs:pig", "mobs_animal:pig") \ No newline at end of file diff --git a/games/default/files/mobs_animal/rat.lua b/games/default/files/mobs_animal/rat.lua new file mode 100644 index 000000000..9f73cd146 --- /dev/null +++ b/games/default/files/mobs_animal/rat.lua @@ -0,0 +1,8 @@ +mobs:register_mob("mobs_animal:rat", { + lifetimer = 1, + }) + +-- compatibility +mobs:alias_mob("mobs:rat", "mobs_animal:rat") +mobs:alias_mob("mobs:rat_meat", "mobs:meat_raw") +mobs:alias_mob("mobs:rat_cooked", "mobs:meat") \ No newline at end of file diff --git a/games/default/files/mobs_animal/readme.md b/games/default/files/mobs_animal/readme.md new file mode 100644 index 000000000..f91de5579 --- /dev/null +++ b/games/default/files/mobs_animal/readme.md @@ -0,0 +1,36 @@ + +ANIMAL MOBS + +Bee + +- Tends to buzz around flowers and gives honey when killed, you can also right-click a bee to pick it up and place in inventory. 3x bee's in a row can craft a beehive. + +Bunny + +- Bunnies appear in green grass areas (prairie biome in ethereal) and can be tamed with 4 carrots. Can also be picked up and placed in inventory and gives 1-2 meat when killed. + +Chicken + +- Found in green areas (bamboo biome in ethereal) and lays eggs on flat ground, Can be picked up and placed in inventory and gives 1-2 raw chicken when killed. Feed 8x wheat seed to breed. + +Cow + +- Wanders around eating grass/wheat and can be right-clicked with empty bucket to get milk. Cows will defend themselves when hit and can be right-clicked with 8x wheat to tame and breed. + +Kitten + +- Found on green grass these cute cats walk around and can be picked up and placed in inventory as pets or right-clicked with 4x raw fish (found in ethereal) and tamed. + +Rat + +- Typically found around stone they can be picked up and cooked for eating. + +Sheep + +- Green grass and wheat munchers that can be clipped using shears to give 1-3 wool. Feed sheep 8x wheat to regrow wool, tame and breed. Will drop 1-3 meat when killed. + +Warthog + +- Warthogs unlike pigs defend themselves when hit and give 1-3 raw pork when killed, they can also be right-clicked with 8x apples to tame or breed. + +Note: After breeding animals need to rest for 4 minutes, baby animals take 4 minutes to grow up and feeding them helps them grow quicker... diff --git a/games/default/files/mobs_animal/sheep.lua b/games/default/files/mobs_animal/sheep.lua new file mode 100644 index 000000000..1879cbc0d --- /dev/null +++ b/games/default/files/mobs_animal/sheep.lua @@ -0,0 +1,196 @@ + +local all_colours = { + {"black", "Black" }, + {"blue", "Blue" }, + {"brown", "Brown" }, + {"cyan", "Cyan" }, + {"dark_green", "Dark Green"}, + {"dark_grey", "Dark Grey" }, + {"green", "Green" }, + {"grey", "Grey" }, + {"magenta", "Magenta" }, + {"orange", "Orange" }, + {"pink", "Pink" }, + {"red", "Red" }, + {"violet", "Violet" }, + {"white", "White" }, + {"yellow", "Yellow" }, +} + +-- Sheep by PilzAdam + +for _, col in pairs(all_colours) do + + mobs:register_mob("mobs_animal:sheep_"..col[1], { + type = "animal", + passive = true, + hp_min = 6, + hp_max = 10, + armor = 100, + collisionbox = {-0.4, -1, -0.4, 0.4, 0.3, 0.4}, + visual = "mesh", + mesh = "mobs_sheep.b3d", + textures = { + {"mobs_sheep_" .. col[1] .. ".png"}, + }, + gotten_texture = {"mobs_sheep_shaved.png"}, + gotten_mesh = "mobs_sheep_shaved.b3d", + makes_footstep_sound = true, + sounds = { + random = "mobs_sheep", + damage = "mobs_sheep_angry", + }, + walk_velocity = 1, + run_velocity = 2, + runaway = true, + jump = true, + drops = { + {name = "mobs:meat_raw", chance = 1, min = 1, max = 2}, + {name = "wool:"..col[1], chance = 1, min = 1, max = 1}, + }, + water_damage = 1, + lava_damage = 5, + light_damage = 0, + animation = { + speed_normal = 15, + speed_run = 15, + stand_start = 0, + stand_end = 80, + walk_start = 81, + walk_end = 100, + }, + follow = {"farming:wheat", "default:grass_5"}, + view_range = 8, + replace_rate = 10, + replace_what = {"default:grass_3", "default:grass_4", "default:grass_5", "farming:wheat_8"}, + replace_with = "air", + replace_offset = -1, + fear_height = 3, + + on_rightclick = function(self, clicker) + + --are we feeding? + if mobs:feed_tame(self, clicker, 8, true, true) then + + --if full grow fuzz + if self.gotten == false then + + self.object:set_properties({ + textures = {"mobs_sheep_"..col[1]..".png"}, + mesh = "mobs_sheep.b3d", + }) + end + + return + end + + local item = clicker:get_wielded_item() + local itemname = item:get_name() + + --are we giving a haircut> + if itemname == "mobs:shears" then + + if self.gotten ~= false + and self.child ~= false + and not minetest.get_modpath("wool") then + return + end + + self.gotten = true -- shaved + + local obj = minetest.add_item( + self.object:getpos(), + ItemStack( "wool:" .. col[1] .. " " .. math.random(1, 3) ) + ) + + if obj then + + obj:setvelocity({ + x = math.random(-1, 1), + y = 5, + z = math.random(-1, 1) + }) + end + + item:add_wear(650) -- 100 uses + + clicker:set_wielded_item(item) + + self.object:set_properties({ + textures = {"mobs_sheep_shaved.png"}, + mesh = "mobs_sheep_shaved.b3d", + }) + + return + end + + local name = clicker:get_player_name() + + --are we coloring? + if itemname:find("dye:") then + + if self.gotten == false + and self.child == false + and self.tamed == true + and name == self.owner then + + local colr = string.split(itemname, ":")[2] + + for _,c in pairs(all_colours) do + + if c[1] == colr then + + local pos = self.object:getpos() + + self.object:remove() + + local mob = minetest.add_entity(pos, "mobs_animal:sheep_" .. colr) + local ent = mob:get_luaentity() + + ent.owner = name + ent.tamed = true + + -- take item + if not minetest.setting_getbool("creative_mode") then + item:take_item() + clicker:set_wielded_item(item) + end + + break + end + end + end + + return + end + + --are we capturing? + mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) + end + }) + + mobs:register_egg("mobs_animal:sheep_"..col[1], col[2] .. " Sheep", "wool_"..col[1]..".png", 1) + + -- compatibility + mobs:alias_mob("mobs:sheep_" .. col[1], "mobs_animal:sheep_" .. col[1]) + +end + +mobs:register_spawn("mobs_animal:sheep_white", + {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 12000, 1, 31000, true) + +mobs:register_spawn("mobs_animal:sheep_grey", + {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 12000, 1, 31000, true) + +mobs:register_spawn("mobs_animal:sheep_dark_grey", + {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 12000, 1, 31000, true) + +mobs:register_spawn("mobs_animal:sheep_black", + {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 12000, 1, 31000, true) + +mobs:register_spawn("mobs_animal:sheep_brown", + {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 12000, 1, 31000, true) + + +-- compatibility +mobs:alias_mob("mobs:sheep", "mobs_animal:sheep_white") diff --git a/games/default/files/mobs/sounds/mobs_bear.ogg b/games/default/files/mobs_animal/sounds/mobs_bear.ogg similarity index 100% rename from games/default/files/mobs/sounds/mobs_bear.ogg rename to games/default/files/mobs_animal/sounds/mobs_bear.ogg diff --git a/games/default/files/mobs/sounds/mobs_bear_angry.ogg b/games/default/files/mobs_animal/sounds/mobs_bear_angry.ogg similarity index 100% rename from games/default/files/mobs/sounds/mobs_bear_angry.ogg rename to games/default/files/mobs_animal/sounds/mobs_bear_angry.ogg diff --git a/games/default/files/mobs/sounds/mobs_chicken.ogg b/games/default/files/mobs_animal/sounds/mobs_chicken.ogg similarity index 100% rename from games/default/files/mobs/sounds/mobs_chicken.ogg rename to games/default/files/mobs_animal/sounds/mobs_chicken.ogg diff --git a/games/default/files/mobs/sounds/mobs_cow.ogg b/games/default/files/mobs_animal/sounds/mobs_cow.ogg similarity index 100% rename from games/default/files/mobs/sounds/mobs_cow.ogg rename to games/default/files/mobs_animal/sounds/mobs_cow.ogg diff --git a/games/default/files/mobs/sounds/mobs_kitten.ogg b/games/default/files/mobs_animal/sounds/mobs_kitten.ogg similarity index 100% rename from games/default/files/mobs/sounds/mobs_kitten.ogg rename to games/default/files/mobs_animal/sounds/mobs_kitten.ogg diff --git a/games/default/files/mobs/sounds/mobs_pig.ogg b/games/default/files/mobs_animal/sounds/mobs_pig.ogg similarity index 100% rename from games/default/files/mobs/sounds/mobs_pig.ogg rename to games/default/files/mobs_animal/sounds/mobs_pig.ogg diff --git a/games/default/files/mobs/sounds/mobs_pig_angry.ogg b/games/default/files/mobs_animal/sounds/mobs_pig_angry.ogg similarity index 100% rename from games/default/files/mobs/sounds/mobs_pig_angry.ogg rename to games/default/files/mobs_animal/sounds/mobs_pig_angry.ogg diff --git a/games/default/files/mobs/sounds/mobs_sheep.ogg b/games/default/files/mobs_animal/sounds/mobs_sheep.ogg similarity index 100% rename from games/default/files/mobs/sounds/mobs_sheep.ogg rename to games/default/files/mobs_animal/sounds/mobs_sheep.ogg diff --git a/games/default/files/mobs/sounds/mobs_sheep_angry.ogg b/games/default/files/mobs_animal/sounds/mobs_sheep_angry.ogg similarity index 100% rename from games/default/files/mobs/sounds/mobs_sheep_angry.ogg rename to games/default/files/mobs_animal/sounds/mobs_sheep_angry.ogg diff --git a/games/default/files/mobs_animal/textures/mobs_bear.png b/games/default/files/mobs_animal/textures/mobs_bear.png new file mode 100644 index 000000000..a9a8f26c4 Binary files /dev/null and b/games/default/files/mobs_animal/textures/mobs_bear.png differ diff --git a/games/default/files/mobs/textures/mobs_bucket_milk.png b/games/default/files/mobs_animal/textures/mobs_bucket_milk.png similarity index 100% rename from games/default/files/mobs/textures/mobs_bucket_milk.png rename to games/default/files/mobs_animal/textures/mobs_bucket_milk.png diff --git a/games/default/files/mobs_animal/textures/mobs_bunny_brown.png b/games/default/files/mobs_animal/textures/mobs_bunny_brown.png new file mode 100644 index 000000000..45a35b672 Binary files /dev/null and b/games/default/files/mobs_animal/textures/mobs_bunny_brown.png differ diff --git a/games/default/files/mobs/textures/mobs_bunny_evil.png b/games/default/files/mobs_animal/textures/mobs_bunny_evil.png similarity index 100% rename from games/default/files/mobs/textures/mobs_bunny_evil.png rename to games/default/files/mobs_animal/textures/mobs_bunny_evil.png diff --git a/games/default/files/mobs_animal/textures/mobs_bunny_grey.png b/games/default/files/mobs_animal/textures/mobs_bunny_grey.png new file mode 100644 index 000000000..d37d02102 Binary files /dev/null and b/games/default/files/mobs_animal/textures/mobs_bunny_grey.png differ diff --git a/games/default/files/mobs/textures/mobs_bunny_inv.png b/games/default/files/mobs_animal/textures/mobs_bunny_inv.png similarity index 100% rename from games/default/files/mobs/textures/mobs_bunny_inv.png rename to games/default/files/mobs_animal/textures/mobs_bunny_inv.png diff --git a/games/default/files/mobs_animal/textures/mobs_bunny_white.png b/games/default/files/mobs_animal/textures/mobs_bunny_white.png new file mode 100644 index 000000000..0be9d9078 Binary files /dev/null and b/games/default/files/mobs_animal/textures/mobs_bunny_white.png differ diff --git a/games/default/files/mobs/textures/mobs_cheese.png b/games/default/files/mobs_animal/textures/mobs_cheese.png similarity index 100% rename from games/default/files/mobs/textures/mobs_cheese.png rename to games/default/files/mobs_animal/textures/mobs_cheese.png diff --git a/games/default/files/mobs/textures/mobs_cheeseblock.png b/games/default/files/mobs_animal/textures/mobs_cheeseblock.png similarity index 100% rename from games/default/files/mobs/textures/mobs_cheeseblock.png rename to games/default/files/mobs_animal/textures/mobs_cheeseblock.png diff --git a/games/default/files/mobs_animal/textures/mobs_chicken.png b/games/default/files/mobs_animal/textures/mobs_chicken.png new file mode 100644 index 000000000..d32206af2 Binary files /dev/null and b/games/default/files/mobs_animal/textures/mobs_chicken.png differ diff --git a/games/default/files/mobs_animal/textures/mobs_chicken_black.png b/games/default/files/mobs_animal/textures/mobs_chicken_black.png new file mode 100644 index 000000000..d32206af2 Binary files /dev/null and b/games/default/files/mobs_animal/textures/mobs_chicken_black.png differ diff --git a/games/default/files/mobs/textures/mobs_chicken_cooked.png b/games/default/files/mobs_animal/textures/mobs_chicken_cooked.png similarity index 100% rename from games/default/files/mobs/textures/mobs_chicken_cooked.png rename to games/default/files/mobs_animal/textures/mobs_chicken_cooked.png diff --git a/games/default/files/mobs/textures/mobs_chicken_egg.png b/games/default/files/mobs_animal/textures/mobs_chicken_egg.png similarity index 100% rename from games/default/files/mobs/textures/mobs_chicken_egg.png rename to games/default/files/mobs_animal/textures/mobs_chicken_egg.png diff --git a/games/default/files/mobs/textures/mobs_chicken_egg_fried.png b/games/default/files/mobs_animal/textures/mobs_chicken_egg_fried.png similarity index 100% rename from games/default/files/mobs/textures/mobs_chicken_egg_fried.png rename to games/default/files/mobs_animal/textures/mobs_chicken_egg_fried.png diff --git a/games/default/files/mobs/textures/mobs_chicken_inv.png b/games/default/files/mobs_animal/textures/mobs_chicken_inv.png similarity index 100% rename from games/default/files/mobs/textures/mobs_chicken_inv.png rename to games/default/files/mobs_animal/textures/mobs_chicken_inv.png diff --git a/games/default/files/mobs/textures/mobs_chicken_raw.png b/games/default/files/mobs_animal/textures/mobs_chicken_raw.png similarity index 100% rename from games/default/files/mobs/textures/mobs_chicken_raw.png rename to games/default/files/mobs_animal/textures/mobs_chicken_raw.png diff --git a/games/default/files/mobs/textures/mobs_cow.png b/games/default/files/mobs_animal/textures/mobs_cow.png similarity index 100% rename from games/default/files/mobs/textures/mobs_cow.png rename to games/default/files/mobs_animal/textures/mobs_cow.png diff --git a/games/default/files/mobs_animal/textures/mobs_cow2.png b/games/default/files/mobs_animal/textures/mobs_cow2.png new file mode 100644 index 000000000..8952befaf Binary files /dev/null and b/games/default/files/mobs_animal/textures/mobs_cow2.png differ diff --git a/games/default/files/mobs_animal/textures/mobs_dog.png b/games/default/files/mobs_animal/textures/mobs_dog.png new file mode 100644 index 000000000..fee015b27 Binary files /dev/null and b/games/default/files/mobs_animal/textures/mobs_dog.png differ diff --git a/games/default/files/mobs/textures/mobs_kitten_ginger.png b/games/default/files/mobs_animal/textures/mobs_kitten_ginger.png similarity index 100% rename from games/default/files/mobs/textures/mobs_kitten_ginger.png rename to games/default/files/mobs_animal/textures/mobs_kitten_ginger.png diff --git a/games/default/files/mobs/textures/mobs_kitten_inv.png b/games/default/files/mobs_animal/textures/mobs_kitten_inv.png similarity index 100% rename from games/default/files/mobs/textures/mobs_kitten_inv.png rename to games/default/files/mobs_animal/textures/mobs_kitten_inv.png diff --git a/games/default/files/mobs/textures/mobs_kitten_sandy.png b/games/default/files/mobs_animal/textures/mobs_kitten_sandy.png similarity index 100% rename from games/default/files/mobs/textures/mobs_kitten_sandy.png rename to games/default/files/mobs_animal/textures/mobs_kitten_sandy.png diff --git a/games/default/files/mobs/textures/mobs_kitten_splotchy.png b/games/default/files/mobs_animal/textures/mobs_kitten_splotchy.png similarity index 100% rename from games/default/files/mobs/textures/mobs_kitten_splotchy.png rename to games/default/files/mobs_animal/textures/mobs_kitten_splotchy.png diff --git a/games/default/files/mobs/textures/mobs_kitten_striped.png b/games/default/files/mobs_animal/textures/mobs_kitten_striped.png similarity index 100% rename from games/default/files/mobs/textures/mobs_kitten_striped.png rename to games/default/files/mobs_animal/textures/mobs_kitten_striped.png diff --git a/games/default/files/mobs/textures/mobs_pig.png b/games/default/files/mobs_animal/textures/mobs_pig.png similarity index 100% rename from games/default/files/mobs/textures/mobs_pig.png rename to games/default/files/mobs_animal/textures/mobs_pig.png diff --git a/games/default/files/mobs/textures/mobs_pork_cooked.png b/games/default/files/mobs_animal/textures/mobs_pork_cooked.png similarity index 100% rename from games/default/files/mobs/textures/mobs_pork_cooked.png rename to games/default/files/mobs_animal/textures/mobs_pork_cooked.png diff --git a/games/default/files/mobs/textures/mobs_pork_raw.png b/games/default/files/mobs_animal/textures/mobs_pork_raw.png similarity index 100% rename from games/default/files/mobs/textures/mobs_pork_raw.png rename to games/default/files/mobs_animal/textures/mobs_pork_raw.png diff --git a/games/default/files/mobs/textures/mobs_sheep_black.png b/games/default/files/mobs_animal/textures/mobs_sheep_black.png similarity index 100% rename from games/default/files/mobs/textures/mobs_sheep_black.png rename to games/default/files/mobs_animal/textures/mobs_sheep_black.png diff --git a/games/default/files/mobs/textures/mobs_sheep_blue.png b/games/default/files/mobs_animal/textures/mobs_sheep_blue.png similarity index 100% rename from games/default/files/mobs/textures/mobs_sheep_blue.png rename to games/default/files/mobs_animal/textures/mobs_sheep_blue.png diff --git a/games/default/files/mobs/textures/mobs_sheep_brown.png b/games/default/files/mobs_animal/textures/mobs_sheep_brown.png similarity index 100% rename from games/default/files/mobs/textures/mobs_sheep_brown.png rename to games/default/files/mobs_animal/textures/mobs_sheep_brown.png diff --git a/games/default/files/mobs/textures/mobs_sheep_cyan.png b/games/default/files/mobs_animal/textures/mobs_sheep_cyan.png similarity index 100% rename from games/default/files/mobs/textures/mobs_sheep_cyan.png rename to games/default/files/mobs_animal/textures/mobs_sheep_cyan.png diff --git a/games/default/files/mobs/textures/mobs_sheep_dark_green.png b/games/default/files/mobs_animal/textures/mobs_sheep_dark_green.png similarity index 100% rename from games/default/files/mobs/textures/mobs_sheep_dark_green.png rename to games/default/files/mobs_animal/textures/mobs_sheep_dark_green.png diff --git a/games/default/files/mobs/textures/mobs_sheep_dark_grey.png b/games/default/files/mobs_animal/textures/mobs_sheep_dark_grey.png similarity index 100% rename from games/default/files/mobs/textures/mobs_sheep_dark_grey.png rename to games/default/files/mobs_animal/textures/mobs_sheep_dark_grey.png diff --git a/games/default/files/mobs/textures/mobs_sheep_green.png b/games/default/files/mobs_animal/textures/mobs_sheep_green.png similarity index 100% rename from games/default/files/mobs/textures/mobs_sheep_green.png rename to games/default/files/mobs_animal/textures/mobs_sheep_green.png diff --git a/games/default/files/mobs/textures/mobs_sheep_grey.png b/games/default/files/mobs_animal/textures/mobs_sheep_grey.png similarity index 100% rename from games/default/files/mobs/textures/mobs_sheep_grey.png rename to games/default/files/mobs_animal/textures/mobs_sheep_grey.png diff --git a/games/default/files/mobs/textures/mobs_sheep_magenta.png b/games/default/files/mobs_animal/textures/mobs_sheep_magenta.png similarity index 100% rename from games/default/files/mobs/textures/mobs_sheep_magenta.png rename to games/default/files/mobs_animal/textures/mobs_sheep_magenta.png diff --git a/games/default/files/mobs/textures/mobs_sheep_orange.png b/games/default/files/mobs_animal/textures/mobs_sheep_orange.png similarity index 100% rename from games/default/files/mobs/textures/mobs_sheep_orange.png rename to games/default/files/mobs_animal/textures/mobs_sheep_orange.png diff --git a/games/default/files/mobs/textures/mobs_sheep_pink.png b/games/default/files/mobs_animal/textures/mobs_sheep_pink.png similarity index 100% rename from games/default/files/mobs/textures/mobs_sheep_pink.png rename to games/default/files/mobs_animal/textures/mobs_sheep_pink.png diff --git a/games/default/files/mobs/textures/mobs_sheep_red.png b/games/default/files/mobs_animal/textures/mobs_sheep_red.png similarity index 100% rename from games/default/files/mobs/textures/mobs_sheep_red.png rename to games/default/files/mobs_animal/textures/mobs_sheep_red.png diff --git a/games/default/files/mobs/textures/mobs_sheep_shaved.png b/games/default/files/mobs_animal/textures/mobs_sheep_shaved.png similarity index 100% rename from games/default/files/mobs/textures/mobs_sheep_shaved.png rename to games/default/files/mobs_animal/textures/mobs_sheep_shaved.png diff --git a/games/default/files/mobs/textures/mobs_sheep_violet.png b/games/default/files/mobs_animal/textures/mobs_sheep_violet.png similarity index 100% rename from games/default/files/mobs/textures/mobs_sheep_violet.png rename to games/default/files/mobs_animal/textures/mobs_sheep_violet.png diff --git a/games/default/files/mobs/textures/mobs_sheep_white.png b/games/default/files/mobs_animal/textures/mobs_sheep_white.png similarity index 100% rename from games/default/files/mobs/textures/mobs_sheep_white.png rename to games/default/files/mobs_animal/textures/mobs_sheep_white.png diff --git a/games/default/files/mobs/textures/mobs_sheep_yellow.png b/games/default/files/mobs_animal/textures/mobs_sheep_yellow.png similarity index 100% rename from games/default/files/mobs/textures/mobs_sheep_yellow.png rename to games/default/files/mobs_animal/textures/mobs_sheep_yellow.png diff --git a/games/default/files/mobs_animal/textures/mobs_wolf.png b/games/default/files/mobs_animal/textures/mobs_wolf.png new file mode 100644 index 000000000..b2ac4e394 Binary files /dev/null and b/games/default/files/mobs_animal/textures/mobs_wolf.png differ diff --git a/games/default/files/mobs_monster/depends.txt b/games/default/files/mobs_monster/depends.txt new file mode 100644 index 000000000..cc0339808 --- /dev/null +++ b/games/default/files/mobs_monster/depends.txt @@ -0,0 +1,2 @@ +default +mobs diff --git a/games/default/files/mobs_monster/init.lua b/games/default/files/mobs_monster/init.lua new file mode 100644 index 000000000..8617721a6 --- /dev/null +++ b/games/default/files/mobs_monster/init.lua @@ -0,0 +1,8 @@ + +local path = minetest.get_modpath("mobs_monster") + +-- Monsters + +dofile(path .. "/spider.lua") -- AspireMint +dofile(path.."/zombie.lua") -- Blockmen +dofile(path.."/skeleton.lua") -- Blockmen diff --git a/games/default/files/mobs/models/mobs_spider.x b/games/default/files/mobs_monster/models/mobs_spider.x similarity index 99% rename from games/default/files/mobs/models/mobs_spider.x rename to games/default/files/mobs_monster/models/mobs_spider.x index a8fbe07e3..19f17871f 100644 --- a/games/default/files/mobs/models/mobs_spider.x +++ b/games/default/files/mobs_monster/models/mobs_spider.x @@ -6100,4 +6100,4 @@ AnimationSet Global { 90;3; 0.000000, 0.000000, 0.000000;;; } } -} // End of AnimationSet Global \ No newline at end of file +} // End of AnimationSet Global diff --git a/games/default/files/mobs/models/zombie.x b/games/default/files/mobs_monster/models/mobs_zombie.x similarity index 100% rename from games/default/files/mobs/models/zombie.x rename to games/default/files/mobs_monster/models/mobs_zombie.x diff --git a/games/default/files/mobs_monster/readme.md b/games/default/files/mobs_monster/readme.md new file mode 100644 index 000000000..043b25aff --- /dev/null +++ b/games/default/files/mobs_monster/readme.md @@ -0,0 +1,38 @@ + +MONSTER MOBS + +Dirt Monster + +- Spawning at night on green grass (or grey in ethereal) these mobs wander around looking for a player to eat. Drops 1-5 dirt when killed. + +Dungeon Master + +- Spawning below -70 underground DM's have a tendency to hurl fire balls at unsuspecting players and can cause major damage, but get too close and he will switch to dogfight attack. Can drop mese or diamond when killed. + +Lava Flan + +- Cute as they may look lava flan wallow in their namesake (no, not flans) and get curious about players who wander by, forgetting that they can burn you and cause damage. They have a 1 in 5 chance of dropping lava orb when killed. + +Mese Monster + +- These mobs are territorial and spawn below -20 and will fire mese shards at passers by, so best avoided. Will drop mese when killed. + +Oerkki + +- Found in dark areas like most monsters Oerkki wander the caverns stealing away torches on the ground and attacking anyone found in that area. 1 in 3 chance of dropping obsidian. + +Sand Monster + +- The hot deserts are home to these guys who spawn at any time of the day to attack players. They drop 3-5 desert sand when killed. + +Spider + +- Found in dark holes inside desertstone (crystal biomes in ethereal), spiders wait for prey to amble past and strike. They are mostly docile during the day though unless hit. Will drop string when killed. + +Stone Monster + +- Found underground in dark caves these mobs seem to be zombie-like in fashion with a tendency to rush a player in the area. can drop torch, iron or coal when killed. + +Tree Monster + +- Found atop tree's at night time they drop down and look for food in the form of players. Can drop saplings and sometimes an apple or three. diff --git a/games/default/files/mobs/skeleton.lua b/games/default/files/mobs_monster/skeleton.lua similarity index 52% rename from games/default/files/mobs/skeleton.lua rename to games/default/files/mobs_monster/skeleton.lua index 27637954f..e446e8949 100644 --- a/games/default/files/mobs/skeleton.lua +++ b/games/default/files/mobs_monster/skeleton.lua @@ -1,16 +1,16 @@ -mobs:register_mob("mobs:skeleton", { +mobs:register_mob("mobs_monster:skeleton", { type = "monster", visual = "mesh", - mesh = "zombie.x", + mesh = "mobs_zombie.x", textures = { {"mobs_skeleton.png"}, }, collisionbox = {-0.25, -1, -0.3, 0.25, 0.75, 0.3}, 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 + speed_normal = 10, speed_run = 15, + stand_start = 0, stand_end = 79, + walk_start = 168, walk_end = 188, + run_start = 168, run_end = 188 }, makes_footstep_sound = true, sounds = { @@ -41,10 +41,8 @@ mobs:register_mob("mobs:skeleton", { }, }) - --name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height - mobs:spawn_specific("mobs:skeleton", - {"default:dirt", "default:sandstone", "default:sand", "default:stone", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass", "default:cobble", "default:mossycobble"}, - {"air"}, - 0, 7, 0, 4000, 1, -31000, 31000 - ) - --mobs:register_egg("mobs:skeleton", "Zombie", "zombie_head.png", 0) \ No newline at end of file +mobs:register_spawn("mobs_monster:skeleton", + {"default:dirt", "default:sandstone", "default:sand", "default:stone", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass", "default:cobble", "default:mossycobble"}, 10, 0, 5000, 1, 31000, false) + +-- compatibility +mobs:alias_mob("mobs:skeleton", "mobs_monster:skeleton") \ No newline at end of file diff --git a/games/default/files/mobs/sounds/mobs_spider.ogg b/games/default/files/mobs_monster/sounds/mobs_spider.ogg similarity index 100% rename from games/default/files/mobs/sounds/mobs_spider.ogg rename to games/default/files/mobs_monster/sounds/mobs_spider.ogg diff --git a/games/default/files/mobs/sounds/mobs_zombie.1.ogg b/games/default/files/mobs_monster/sounds/mobs_zombie.1.ogg similarity index 100% rename from games/default/files/mobs/sounds/mobs_zombie.1.ogg rename to games/default/files/mobs_monster/sounds/mobs_zombie.1.ogg diff --git a/games/default/files/mobs/sounds/mobs_zombie.2.ogg b/games/default/files/mobs_monster/sounds/mobs_zombie.2.ogg similarity index 100% rename from games/default/files/mobs/sounds/mobs_zombie.2.ogg rename to games/default/files/mobs_monster/sounds/mobs_zombie.2.ogg diff --git a/games/default/files/mobs/sounds/mobs_zombie.3.ogg b/games/default/files/mobs_monster/sounds/mobs_zombie.3.ogg similarity index 100% rename from games/default/files/mobs/sounds/mobs_zombie.3.ogg rename to games/default/files/mobs_monster/sounds/mobs_zombie.3.ogg diff --git a/games/default/files/mobs/sounds/mobs_zombie_attack.ogg b/games/default/files/mobs_monster/sounds/mobs_zombie_attack.ogg similarity index 100% rename from games/default/files/mobs/sounds/mobs_zombie_attack.ogg rename to games/default/files/mobs_monster/sounds/mobs_zombie_attack.ogg diff --git a/games/default/files/mobs/sounds/mobs_zombie_death.ogg b/games/default/files/mobs_monster/sounds/mobs_zombie_death.ogg similarity index 100% rename from games/default/files/mobs/sounds/mobs_zombie_death.ogg rename to games/default/files/mobs_monster/sounds/mobs_zombie_death.ogg diff --git a/games/default/files/mobs/sounds/mobs_zombie_hit.ogg b/games/default/files/mobs_monster/sounds/mobs_zombie_hit.ogg similarity index 100% rename from games/default/files/mobs/sounds/mobs_zombie_hit.ogg rename to games/default/files/mobs_monster/sounds/mobs_zombie_hit.ogg diff --git a/games/default/files/mobs/spider.lua b/games/default/files/mobs_monster/spider.lua similarity index 74% rename from games/default/files/mobs/spider.lua rename to games/default/files/mobs_monster/spider.lua index 5f099b181..13de4d1b9 100644 --- a/games/default/files/mobs/spider.lua +++ b/games/default/files/mobs_monster/spider.lua @@ -1,7 +1,8 @@ -- Spider by AspireMint (fishyWET (CC-BY-SA 3.0 license for texture) -mobs:register_mob("mobs:spider", { +mobs:register_mob("mobs_monster:spider", { + docile_by_day = true, type = "monster", passive = false, attack_type = "dogfight", @@ -27,14 +28,12 @@ mobs:register_mob("mobs:spider", { jump = true, view_range = 15, floats = 0, - drops = { - {name = "farming:string", - chance = 1, min = 1, max = 2}, - }, +-- drops = { +-- {name = "farming:string", +-- chance = 1, min = 1, max = 2}, }, water_damage = 5, - lava_damage = 5, - light_damage = 1, - fear_height = 2, + lava_damage = 5, + light_damage = 0, animation = { speed_normal = 15, speed_run = 15, @@ -48,21 +47,20 @@ mobs:register_mob("mobs:spider", { punch_end = 90, }, }) - - mobs:spawn_specific("mobs:spider", - {"default:dirt", "default:sandstone", "default:sand", "default:stone", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass", "default:cobble", "default:mossycobble"}, - {"air"}, - 0, 7, 0, 5000, 1, -31000, 31000 - ) -mobs:register_egg("mobs:spider", "Spider", "mobs_cobweb.png", 1) +mobs:register_spawn("mobs_monster:spider", + {"default:dirt", "default:sandstone", "default:sand", "default:stone", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass", "default:cobble", "default:mossycobble"}, 13, 0, 6000, 1, 31000) + +mobs:register_egg("mobs_monster:spider", "Spider", "mobs_cobweb.png", 1) + +-- compatibility +mobs:alias_mob("mobs:spider", "mobs_monster:spider") -- cobweb -minetest.register_node("mobs:cobweb", { +minetest.register_node(":mobs:cobweb", { description = "Cobweb", drawtype = "plantlike", visual_scale = 1.1, - stack_max = 64, tiles = {"mobs_cobweb.png"}, inventory_image = "mobs_cobweb.png", paramtype = "light", @@ -74,7 +72,7 @@ minetest.register_node("mobs:cobweb", { liquid_renewable = false, liquid_range = 0, walkable = false, - groups = {snappy = 1, liquid = 3}, + groups = {snappy = 1}, --drop = "farming:cotton", sounds = default.node_sound_leaves_defaults(), }) @@ -86,4 +84,4 @@ minetest.register_craft({ {"", "farming:string", ""}, {"farming:string", "", "farming:string"}, } -}) \ No newline at end of file +}) diff --git a/games/default/files/mobs/textures/mobs_cobweb.png b/games/default/files/mobs_monster/textures/mobs_cobweb.png similarity index 100% rename from games/default/files/mobs/textures/mobs_cobweb.png rename to games/default/files/mobs_monster/textures/mobs_cobweb.png diff --git a/games/default/files/mobs/textures/mobs_rotten_flesh.png b/games/default/files/mobs_monster/textures/mobs_rotten_flesh.png similarity index 100% rename from games/default/files/mobs/textures/mobs_rotten_flesh.png rename to games/default/files/mobs_monster/textures/mobs_rotten_flesh.png diff --git a/games/default/files/mobs/textures/mobs_skeleton.png b/games/default/files/mobs_monster/textures/mobs_skeleton.png similarity index 100% rename from games/default/files/mobs/textures/mobs_skeleton.png rename to games/default/files/mobs_monster/textures/mobs_skeleton.png diff --git a/games/default/files/mobs/textures/mobs_spider.png b/games/default/files/mobs_monster/textures/mobs_spider.png similarity index 100% rename from games/default/files/mobs/textures/mobs_spider.png rename to games/default/files/mobs_monster/textures/mobs_spider.png diff --git a/games/default/files/mobs/textures/mobs_zombie.png b/games/default/files/mobs_monster/textures/mobs_zombie.png similarity index 100% rename from games/default/files/mobs/textures/mobs_zombie.png rename to games/default/files/mobs_monster/textures/mobs_zombie.png diff --git a/games/default/files/mobs/textures/zombie_head.png b/games/default/files/mobs_monster/textures/zombie_head.png similarity index 100% rename from games/default/files/mobs/textures/zombie_head.png rename to games/default/files/mobs_monster/textures/zombie_head.png diff --git a/games/default/files/mobs_monster/zombie.lua b/games/default/files/mobs_monster/zombie.lua new file mode 100644 index 000000000..6e5eb6a7f --- /dev/null +++ b/games/default/files/mobs_monster/zombie.lua @@ -0,0 +1,79 @@ +mobs:register_mob("mobs_monster:zombie", { + type = "monster", + visual = "mesh", + mesh = "mobs_zombie.x", + textures = { + {"mobs_zombie.png"}, + }, + collisionbox = {-0.25, -1, -0.3, 0.25, 0.75, 0.3}, + 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 + }, + makes_footstep_sound = true, + sounds = { + random = "mobs_zombie.1", + war_cry = "mobs_zombie.3", + attack = "mobs_zombie.2", + damage = "mobs_zombie_hit", + death = "mobs_zombie_death", + }, + hp_min = 15, + hp_max = 25, + armor = 100, + knock_back = 1, + light_damage = 1, + lava_damage = 10, + fear_height = 2, + damage = 2, + reach = 2, + attack_type = "dogfight", + group_attack = true, + view_range = 15, + walk_chance = 75, + walk_velocity = 0.5, + run_velocity = 0.5, + jump = false, + drops = { + {name = "mobs_monster:rotten_flesh", + chance = 1, min = 1, max = 3,} + }, + }) + +mobs:register_spawn("mobs_monster:zombie", + {"default:dirt", "default:sandstone", "default:sand", "default:stone", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass", "default:cobble", "default:mossycobble"}, 10, 0, 5000, 1, 31000, false) + +mobs:register_egg("mobs_monster:zombie", "Zombie", "zombie_head.png", 0) + +-- compatibility +mobs:alias_mob("mobs:zombie", "mobs_monster:zombie") +mobs:alias_mob("mobs:rotten_flesh", "mobs_monster:rotten_flesh") +mobs:alias_mob("mobs:zombie_spawner", "mobs_monster:zombie_spawner") + +-- rotten flesh +minetest.register_craftitem("mobs_monster:rotten_flesh", { + description = "Rotten Flesh", + inventory_image = "mobs_rotten_flesh.png", + on_use = minetest.item_eat(1), + }) + +-- spawner block +minetest.register_node("mobs_monster:zombie_spawner", { + description = "Zombie Spawner", + tiles = {"zombie_head.png"}, + is_ground_content = false, + groups = {cracky = 3, stone = 1, mob_spawner = 1}, + sounds = default.node_sound_stone_defaults({ + dug = {name = "mobs_zombie_death", gain = 0.25} + }) + }) +minetest.register_abm({ + nodenames = {"mobs_monster:zombie_spawner"}, + interval = 60.0, + chance = 1, + action = function (pos, node, active_object_count, active_object_count_wider) + minetest.add_entity(pos, "mobs_monster:zombie") + end + }) \ No newline at end of file diff --git a/games/default/files/mobs/api.lua b/games/default/files/mobs_redo/api.lua similarity index 64% rename from games/default/files/mobs/api.lua rename to games/default/files/mobs_redo/api.lua index 537f1f015..3eed3720f 100644 --- a/games/default/files/mobs/api.lua +++ b/games/default/files/mobs_redo/api.lua @@ -1,11 +1,14 @@ --- Mobs Api (17th February 2016) + +-- Mobs Api (8th May 2016) + mobs = {} mobs.mod = "redo" -- Load settings local damage_enabled = minetest.setting_getbool("enable_damage") local peaceful_only = minetest.setting_getbool("only_peaceful_mobs") -local disable_blood = minetest.setting_getbool("mobs_disable_blood") +--local disable_blood = minetest.setting_getbool("mobs_disable_blood") +local disable_blood = true local creative = minetest.setting_getbool("creative_mode") local spawn_protected = tonumber(minetest.setting_get("mobs_spawn_protected")) or 1 local remove_far = minetest.setting_getbool("remove_far_mobs") @@ -20,6 +23,16 @@ local stuck_path_timeout = 10 -- how long will mob follow path before giving up local pi = math.pi local square = math.sqrt +local atan = function(x) + + if x ~= x then + --error("atan bassed NaN") + print ("atan based NaN") + return 0 + else + return math.atan(x) + end +end do_attack = function(self, player) @@ -67,17 +80,18 @@ set_animation = function(self, type) self.animation.current = self.animation.current or "" + self.animation.speed_normal = self.animation.speed_normal or 15 + if type == "stand" and self.animation.current ~= "stand" then if self.animation.stand_start - and self.animation.stand_end - and self.animation.speed_normal then + and self.animation.stand_end then self.object:set_animation({ x = self.animation.stand_start, y = self.animation.stand_end}, - self.animation.speed_normal, 0) + (self.animation.speed_stand or self.animation.speed_normal), 0) self.animation.current = "stand" end @@ -86,13 +100,12 @@ set_animation = function(self, type) and self.animation.current ~= "walk" then if self.animation.walk_start - and self.animation.walk_end - and self.animation.speed_normal then + and self.animation.walk_end then self.object:set_animation({ x = self.animation.walk_start, y = self.animation.walk_end}, - self.animation.speed_normal, 0) + (self.animation.speed_walk or self.animation.speed_normal), 0) self.animation.current = "walk" end @@ -101,13 +114,12 @@ set_animation = function(self, type) and self.animation.current ~= "run" then if self.animation.run_start - and self.animation.run_end - and self.animation.speed_run then + and self.animation.run_end then self.object:set_animation({ x = self.animation.run_start, y = self.animation.run_end}, - self.animation.speed_run, 0) + (self.animation.speed_run or self.animation.speed_normal), 0) self.animation.current = "run" end @@ -116,31 +128,86 @@ set_animation = function(self, type) and self.animation.current ~= "punch" then if self.animation.punch_start - and self.animation.punch_end - and self.animation.speed_normal then + and self.animation.punch_end then self.object:set_animation({ x = self.animation.punch_start, y = self.animation.punch_end}, - self.animation.speed_normal, 0) + (self.animation.speed_punch or self.animation.speed_normal), 0) self.animation.current = "punch" end + elseif type == "punch2" + and self.animation.current ~= "punch2" then + + if self.animation.punch2_start + and self.animation.punch2_end then + + self.object:set_animation({ + x = self.animation.punch2_start, + y = self.animation.punch2_end}, + (self.animation.speed_punch2 or self.animation.speed_normal), 0) + + self.animation.current = "punch2" + end + elseif type == "shoot" + and self.animation.current ~= "shoot" then + + if self.animation.shoot_start + and self.animation.shoot_end then + + self.object:set_animation({ + x = self.animation.shoot_start, + y = self.animation.shoot_end}, + (self.animation.speed_shoot or self.animation.speed_normal), 0) + + self.animation.current = "shoot" + end end end +-- check line of sight for walkers and swimmers alike +function line_of_sight_water(self, pos1, pos2, stepsize) + + local s, pos_w = minetest.line_of_sight(pos1, pos2, stepsize) + + -- normal walking and flying mobs can see you through air + if s == true then + return true + end + + -- swimming mobs can see you through water + if s == false + and self.fly + and self.fly_in == "default:water_source" then + + local nod = minetest.get_node(pos_w).name + + if nod == "default:water_source" + or nod == "default:water_flowing" then + + return true + end + end + + return false + +end + -- particle effects -function effect(pos, amount, texture, max_size) +function effect(pos, amount, texture, max_size, radius) + + radius = radius or 2 minetest.add_particlespawner({ amount = amount, time = 0.25, minpos = pos, maxpos = pos, - minvel = {x = -0, y = -2, z = -0}, - maxvel = {x = 2, y = 2, z = 2}, - minacc = {x = -4, y = -4, z = -4}, - maxacc = {x = 4, y = 4, z = 4}, + minvel = {x = -radius, y = -radius, z = -radius}, + maxvel = {x = radius, y = radius, z = radius}, + minacc = {x = -radius, y = -radius, z = -radius}, + maxacc = {x = radius, y = radius, z = radius}, minexptime = 0.1, maxexptime = 1, minsize = 0.5, @@ -177,27 +244,30 @@ end -- check if mob is dead or only hurt function check_for_death(self) - -- return if no change - local hp = self.object:get_hp() - - if hp == self.health then - return false + -- has health actually changed? + if self.health == self.old_health then + return end - -- still got some health? play hurt sound - if hp > 0 then + self.old_health = self.health - self.health = hp + -- still got some health? play hurt sound + if self.health > 0 then if self.sounds.damage then minetest.sound_play(self.sounds.damage,{ object = self.object, - gain = 1.0, + gain = 0.7, max_hear_distance = self.sounds.distance }) end + -- make sure health isn't higher than max + if self.health > self.hp_max then + self.health = self.hp_max + end + update_tag(self) return false @@ -231,7 +301,7 @@ function check_for_death(self) minetest.sound_play(self.sounds.death,{ object = self.object, - gain = 1.0, + gain = 0.7, max_hear_distance = self.sounds.distance }) end @@ -285,6 +355,24 @@ local function is_at_cliff(self) return false end +-- get node but use fallback for nil or unknown +local function node_ok(pos, fallback) + + fallback = fallback or "default:dirt" + + local node = minetest.get_node_or_nil(pos) + + if not node then + return minetest.registered_nodes[fallback] + end + + if minetest.registered_nodes[node.name] then + return node + end + + return minetest.registered_nodes[fallback] +end + -- environmental damage (water, lava, fire, light) do_env_damage = function(self) @@ -310,18 +398,20 @@ do_env_damage = function(self) and self.time_of_day < 0.8 and (minetest.get_node_light(pos) or 0) > 12 then - self.object:set_hp(self.object:get_hp() - self.light_damage) + self.health = self.health - self.light_damage - effect(pos, 5, "mobs_blood.png") + effect(pos, 5, "hud_heart_fg.png") end + -- what is mob standing in? + pos.y = pos.y + self.collisionbox[2] + 0.1 -- foot level + self.standing_in = node_ok(pos, "air").name + --print ("standing in " .. self.standing_in) + if self.water_damage ~= 0 or self.lava_damage ~= 0 then - pos.y = pos.y + self.collisionbox[2] + 0.1 -- foot level - - local nod = node_ok(pos, "air") ; --print ("standing in "..nod.name) - local nodef = minetest.registered_nodes[nod.name] + local nodef = minetest.registered_nodes[self.standing_in] pos.y = pos.y + 1 @@ -329,7 +419,7 @@ do_env_damage = function(self) if self.water_damage ~= 0 and nodef.groups.water then - self.object:set_hp(self.object:get_hp() - self.water_damage) + self.health = self.health - self.water_damage effect(pos, 5, "hud_air_fg.png") end @@ -337,10 +427,10 @@ do_env_damage = function(self) -- lava or fire if self.lava_damage ~= 0 and (nodef.groups.lava - or nod.name == "fire:basic_flame" - or nod.name == "fire:permanent_flame") then + or self.standing_in == "fire:basic_flame" + or self.standing_in == "fire:permanent_flame") then - self.object:set_hp(self.object:get_hp() - self.lava_damage) + self.health = self.health - self.lava_damage effect(pos, 5, "fire_basic_flame.png") end @@ -349,7 +439,7 @@ do_env_damage = function(self) check_for_death(self) end --- jump if facing a solid node (not fences) +-- jump if facing a solid node (not fences or gates) do_jump = function(self) if self.fly @@ -389,8 +479,9 @@ do_jump = function(self) --print ("in front:", nod.name, pos.y + 0.5) - if minetest.registered_items[nod.name].walkable + if (minetest.registered_items[nod.name].walkable and not nod.name:find("fence") + and not nod.name:find("gate")) or self.walk_chance == 0 then local v = self.object:getvelocity() @@ -405,7 +496,7 @@ do_jump = function(self) minetest.sound_play(self.sounds.jump, { object = self.object, - gain = 1.0, + gain = 0.7, max_hear_distance = self.sounds.distance }) end @@ -440,28 +531,22 @@ function entity_physics(pos, radius) dist = math.max(1, get_distance(pos, obj_pos)) local damage = math.floor((4 / dist) * radius) - obj:set_hp(obj:get_hp() - damage) + local ent = obj:get_luaentity() + + if obj:is_player() then + obj:set_hp(obj:get_hp() - damage) + + else --if ent.health then + + obj:punch(obj, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = damage}, + }, nil) + + end end end --- get node but use fallback for nil or unknown -function node_ok(pos, fallback) - - fallback = fallback or "default:dirt" - - local node = minetest.get_node_or_nil(pos) - - if not node then - return minetest.registered_nodes[fallback] - end - - if minetest.registered_nodes[node.name] then - return node - end - - return minetest.registered_nodes[fallback] -end - -- should mob follow what I'm holding ? function follow_holding(self, clicker) @@ -487,6 +572,7 @@ function follow_holding(self, clicker) return false end +-- find two animals of same type and breed if nearby and horny local function breed(self) -- child take 240 seconds before growing into adult @@ -536,7 +622,7 @@ local function breed(self) local pos = self.object:getpos() - effect({x = pos.x, y = pos.y + 1, z = pos.z}, 4, "mobs_blood.png") + --effect({x = pos.x, y = pos.y + 1, z = pos.z}, 4, "heart.png") local ents = minetest.get_objects_inside_radius(pos, 3) local num = 0 @@ -620,6 +706,7 @@ local function breed(self) end end +-- find and replace what mob is looking for (grass, wheat etc.) function replace(self, pos) if self.replace_rate @@ -820,533 +907,260 @@ function smart_mobs(self, s, p, dist, dtime) end end --- register mob function -function mobs:register_mob(name, def) +-- monster find someone to attack +local monster_attack = function(self) -minetest.register_entity(name, { + if self.type ~= "monster" + or not damage_enabled + or self.state == "attack" + or day_docile(self) then + return + end - stepheight = def.stepheight or 0.6, - name = name, - type = def.type, - attack_type = def.attack_type, - fly = def.fly, - fly_in = def.fly_in or "air", - owner = def.owner or "", - order = def.order or "", - on_die = def.on_die, - do_custom = def.do_custom, - jump_height = def.jump_height or 6, - jump_chance = def.jump_chance or 0, - drawtype = def.drawtype, -- DEPRECATED, use rotate instead - rotate = math.rad(def.rotate or 0), -- 0=front, 90=side, 180=back, 270=side2 - lifetimer = def.lifetimer or 180, -- 3 minutes - hp_min = def.hp_min or 5, - hp_max = def.hp_max or 10, - physical = true, - collisionbox = def.collisionbox, - visual = def.visual, - visual_size = def.visual_size or {x = 1, y = 1}, - mesh = def.mesh, - makes_footstep_sound = def.makes_footstep_sound or false, - view_range = def.view_range or 5, - walk_velocity = def.walk_velocity or 1, - run_velocity = def.run_velocity or 2, - damage = def.damage or 0, - light_damage = def.light_damage or 0, - water_damage = def.water_damage or 0, - lava_damage = def.lava_damage or 0, - fall_damage = def.fall_damage or 1, - fall_speed = def.fall_speed or -10, -- must be lower than -2 (default: -10) - drops = def.drops or {}, - armor = def.armor, - on_rightclick = def.on_rightclick, - arrow = def.arrow, - shoot_interval = def.shoot_interval, - sounds = def.sounds or {}, - animation = def.animation, - follow = def.follow, - jump = def.jump or true, - walk_chance = def.walk_chance or 50, - attacks_monsters = def.attacks_monsters or false, - group_attack = def.group_attack or false, - --fov = def.fov or 120, - passive = def.passive or false, - recovery_time = def.recovery_time or 0.5, - knock_back = def.knock_back or 3, - blood_amount = def.blood_amount or 5, - blood_texture = def.blood_texture or "mobs_blood.png", - shoot_offset = def.shoot_offset or 0, - floats = def.floats or 1, -- floats in water by default - replace_rate = def.replace_rate, - replace_what = def.replace_what, - replace_with = def.replace_with, - replace_offset = def.replace_offset or 0, - timer = 0, - env_damage_timer = 0, -- only used when state = "attack" - tamed = false, - pause_timer = 0, - horny = false, - hornytimer = 0, - child = false, - gotten = false, - health = 0, - reach = def.reach or 3, - htimer = 0, - child_texture = def.child_texture, - docile_by_day = def.docile_by_day or false, - time_of_day = 0.5, - fear_height = def.fear_height or 0, - runaway = def.runaway, - runaway_timer = 0, - pathfinding = def.pathfinding, + local s = self.object:getpos() + local p, sp, dist + local player, type, obj, min_player = nil, nil, nil, nil + local min_dist = self.view_range + 1 - on_step = function(self, dtime) + for _,oir in pairs(minetest.get_objects_inside_radius(s, self.view_range)) do - local pos = self.object:getpos() - local yaw = self.object:getyaw() or 0 + if oir:is_player() then - -- when lifetimer expires remove mob (except npc and tamed) - if self.type ~= "npc" - and not self.tamed - and self.state ~= "attack" then - - self.lifetimer = self.lifetimer - dtime - - if self.lifetimer <= 0 then - - -- only despawn away from player - local objs = minetest.get_objects_inside_radius(pos, 10) - - for _,oir in pairs(objs) do - - if oir:is_player() then - - self.lifetimer = 20 - - return - end - end - - minetest.log("action", - "lifetimer expired, removed " .. self.name) - - effect(pos, 15, "mobs_blood.png") - - self.object:remove() - - return - end - end - - if not self.fly then - - -- floating in water (or falling) - local v = self.object:getvelocity() - - -- going up then apply gravity - if v.y > 0.1 then - - self.object:setacceleration({ - x = 0, - y = self.fall_speed, - z = 0 - }) - end - - -- in water then float up - if minetest.registered_nodes[node_ok(pos).name].groups.liquid then -- water then - - if self.floats == 1 then - - self.object:setacceleration({ - x = 0, - y = -self.fall_speed / (math.max(1, v.y) ^ 2), - z = 0 - }) - end - else - -- fall downwards - self.object:setacceleration({ - x = 0, - y = self.fall_speed, - z = 0 - }) - - -- fall damage - if self.fall_damage == 1 - and self.object:getvelocity().y == 0 then - - local d = self.old_y - self.object:getpos().y - - if d > 5 then - - self.object:set_hp(self.object:get_hp() - math.floor(d - 5)) - - effect(pos, 10, "mobs_blood.png") - - if check_for_death(self) then - return - end - end - - self.old_y = self.object:getpos().y - end - end - end - - -- knockback timer - if self.pause_timer > 0 then - - self.pause_timer = self.pause_timer - dtime - - if self.pause_timer < 1 then - self.pause_timer = 0 - end - - return - end - - -- attack timer - self.timer = self.timer + dtime - - if self.state ~= "attack" then - - if self.timer < 1 then - return - end - - self.timer = 0 - end - - -- never go over 100 - if self.timer > 100 then - self.timer = 1 - end - - -- node replace check (cow eats grass etc.) - replace(self, pos) - - -- mob plays random sound at times - if self.sounds.random - and math.random(1, 100) == 1 then - - minetest.sound_play(self.sounds.random, { - object = self.object, - max_hear_distance = self.sounds.distance - }) - end - - -- environmental damage timer (every 1 second) - self.env_damage_timer = self.env_damage_timer + dtime - - if (self.state == "attack" and self.env_damage_timer > 1) - or self.state ~= "attack" then - - self.env_damage_timer = 0 - - do_env_damage(self) - - -- custom function (defined in mob lua file) - if self.do_custom then - self.do_custom(self) - end - end - - -- find someone to attack - if self.type == "monster" - and damage_enabled - and self.state ~= "attack" - and not day_docile(self) then - - local s = self.object:getpos() - local p, sp, dist - local player = nil - local type = nil - local obj = nil - local min_dist = self.view_range + 1 - local min_player = nil - - for _,oir in pairs(minetest.get_objects_inside_radius(s, self.view_range)) do - - if oir:is_player() then - - player = oir - type = "player" - else - obj = oir:get_luaentity() - - if obj then - player = obj.object - type = obj.type - end - end - - if type == "player" - or type == "npc" then - - s = self.object:getpos() - p = player:getpos() - sp = s - - -- aim higher to make looking up hills more realistic - p.y = p.y + 1 - sp.y = sp.y + 1 - - dist = get_distance(p, s) - - if dist < self.view_range then - -- field of view check goes here - - -- choose closest player to attack - if minetest.line_of_sight(sp, p, 2) == true - and dist < min_dist then - min_dist = dist - min_player = player - end - end - end - end - - -- attack player - if min_player then - do_attack(self, min_player) - end - end - - -- npc, find closest monster to attack - local min_dist = self.view_range + 1 - local min_player = nil - - if self.type == "npc" - and self.attacks_monsters - and self.state ~= "attack" then - - local s = self.object:getpos() - local obj = nil - - for _, oir in pairs(minetest.get_objects_inside_radius(s, self.view_range)) do - - obj = oir:get_luaentity() - - if obj - and obj.type == "monster" then - - -- attack monster - p = obj.object:getpos() - - dist = get_distance(p, s) - - if dist < min_dist then - min_dist = dist - min_player = obj.object - end - end - end - - if min_player then - do_attack(self, min_player) - end - end - - -- breed and grow children - breed(self) - - -- find player to follow - if (self.follow ~= "" - or self.order == "follow") - and not self.following - and self.state ~= "attack" - and self.state ~= "runaway" then - - local s, p, dist - - for _,player in pairs(minetest.get_connected_players()) do - - s = self.object:getpos() - p = player:getpos() - dist = get_distance(p, s) - - if dist < self.view_range then - self.following = player - break - end - end - end - - if self.type == "npc" - and self.order == "follow" - and self.state ~= "attack" - and self.owner ~= "" then - - -- npc stop following player if not owner - if self.following - and self.owner - and self.owner ~= self.following:get_player_name() then - self.following = nil - end + player = oir + type = "player" else - -- stop following player if not holding specific item - if self.following - and self.following:is_player() - and follow_holding(self, self.following) == false then + obj = oir:get_luaentity() + + if obj then + player = obj.object + type = obj.type + end + end + + if type == "player" + or type == "npc" then + + s = self.object:getpos() + p = player:getpos() + sp = s + + -- aim higher to make looking up hills more realistic + p.y = p.y + 1 + sp.y = sp.y + 1 + + dist = get_distance(p, s) + + if dist < self.view_range then + -- field of view check goes here + + -- choose closest player to attack + --if minetest.line_of_sight(sp, p, 2) == true + if line_of_sight_water(self, sp, p, 2) == true + and dist < min_dist then + min_dist = dist + min_player = player + end + end + end + end + + -- attack player + if min_player then + do_attack(self, min_player) + end +end + +-- npc, find closest monster to attack +local npc_attack = function(self) + + if self.type ~= "npc" + or not self.attacks_monsters + or self.state == "attack" then + return + end + + local s = self.object:getpos() + local min_dist = self.view_range + 1 + local obj, min_player = nil, nil + + for _, oir in pairs(minetest.get_objects_inside_radius(s, self.view_range)) do + + obj = oir:get_luaentity() + + if obj + and obj.type == "monster" then + + p = obj.object:getpos() + + dist = get_distance(p, s) + + if dist < min_dist then + min_dist = dist + min_player = obj.object + end + end + end + + if min_player then + do_attack(self, min_player) + end +end + +-- follow player if owner or holding item, if fish outta water then flop +local follow_flop = function(self) + + -- find player to follow + if (self.follow ~= "" + or self.order == "follow") + and not self.following + and self.state ~= "attack" + and self.state ~= "runaway" then + + local s, p, dist + + for _,player in pairs(minetest.get_connected_players()) do + + s = self.object:getpos() + p = player:getpos() + dist = get_distance(p, s) + + if dist < self.view_range then + self.following = player + break + end + end + end + + if self.type == "npc" + and self.order == "follow" + and self.state ~= "attack" + and self.owner ~= "" then + + -- npc stop following player if not owner + if self.following + and self.owner + and self.owner ~= self.following:get_player_name() then + self.following = nil + end + else + -- stop following player if not holding specific item + if self.following + and self.following:is_player() + and follow_holding(self, self.following) == false then + self.following = nil + end + + end + + -- follow that thing + if self.following then + + local s = self.object:getpos() + local p + + if self.following:is_player() then + + p = self.following:getpos() + + elseif self.following.object then + + p = self.following.object:getpos() + end + + if p then + + local dist = get_distance(p, s) + + -- dont follow if out of range + if dist > self.view_range then self.following = nil - end + else + local vec = { + x = p.x - s.x, + y = p.y - s.y, + z = p.z - s.z + } - end + if vec.x ~= 0 + and vec.z ~= 0 then - -- follow that thing - if self.following then + yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate - local s = self.object:getpos() - local p - - if self.following:is_player() then - - p = self.following:getpos() - - elseif self.following.object then - - p = self.following.object:getpos() - end - - if p then - - local dist = get_distance(p, s) - - -- dont follow if out of range - if dist > self.view_range then - self.following = nil - else - local vec = { - x = p.x - s.x, - y = p.y - s.y, - z = p.z - s.z - } - - if vec.x ~= 0 - and vec.z ~= 0 then - - yaw = (math.atan(vec.z / vec.x) + pi / 2) - self.rotate - - if p.x > s.x then - yaw = yaw + pi - end - - self.object:setyaw(yaw) + if p.x > s.x then + yaw = yaw + pi end - -- anyone but standing npc's can move along - if dist > self.reach - and self.order ~= "stand" then - - if (self.jump - and get_velocity(self) <= 0.5 - and self.object:getvelocity().y == 0) - or (self.object:getvelocity().y == 0 - and self.jump_chance > 0) then - - do_jump(self) - end - - set_velocity(self, self.walk_velocity) - - if self.walk_chance ~= 0 then - set_animation(self, "walk") - end - else - set_velocity(self, 0) - set_animation(self, "stand") - end - - return - end - end - end - - if self.state == "stand" then - - if math.random(1, 4) == 1 then - - local lp = nil - local s = self.object:getpos() - - if self.type == "npc" then - - local o = minetest.get_objects_inside_radius(self.object:getpos(), 3) - - for _,o in pairs(o) do - - if o:is_player() then - lp = o:getpos() - break - end - end + self.object:setyaw(yaw) end - -- look at any players nearby, otherwise turn randomly - if lp then + -- anyone but standing npc's can move along + if dist > self.reach + and self.order ~= "stand" then - local vec = { - x = lp.x - s.x, - y = lp.y - s.y, - z = lp.z - s.z - } + if (self.jump + and get_velocity(self) <= 0.5 + and self.object:getvelocity().y == 0) + or (self.object:getvelocity().y == 0 + and self.jump_chance > 0) then - if vec.x ~= 0 - and vec.z ~= 0 then - - yaw = (math.atan(vec.z / vec.x) + pi / 2) - self.rotate - - if lp.x > s.x then - yaw = yaw + pi - end + do_jump(self) end - else - yaw = (math.random(0, 360) - 180) / 180 * pi - end - - self.object:setyaw(yaw) - end - - set_velocity(self, 0) - set_animation(self, "stand") - - -- npc's ordered to stand stay standing - if self.type ~= "npc" - or self.order ~= "stand" then - - if self.walk_chance ~= 0 - and math.random(1, 100) <= self.walk_chance - and is_at_cliff(self) == false then set_velocity(self, self.walk_velocity) - self.state = "walk" - set_animation(self, "walk") + + if self.walk_chance ~= 0 then + set_animation(self, "walk") + end + else + set_velocity(self, 0) + set_animation(self, "stand") end - end - - elseif self.state == "walk" then - - local s = self.object:getpos() - local lp = minetest.find_node_near(s, 1, {"group:water"}) - - -- water swimmers cannot move out of water - if self.fly - and self.fly_in == "default:water_source" - and not lp then - - --print ("out of water") - - set_velocity(self, 0) - - -- change to undefined state so nothing more happens - self.state = "flop" - set_animation(self, "stand") return end + end + end - -- if water nearby then turn away + -- water swimmers flop when on land + if self.fly + and self.fly_in == "default:water_source" + and self.standing_in ~= self.fly_in then + + self.state = "flop" + self.object:setvelocity({x = 0, y = -5, z = 0}) + + set_animation(self, "stand") + + return + end +end + +-- execute current state (stand, walk, run, attacks) +local do_states = function(self, dtime) + + local yaw = 0 + + if self.state == "stand" then + + if math.random(1, 4) == 1 then + + local lp = nil + local s = self.object:getpos() + + if self.type == "npc" then + + local o = minetest.get_objects_inside_radius(self.object:getpos(), 3) + + for _,o in pairs(o) do + + if o:is_player() then + lp = o:getpos() + break + end + end + end + + -- look at any players nearby, otherwise turn randomly if lp then local vec = { @@ -1358,73 +1172,120 @@ minetest.register_entity(name, { if vec.x ~= 0 and vec.z ~= 0 then - yaw = math.atan(vec.z / vec.x) + 3 * pi / 2 - self.rotate + yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate if lp.x > s.x then yaw = yaw + pi end - - self.object:setyaw(yaw) end - - -- otherwise randomly turn - elseif math.random(1, 100) <= 30 then - + else yaw = (math.random(0, 360) - 180) / 180 * pi + end + + self.object:setyaw(yaw) + end + + set_velocity(self, 0) + set_animation(self, "stand") + + -- npc's ordered to stand stay standing + if self.type ~= "npc" + or self.order ~= "stand" then + + if self.walk_chance ~= 0 + and math.random(1, 100) <= self.walk_chance + and is_at_cliff(self) == false then + + set_velocity(self, self.walk_velocity) + self.state = "walk" + set_animation(self, "walk") + end + end + + elseif self.state == "walk" then + + local s = self.object:getpos() + local lp = minetest.find_node_near(s, 1, {"group:water"}) + + -- if water nearby then turn away + if lp then + + local vec = { + x = lp.x - s.x, + y = lp.y - s.y, + z = lp.z - s.z + } + + if vec.x ~= 0 + and vec.z ~= 0 then + + yaw = atan(vec.z / vec.x) + 3 * pi / 2 - self.rotate + + if lp.x > s.x then + yaw = yaw + pi + end self.object:setyaw(yaw) end - -- stand for great fall in front - local temp_is_cliff = is_at_cliff(self) + -- otherwise randomly turn + elseif math.random(1, 100) <= 30 then - -- jump when walking comes to a halt - if temp_is_cliff == false - and self.jump - and get_velocity(self) <= 0.5 - and self.object:getvelocity().y == 0 then + local yaw = (math.random(0, 360) - 180) / 180 * pi - do_jump(self) - end + self.object:setyaw(yaw) + end - if temp_is_cliff - or math.random(1, 100) <= 30 then + -- stand for great fall in front + local temp_is_cliff = is_at_cliff(self) - set_velocity(self, 0) - self.state = "stand" - set_animation(self, "stand") - else - set_velocity(self, self.walk_velocity) - set_animation(self, "walk") - end + -- jump when walking comes to a halt + if temp_is_cliff == false + and self.jump + and get_velocity(self) <= 0.5 + and self.object:getvelocity().y == 0 then - -- runaway when punched - elseif self.state == "runaway" then + do_jump(self) + end - self.runaway_timer = self.runaway_timer + 1 + if temp_is_cliff + or math.random(1, 100) <= 30 then - -- stop after 3 seconds or when at cliff - if self.runaway_timer > 3 - or is_at_cliff(self) then - self.runaway_timer = 0 - set_velocity(self, 0) - self.state = "stand" - set_animation(self, "stand") - else - set_velocity(self, self.run_velocity) - set_animation(self, "walk") - end + set_velocity(self, 0) + self.state = "stand" + set_animation(self, "stand") + else + set_velocity(self, self.walk_velocity) + set_animation(self, "walk") + end - -- jump when walking comes to a halt - if self.jump - and get_velocity(self) <= 0.5 - and self.object:getvelocity().y == 0 then + -- runaway when punched + elseif self.state == "runaway" then - do_jump(self) - end + self.runaway_timer = self.runaway_timer + 1 - -- attack routines (explode, dogfight, shoot, dogshoot) - elseif self.state == "attack" then + -- stop after 3 seconds or when at cliff + if self.runaway_timer > 3 + or is_at_cliff(self) then + self.runaway_timer = 0 + set_velocity(self, 0) + self.state = "stand" + set_animation(self, "stand") + else + set_velocity(self, self.run_velocity) + set_animation(self, "walk") + end + + -- jump when walking comes to a halt + if self.jump + and get_velocity(self) <= 0.5 + and self.object:getvelocity().y == 0 then + + do_jump(self) + end + + -- attack routines (explode, dogfight, shoot, dogshoot) + elseif self.state == "attack" then -- calculate distance from mob and enemy local s = self.object:getpos() @@ -1460,7 +1321,7 @@ minetest.register_entity(name, { if vec.x ~= 0 and vec.z ~= 0 then - yaw = math.atan(vec.z / vec.x) + pi / 2 - self.rotate + yaw = atan(vec.z / vec.x) + pi / 2 - self.rotate if p.x > s.x then yaw = yaw + pi @@ -1495,6 +1356,8 @@ minetest.register_entity(name, { set_animation(self, "run") else set_velocity(self, 0) + set_animation(self, "punch") + self.timer = self.timer + dtime self.blinktimer = (self.blinktimer or 0) + dtime @@ -1514,9 +1377,10 @@ minetest.register_entity(name, { if self.timer > 3 then local pos = self.object:getpos() + local radius = self.explosion_radius or 1 -- hurt player/mobs caught in blast area - entity_physics(pos, 3) + entity_physics(pos, radius) -- dont damage anything if area protected or next to water if minetest.find_node_near(pos, 1, {"group:water"}) @@ -1526,21 +1390,21 @@ minetest.register_entity(name, { minetest.sound_play(self.sounds.explode, { object = self.object, - gain = 1.0, + gain = 0.7, max_hear_distance = 16 }) end self.object:remove() - effect(pos, 15, "mobs_blood.png", 5) + effect(pos, 15, "hud_air_fg.png", 5) return end pos.y = pos.y - 1 - mobs:explosion(pos, 2, 0, 1, self.sounds.explode) + mobs:explosion(pos, radius, 0, 1, self.sounds.explode) self.object:remove() @@ -1637,7 +1501,7 @@ minetest.register_entity(name, { if vec.x ~= 0 and vec.z ~= 0 then - yaw = (math.atan(vec.z / vec.x) + pi / 2) - self.rotate + yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate if p.x > s.x then yaw = yaw + pi @@ -1688,34 +1552,52 @@ minetest.register_entity(name, { self.path.following = false -- not stuck anymore set_velocity(self, 0) - set_animation(self, "punch") - if self.timer > 1 then + if not self.custom_attack then - self.timer = 0 + if self.timer > 1 then - local p2 = p - local s2 = s + self.timer = 0 - p2.y = p2.y + 1.5 - s2.y = s2.y + 1.5 - - if minetest.line_of_sight(p2, s2) == true then - - -- play attack sound - if self.sounds.attack then - - minetest.sound_play(self.sounds.attack, { - object = self.object, - max_hear_distance = self.sounds.distance - }) + if self.double_melee_attack + and math.random(1, 2) == 1 then + set_animation(self, "punch") + else + set_animation(self, "punch2") end - -- punch player - self.attack:punch(self.object, 1.0, { - full_punch_interval = 1.0, - damage_groups = {fleshy = self.damage} - }, nil) + local p2 = p + local s2 = s + + p2.y = p2.y + 1.5 + s2.y = s2.y + 1.5 + + --if minetest.line_of_sight(p2, s2) == true then + if line_of_sight_water(self, p2, s2) == true then + + -- play attack sound + if self.sounds.attack then + + minetest.sound_play(self.sounds.attack, { + object = self.object, + max_hear_distance = self.sounds.distance + }) + end + + -- punch player + self.attack:punch(self.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = self.damage} + }, nil) + end + end + else -- call custom attack every second + if self.custom_attack + and self.timer > 1 then + + self.timer = 0 + + self.custom_attack(self, p) end end end @@ -1736,7 +1618,7 @@ minetest.register_entity(name, { if vec.x ~= 0 and vec.z ~= 0 then - yaw = (math.atan(vec.z / vec.x) + pi / 2) - self.rotate + yaw = (atan(vec.z / vec.x) + pi / 2) - self.rotate if p.x > s.x then yaw = yaw + pi @@ -1752,7 +1634,7 @@ minetest.register_entity(name, { and math.random(1, 100) <= 60 then self.timer = 0 - set_animation(self, "punch") + set_animation(self, "shoot") -- play shoot attack sound if self.sounds.shoot_attack then @@ -1770,250 +1652,585 @@ minetest.register_entity(name, { local obj = minetest.add_entity(p, self.arrow) local ent = obj:get_luaentity() local amount = (vec.x * vec.x + vec.y * vec.y + vec.z * vec.z) ^ 0.5 - local v = ent.velocity + local v = ent.velocity or 1 -- or set to default ent.switch = 1 -- offset makes shoot aim accurate vec.y = vec.y + self.shoot_offset - vec.x = vec.x * v / amount - vec.y = vec.y * v / amount - vec.z = vec.z * v / amount + vec.x = vec.x * (v / amount) + vec.y = vec.y * (v / amount) + vec.z = vec.z * (v / amount) obj:setvelocity(vec) end end + end +end - end -- END if self.state == "attack" - end, +-- falling and fall damage +local falling = function(self, pos) - on_punch = function(self, hitter, tflp, tool_capabilities, dir) + if self.fly then + return + end - -- direction error check - dir = dir or {x = 0, y = 0, z = 0} + -- floating in water (or falling) + local v = self.object:getvelocity() - -- weapon wear - local weapon = hitter:get_wielded_item() - local punch_interval = 1.4 + -- going up then apply gravity + if v.y > 0.1 then - if tool_capabilities then - punch_interval = tool_capabilities.full_punch_interval or 1.4 - end + self.object:setacceleration({ + x = 0, + y = self.fall_speed, + z = 0 + }) + end - if weapon:get_definition() - and weapon:get_definition().tool_capabilities then + -- in water then float up + if minetest.registered_nodes[node_ok(pos).name].groups.liquid then - weapon:add_wear(math.floor((punch_interval / 75) * 9000)) - hitter:set_wielded_item(weapon) - end + if self.floats == 1 then - -- weapon sounds - if weapon:get_definition().sounds ~= nil then - - local s = math.random(0, #weapon:get_definition().sounds) - - minetest.sound_play(weapon:get_definition().sounds[s], { - object = hitter, - max_hear_distance = 8 - }) - else - minetest.sound_play("default_punch", { - object = hitter, - max_hear_distance = 5 + self.object:setacceleration({ + x = 0, + y = -self.fall_speed / (math.max(1, v.y) ^ 2), + z = 0 }) end + else + -- fall downwards + self.object:setacceleration({ + x = 0, + y = self.fall_speed, + z = 0 + }) - -- exit here if dead - if check_for_death(self) then - return - end + -- fall damage + if self.fall_damage == 1 + and self.object:getvelocity().y == 0 then - -- blood_particles - if self.blood_amount > 0 - and not disable_blood then + local d = self.old_y - self.object:getpos().y - local pos = self.object:getpos() + if d > 5 then - pos.y = pos.y + (-self.collisionbox[2] + self.collisionbox[5]) / 2 + --self.object:set_hp(self.object:get_hp() - math.floor(d - 5)) + self.health = self.health - math.floor(d - 5) - effect(pos, self.blood_amount, self.blood_texture) - end + effect(pos, 5, "tnt_smoke.png") - -- knock back effect - if self.knock_back > 0 then - - local v = self.object:getvelocity() - local r = 1.4 - math.min(punch_interval, 1.4) - local kb = r * 5 - local up = 2 - - -- if already in air then dont go up anymore when hit - if v.y > 0 then - up = 0 - end - - self.object:setvelocity({ - x = dir.x * kb, - y = up, - z = dir.z * kb - }) - - self.pause_timer = r - end - - -- if skittish then run away - if self.runaway == true then - - local lp = hitter:getpos() - local s = self.object:getpos() - - local vec = { - x = lp.x - s.x, - y = lp.y - s.y, - z = lp.z - s.z - } - - if vec.x ~= 0 - and vec.z ~= 0 then - - local yaw = math.atan(vec.z / vec.x) + 3 * pi / 2 - self.rotate - - if lp.x > s.x then - yaw = yaw + pi + if check_for_death(self) then + return end - - self.object:setyaw(yaw) end - self.state = "runaway" - self.runaway_timer = 0 - self.following = nil + self.old_y = self.object:getpos().y + end + end +end + +local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) + + -- direction error check + dir = dir or {x = 0, y = 0, z = 0} + + -- weapon wear + local weapon = hitter:get_wielded_item() + local punch_interval = 1.4 + + -- calculate mob damage + local damage = 0 + local armor = self.object:get_armor_groups() or {} + local tmp + + -- quick error check incase it ends up 0 (serialize.h check test) + if tflp == 0 then + tflp = 0.2 + end + + for group,_ in pairs( (tool_capabilities.damage_groups or {}) ) do + + tmp = tflp / (tool_capabilities.full_punch_interval or 1.4) + + if tmp < 0 then + tmp = 0.0 + elseif tmp > 1 then + tmp = 1.0 end - -- attack puncher and call other mobs for help - if self.passive == false - and self.child == false - and hitter:get_player_name() ~= self.owner then + damage = damage + (tool_capabilities.damage_groups[group] or 0) + * tmp * ((armor[group] or 0) / 100.0) + end - --if self.state ~= "attack" then - -- attack whoever punched mob - self.state = "" - do_attack(self, hitter) - --end + -- check for tool immunity or special damage + for _, no in pairs(self.immune_to) do - -- alert others to the attack - local obj = nil + if no[1] == weapon:get_name() then - for _, oir in pairs(minetest.get_objects_inside_radius(hitter:getpos(), 5)) do + damage = no[2] or 0 - obj = oir:get_luaentity() + break + end + end - if obj then + -- print ("Mob Damage is", damage) - if obj.group_attack == true - and obj.state ~= "attack" then - do_attack(obj, hitter) - end + -- add weapon wear + if tool_capabilities then + punch_interval = tool_capabilities.full_punch_interval or 1.4 + end + + if weapon:get_definition() + and weapon:get_definition().tool_capabilities then + + weapon:add_wear(math.floor((punch_interval / 75) * 9000)) + hitter:set_wielded_item(weapon) + end + + -- weapon sounds + if weapon:get_definition().sounds ~= nil then + + local s = math.random(0, #weapon:get_definition().sounds) + + minetest.sound_play(weapon:get_definition().sounds[s], { + object = hitter, + max_hear_distance = 8 + }) + else + minetest.sound_play("default_punch", { + object = hitter, + max_hear_distance = 5 + }) + end + + -- do damage + self.health = self.health - math.floor(damage) + + -- exit here if dead + if check_for_death(self) then + return + end + + -- add healthy afterglow when hit + core.after(0.1, function() + self.object:settexturemod("^[colorize:#ff000085") + + core.after(0.5, function() + self.object:settexturemod("") + end) + end) + + -- blood_particles + if self.blood_amount > 0 + and not disable_blood then + + local pos = self.object:getpos() + + pos.y = pos.y + (-self.collisionbox[2] + self.collisionbox[5]) / 2 + + effect(pos, self.blood_amount, self.blood_texture) + end + + -- knock back effect (only on full punch) + if self.knock_back > 0 + and tflp > punch_interval then + + local v = self.object:getvelocity() + local r = 1.4 - math.min(punch_interval, 1.4) + local kb = r * 5 + local up = 2 + + -- if already in air then dont go up anymore when hit + if v.y > 0 + or self.fly then + up = 0 + end + + self.object:setvelocity({ + x = dir.x * kb, + y = up, + z = dir.z * kb + }) + + self.pause_timer = r + end + + -- if skittish then run away + if self.runaway == true then + + local lp = hitter:getpos() + local s = self.object:getpos() + + local vec = { + x = lp.x - s.x, + y = lp.y - s.y, + z = lp.z - s.z + } + + if vec.x ~= 0 + and vec.z ~= 0 then + + local yaw = atan(vec.z / vec.x) + 3 * pi / 2 - self.rotate + + if lp.x > s.x then + yaw = yaw + pi + end + + self.object:setyaw(yaw) + end + + self.state = "runaway" + self.runaway_timer = 0 + self.following = nil + end + + -- attack puncher and call other mobs for help + if self.passive == false + and self.state ~= "flop" + and self.child == false + and hitter:get_player_name() ~= self.owner then + + -- attack whoever punched mob + self.state = "" + do_attack(self, hitter) + + -- alert others to the attack + local obj = nil + + for _, oir in pairs(minetest.get_objects_inside_radius(hitter:getpos(), 5)) do + + obj = oir:get_luaentity() + + if obj then + + if obj.group_attack == true + and obj.state ~= "attack" then + do_attack(obj, hitter) end end end - end, + end +end - on_activate = function(self, staticdata, dtime_s) +local mob_activate = function(self, staticdata, dtime_s, def) - -- remove monsters in peaceful mode, or when no data - if (self.type == "monster" and peaceful_only) - or not staticdata then + -- remove monsters in peaceful mode, or when no data + if (self.type == "monster" and peaceful_only) + or not staticdata then + + self.object:remove() + + return + end + + -- load entity variables + local tmp = minetest.deserialize(staticdata) + + if tmp then + + for _,stat in pairs(tmp) do + self[_] = stat + end + end + + -- select random texture, set model and size + if not self.base_texture then + + self.base_texture = def.textures[math.random(1, #def.textures)] + self.base_mesh = def.mesh + self.base_size = self.visual_size + self.base_colbox = self.collisionbox + end + + -- set texture, model and size + local textures = self.base_texture + local mesh = self.base_mesh + local vis_size = self.base_size + local colbox = self.base_colbox + + -- specific texture if gotten + if self.gotten == true + and def.gotten_texture then + textures = def.gotten_texture + end + + -- specific mesh if gotten + if self.gotten == true + and def.gotten_mesh then + mesh = def.gotten_mesh + end + + -- set child objects to half size + if self.child == true then + + vis_size = { + x = self.base_size.x / 2, + y = self.base_size.y / 2 + } + + if def.child_texture then + textures = def.child_texture[1] + end + + colbox = { + self.base_colbox[1] / 2, + self.base_colbox[2] / 2, + self.base_colbox[3] / 2, + self.base_colbox[4] / 2, + self.base_colbox[5] / 2, + self.base_colbox[6] / 2 + } + end + + if self.health == 0 then + self.health = math.random (self.hp_min, self.hp_max) + end + + -- rnd: pathfinding init + self.path = {} + self.path.way = {} -- path to follow, table of positions + self.path.lastpos = {x = 0, y = 0, z = 0} + self.path.stuck = false + self.path.following = false -- currently following path? + self.path.stuck_timer = 0 -- if stuck for too long search for path + -- end init + + self.object:set_armor_groups({immortal = 1, fleshy = self.armor}) + self.old_y = self.object:getpos().y + self.old_health = self.health + self.object:setyaw((math.random(0, 360) - 180) / 180 * pi) + self.sounds.distance = self.sounds.distance or 10 + self.textures = textures + self.mesh = mesh + self.collisionbox = colbox + self.visual_size = vis_size + self.standing_in = "" + + -- set anything changed above + self.object:set_properties(self) + update_tag(self) +end + +local mob_step = function(self, dtime) + + local pos = self.object:getpos() + local yaw = self.object:getyaw() or 0 + + -- when lifetimer expires remove mob (except npc and tamed) + if self.type ~= "npc" + and not self.tamed + and self.state ~= "attack" + and remove_far ~= true then + + self.lifetimer = self.lifetimer - dtime + + if self.lifetimer <= 0 then + + -- only despawn away from player + local objs = minetest.get_objects_inside_radius(pos, 15) + + for _,oir in pairs(objs) do + + if oir:is_player() then + + self.lifetimer = 20 + + return + end + end + + minetest.log("action", + "lifetimer expired, removed " .. self.name) + + effect(pos, 15, "tnt_smoke.png") self.object:remove() return end + end - -- load entity variables - local tmp = minetest.deserialize(staticdata) + falling(self, pos) - if tmp then + -- knockback timer + if self.pause_timer > 0 then - for _,stat in pairs(tmp) do - self[_] = stat - end + self.pause_timer = self.pause_timer - dtime + + if self.pause_timer < 1 then + self.pause_timer = 0 end - -- select random texture, set model and size - if not self.base_texture then + return + end - self.base_texture = def.textures[math.random(1, #def.textures)] - self.base_mesh = def.mesh - self.base_size = self.visual_size - self.base_colbox = self.collisionbox + -- run custom function (defined in mob lua file) + if self.do_custom then + self.do_custom(self, dtime) + end + + -- attack timer + self.timer = self.timer + dtime + + if self.state ~= "attack" then + + if self.timer < 1 then + return end - -- set texture, model and size - local textures = self.base_texture - local mesh = self.base_mesh - local vis_size = self.base_size - local colbox = self.base_colbox + self.timer = 0 + end - -- specific texture if gotten - if self.gotten == true - and def.gotten_texture then - textures = def.gotten_texture - end + -- never go over 100 + if self.timer > 100 then + self.timer = 1 + end - -- specific mesh if gotten - if self.gotten == true - and def.gotten_mesh then - mesh = def.gotten_mesh - end + -- node replace check (cow eats grass etc.) + replace(self, pos) - -- set child objects to half size - if self.child == true then + -- mob plays random sound at times + if self.sounds.random + and math.random(1, 100) == 1 then - vis_size = { - x = self.base_size.x / 2, - y = self.base_size.y / 2 - } + minetest.sound_play(self.sounds.random, { + object = self.object, + max_hear_distance = self.sounds.distance + }) + end - if def.child_texture then - textures = def.child_texture[1] - end + -- environmental damage timer (every 1 second) + self.env_damage_timer = self.env_damage_timer + dtime - colbox = { - self.base_colbox[1] / 2, - self.base_colbox[2] / 2, - self.base_colbox[3] / 2, - self.base_colbox[4] / 2, - self.base_colbox[5] / 2, - self.base_colbox[6] / 2 - } - end + if (self.state == "attack" and self.env_damage_timer > 1) + or self.state ~= "attack" then - if self.health == 0 then - self.health = math.random (self.hp_min, self.hp_max) - end + self.env_damage_timer = 0 - -- rnd: pathfinding init - self.path = {} - self.path.way = {} -- path to follow, table of positions - self.path.lastpos = {x = 0, y = 0, z = 0} - self.path.stuck = false - self.path.following = false -- currently following path? - self.path.stuck_timer = 0 -- if stuck for too long search for path - -- end init + do_env_damage(self) + end - self.object:set_hp(self.health) - self.object:set_armor_groups({fleshy = self.armor}) - self.old_y = self.object:getpos().y - self.object:setyaw((math.random(0, 360) - 180) / 180 * pi) - self.sounds.distance = self.sounds.distance or 10 - self.textures = textures - self.mesh = mesh - self.collisionbox = colbox - self.visual_size = vis_size + monster_attack(self) - -- set anything changed above - self.object:set_properties(self) - update_tag(self) + npc_attack(self) + + breed(self) + + follow_flop(self) + + do_states(self, dtime) + +end + +-- default function when mobs are blown up with TNT +local do_tnt = function(obj, damage) + + --print ("----- Damage", damage) + + obj.object:punch(obj.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = damage}, + }, nil) + + return false, true, {} +end + +mobs.spawning_mobs = {} + +-- register mob function +function mobs:register_mob(name, def) + + mobs.spawning_mobs[name] = true + +minetest.register_entity(name, { + + stepheight = def.stepheight or 0.6, + name = name, + type = def.type, + attack_type = def.attack_type, + fly = def.fly, + fly_in = def.fly_in or "air", + owner = def.owner or "", + order = def.order or "", + on_die = def.on_die, + do_custom = def.do_custom, + jump_height = def.jump_height or 6, + jump_chance = def.jump_chance or 0, + drawtype = def.drawtype, -- DEPRECATED, use rotate instead + rotate = math.rad(def.rotate or 0), -- 0=front, 90=side, 180=back, 270=side2 + lifetimer = def.lifetimer or 180, -- 3 minutes + hp_min = def.hp_min or 5, + hp_max = def.hp_max or 10, + physical = true, + collisionbox = def.collisionbox, + visual = def.visual, + visual_size = def.visual_size or {x = 1, y = 1}, + mesh = def.mesh, + makes_footstep_sound = def.makes_footstep_sound or false, + view_range = def.view_range or 5, + walk_velocity = def.walk_velocity or 1, + run_velocity = def.run_velocity or 2, + damage = def.damage or 0, + light_damage = def.light_damage or 0, + water_damage = def.water_damage or 0, + lava_damage = def.lava_damage or 0, + fall_damage = def.fall_damage or 1, + fall_speed = def.fall_speed or -10, -- must be lower than -2 (default: -10) + drops = def.drops or {}, + armor = def.armor, + on_rightclick = def.on_rightclick, + arrow = def.arrow, + shoot_interval = def.shoot_interval, + sounds = def.sounds or {}, + animation = def.animation, + follow = def.follow, + jump = def.jump or true, + walk_chance = def.walk_chance or 50, + attacks_monsters = def.attacks_monsters or false, + group_attack = def.group_attack or false, + --fov = def.fov or 120, + passive = def.passive or false, + recovery_time = def.recovery_time or 0.5, + knock_back = def.knock_back or 3, + blood_amount = def.blood_amount or 5, + blood_texture = def.blood_texture or "mobs_blood.png", + shoot_offset = def.shoot_offset or 0, + floats = def.floats or 1, -- floats in water by default + replace_rate = def.replace_rate, + replace_what = def.replace_what, + replace_with = def.replace_with, + replace_offset = def.replace_offset or 0, + timer = 0, + env_damage_timer = 0, -- only used when state = "attack" + tamed = false, + pause_timer = 0, + horny = false, + hornytimer = 0, + child = false, + gotten = false, + health = 0, + reach = def.reach or 3, + htimer = 0, + child_texture = def.child_texture, + docile_by_day = def.docile_by_day or false, + time_of_day = 0.5, + fear_height = def.fear_height or 0, + runaway = def.runaway, + runaway_timer = 0, + pathfinding = def.pathfinding, + immune_to = def.immune_to or {}, + explosion_radius = def.explosion_radius, + custom_attack = def.custom_attack, + double_melee_attack = def.double_melee_attack, + + on_blast = def.on_blast or do_tnt, + + on_step = mob_step, + + on_punch = mob_punch, + + on_activate = function(self, staticdata, dtime_s) + mob_activate(self, staticdata, dtime_s, def) end, get_staticdata = function(self) @@ -2064,13 +2281,9 @@ end -- END mobs:register_mob function -- global functions -mobs.spawning_mobs = {} - function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height, day_toggle) - mobs.spawning_mobs[name] = true - -- chance override in minetest.conf for registered mob local new_chance = tonumber(minetest.setting_get(name .. "_chance")) @@ -2083,7 +2296,7 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, chance = new_chance - print ("[Mobs Redo] Chance setting for " .. name .. " is now " .. chance) + print ("[Mobs Redo] Chance setting for " .. name .. " changed to " .. chance) end @@ -2093,8 +2306,9 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, neighbors = neighbors, interval = interval, chance = chance, + catch_up = false, - action = function(pos, node, _, active_object_count_wider) + action = function(pos, node, aoc, active_object_count_wider) -- do not spawn if too many active entities in area if active_object_count_wider > active_object_count @@ -2181,7 +2395,7 @@ end -- compatibility with older mob registration function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height, day_toggle) - mobs:spawn_specific(name, nodes, {"air"}, min_light, max_light, 30, + mobs:spawn_specific(name, nodes, {"air"}, min_light, max_light, 10, chance, active_object_count, -31000, max_height, day_toggle) end @@ -2211,7 +2425,7 @@ function mobs:explosion(pos, radius, fire, smoke, sound) minetest.sound_play(sound, { pos = pos, - gain = 1.0, + gain = 0.7, max_hear_distance = 16 }) end @@ -2242,33 +2456,11 @@ function mobs:explosion(pos, radius, fire, smoke, sound) and data[vi] ~= c_chest then local n = node_ok(p).name + local on_blast = minetest.registered_nodes[n].on_blast - if minetest.get_item_group(n, "unbreakable") ~= 1 then - - -- if chest then drop items inside - if n == "default:chest" - or n == "3dchest:chest" - or n == "bones:bones" then - - local meta = minetest.get_meta(p) - local inv = meta:get_inventory() - - for i = 1, inv:get_size("main") do - - local m_stack = inv:get_stack("main", i) - local obj = minetest.add_item(p, m_stack) - - if obj then - - obj:setvelocity({ - x = math.random(-2, 2), - y = 7, - z = math.random(-2, 2) - }) - end - end - end - + if on_blast then + return on_blast(p) + else -- after effects if fire > 0 and (minetest.registered_nodes[n].groups.flammable @@ -2279,7 +2471,7 @@ function mobs:explosion(pos, radius, fire, smoke, sound) minetest.set_node(p, {name = "air"}) if smoke > 0 then - effect(p, 2, "mobs_blood.png", 5) + --effect(p, 2, "tnt_smoke.png", 5) end end end @@ -2312,7 +2504,7 @@ function mobs:register_arrow(name, def) timer = 0, switch = 0, - on_step = function(self, dtime) + on_step = def.on_step or function(self, dtime) self.timer = self.timer + 1 @@ -2327,6 +2519,13 @@ function mobs:register_arrow(name, def) return end + -- does arrow have a tail (fireball) + if def.tail + and def.tail == 1 + and def.tail_texture then + effect(pos, 1, def.tail_texture, 10, 0) + end + if self.hit_node then local node = node_ok(pos).name @@ -2388,18 +2587,27 @@ function mobs:register_arrow(name, def) end -- Spawn Egg -function mobs:register_egg(mob, desc, background, addegg) +function mobs:register_egg(mob, desc, background, addegg, no_creative) + + local grp = {} + + -- do NOT add this egg to creative inventory (e.g. dungeon master) + if creative and no_creative == true then + grp = {not_in_creative_inventory = 1} + end local invimg = background if addegg == 1 then - invimg = invimg .. "^mobs_chicken_egg.png" + invimg = "mobs_chicken_egg.png^(" .. invimg .. + "^[mask:mobs_chicken_egg_overlay.png)" end minetest.register_craftitem(mob, { description = desc, inventory_image = invimg, + groups = grp, on_place = function(itemstack, placer, pointed_thing) @@ -2414,6 +2622,11 @@ function mobs:register_egg(mob, desc, background, addegg) local mob = minetest.add_entity(pos, mob) local ent = mob:get_luaentity() + if not ent then + mob:remove() + return + end + if ent.type ~= "monster" then -- set owner and tame if not monster ent.owner = placer:get_player_name() @@ -2659,4 +2872,26 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) mob_sta[name] = nil end -end) \ No newline at end of file +end) + +-- compatibility function for old entities to new modpack entities +function mobs:alias_mob(old_name, new_name) + + -- spawn egg + minetest.register_alias(old_name, new_name) + + -- entity + minetest.register_entity(":" .. old_name, { + + physical = false, + + on_step = function(self) + + local pos = self.object:getpos() + + minetest.add_entity(pos, new_name) + + self.object:remove() + end + }) +end diff --git a/games/default/files/mobs/crafts.lua b/games/default/files/mobs_redo/crafts.lua similarity index 99% rename from games/default/files/mobs/crafts.lua rename to games/default/files/mobs_redo/crafts.lua index b6a7c6239..f6c1bc40f 100644 --- a/games/default/files/mobs/crafts.lua +++ b/games/default/files/mobs_redo/crafts.lua @@ -1,5 +1,5 @@ --- nametag +-- name tag minetest.register_craftitem("mobs:nametag", { description = "Nametag", inventory_image = "mobs_nametag.png", @@ -86,4 +86,4 @@ minetest.register_craft({ {'', 'default:steel_ingot', ''}, {'', 'group:stick', 'default:steel_ingot'}, } -}) \ No newline at end of file +}) diff --git a/games/default/files/mobs/depends.txt b/games/default/files/mobs_redo/depends.txt similarity index 100% rename from games/default/files/mobs/depends.txt rename to games/default/files/mobs_redo/depends.txt diff --git a/games/default/files/mobs_redo/init.lua b/games/default/files/mobs_redo/init.lua new file mode 100644 index 000000000..2fea94ba3 --- /dev/null +++ b/games/default/files/mobs_redo/init.lua @@ -0,0 +1,8 @@ + +local path = minetest.get_modpath("mobs") + +-- Mob API +dofile(path.."/api.lua") + +-- Mob Items +dofile(path.."/crafts.lua") diff --git a/games/default/files/mobs/license.txt b/games/default/files/mobs_redo/license.txt similarity index 80% rename from games/default/files/mobs/license.txt rename to games/default/files/mobs_redo/license.txt index 973364b7c..d5e9ea5ef 100644 --- a/games/default/files/mobs/license.txt +++ b/games/default/files/mobs_redo/license.txt @@ -1,13 +1,3 @@ --= MOBS-MOD for MINETEST =- by PilzAdam and KrupnovPavel -Little has changed. Removed some bugs. -The game now many living creatures. -The sheep and the rat from MOBS-MOD -Deer by Pavel_S - -All my models and change code on valid license The MIT License - - - The MIT License (MIT) Copyright (c) 2014 Krupnov Pavel @@ -28,4 +18,6 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file +THE SOFTWARE. + +Above license is for Krupnov Pavel's animals, the rest is WTFPL. \ No newline at end of file diff --git a/games/default/files/mobs_redo/mod.conf b/games/default/files/mobs_redo/mod.conf new file mode 100644 index 000000000..f3a3ad743 --- /dev/null +++ b/games/default/files/mobs_redo/mod.conf @@ -0,0 +1 @@ +name = mobs diff --git a/games/default/files/mobs_redo/readme.MD b/games/default/files/mobs_redo/readme.MD new file mode 100644 index 000000000..d31af5a4c --- /dev/null +++ b/games/default/files/mobs_redo/readme.MD @@ -0,0 +1,59 @@ + +MOBS REDO for MINETEST + +Credits: +https://github.com/blert2112/mobs_more_animals/tree/master/mobs_wolf +https://github.com/blert2112/mobs_more_animals/tree/master/mobs_bear +https://github.com/blert2112/mobs_more_monsters/tree/master/mobs_zombie +https://github.com/tenplus1/mobs + +Built from PilzAdam's original Simple Mobs with additional mobs by KrupnovPavel, Zeg9, ExeterDad, AspireMint, TenPlus1, kaadmy, blert2112 and MoNTE48. + +This mod contains the API only for adding your own mobs into the world, so please use the additional modpacks to add animals, monsters etc. + + +https://forum.minetest.net/viewtopic.php?f=11&t=9917 + + +Changelog: + +- 1.29- Split original Mobs Redo into a modpack to make it easier to disable mob sets (animal, monster, npc) or simply use the Api itself for your own mod +- 1.28- New damage system added with ability for mob to be immune to weapons or healed by them :) +- 1.27- Added new sheep, lava flan and spawn egg textures. New Lava Pick tool smelts what you dig. New atan checking function. +- 1.26- Pathfinding feature added thanks to rnd, when monsters attack they become scary smart in finding you :) also, beehive produces honey now :) +- 1.25- Mobs no longer spawn within 12 blocks of player or despawn within same range, spawners now have player detection, Code tidy and tweak. +- 1.24- Added feature where certain animals run away when punched (runaway = true in mob definition) +- 1.23- Added mob spawner block for admin to setup spawners in-game (place and right click to enter settings) +- 1.22- Added ability to name tamed animals and npc using nametags, also npc will attack anyone who punches them apart from owner +- 1.21- Added some more error checking to reduce serialize.h error and added height checks for falling off cliffs (thanks cmdskp) +- 1.20- Error checking added to remove bad mobs, out of map limit mobs and stop serialize.h error +- 1.19- Chickens now drop egg items instead of placing the egg, also throwing eggs result in 1/8 chance of spawning chick +- 1.18- Added docile_by_day flag so that monsters will not attack automatically during daylight hours unless hit first +- 1.17- Added 'dogshoot' attack type, shoots when out of reach, melee attack when in reach, also api tweaks and self.reach added +- 1.16- Mobs follow multiple items now, Npc's can breed +- 1.15- Added Feeding/Taming/Breeding function, right-click to pick up any sheep with X mark on them and replace with new one to fix compatibility. +- 1.14- All .self variables saved in staticdata, Fixed self.health bug +- 1.13- Added capture function (thanks blert2112) chance of picking up mob with hand; net; magic lasso, replaced some .x models with newer .b3d one's +- 1.12- Added animal ownership so that players cannot steal your tamed animals +- 1.11- Added flying mobs (and swimming), fly=true and fly_in="air" or "deafult:water_source" for fishy +- 1,10- Footstep removed (use replace), explosion routine added for exploding mobs. +- 1.09- reworked breeding routine, added mob rotation value, added footstep feature, added jumping mobs with sounds feature, added magic lasso for picking up animals +- 1.08- Mob throwing attack has been rehauled so that they can damage one another, also drops and on_die function added +- 1.07- Npc's can now be set to follow player or stand by using self.order and self.owner variables +- beta- Npc mob added, kills monsters, attacks player when punched, right click with food to heal or gold lump for drop +- 1.06- Changed recovery times after breeding, and time taken to grow up (can be sped up by feeding baby animal) +- 1.05- Added ExeterDad's bunny's which can be picked up and tamed with 4 carrots from farming redo or farming_plus, also shears added to get wool from sheep and lastly Jordach/BSD's kitten +- 1.04- Added mating for sheep, cows and hogs... feed animals to make horny and hope for a baby which is half size, will grow up quick though :) +- 1.03- Added mob drop/replace feature so that chickens can drop eggs, cow/sheep can eat grass/wheat etc. +- 1.02- Sheared sheep are remembered and spawn shaven, Warthogs will attack when threatened, Api additions +- 1.01- Mobs that suffer fall damage or die in water/lava/sunlight will now drop items +- 1.0 - more work on Api so that certain mobs can float in water while some sink like a brick :) +- 0.9 - Spawn eggs added for all mobs (admin only, cannot be placed in protected areas)... Api tweaked +- 0.8 - Added sounds to monster mobs (thanks Cyberpangolin for the sfx) and also chicken sound +- 0.7 - mobs.protected switch added to api.lua, when set to 1 mobs no longer spawn in protected areas, also bug fixes +- 0.6 - Api now supports multi-textured mobs, e.g oerkki, dungeon master, rats and chickens have random skins when spawning (sheep fix TODO), also new Honey block +- 0.5 - Mobs now float in water, die from falling, and some code improvements +- 0.4 - Dungeon Masters and Mese Monsters have much better aim due to shoot_offset, also they can both shoot through nodes that aren't walkable (flowers, grass etc) plus new sheep sound :) +- 0.3 - Added LOTT's Spider mob, made Cobwebs, added KPavel's Bee with Honey and Beehives (made texture), Warthogs now have sound and can be tamed, taming of shaved sheep or milked cow with 8 wheat so it will not despawn, many bug fixes :) +- 0.2 - Cooking bucket of milk into cheese now returns empty bucket +- 0.1 - Initial Release diff --git a/games/default/files/mobs/sounds/default_punch.ogg b/games/default/files/mobs_redo/sounds/default_punch.ogg similarity index 100% rename from games/default/files/mobs/sounds/default_punch.ogg rename to games/default/files/mobs_redo/sounds/default_punch.ogg diff --git a/games/default/files/mobs_redo/textures/mobs_chicken_cooked.png b/games/default/files/mobs_redo/textures/mobs_chicken_cooked.png new file mode 100644 index 000000000..9b116294f Binary files /dev/null and b/games/default/files/mobs_redo/textures/mobs_chicken_cooked.png differ diff --git a/games/default/files/mobs_redo/textures/mobs_chicken_egg.png b/games/default/files/mobs_redo/textures/mobs_chicken_egg.png new file mode 100644 index 000000000..ab5b2fbcc Binary files /dev/null and b/games/default/files/mobs_redo/textures/mobs_chicken_egg.png differ diff --git a/games/default/files/mobs_redo/textures/mobs_chicken_egg_overlay.png b/games/default/files/mobs_redo/textures/mobs_chicken_egg_overlay.png new file mode 100644 index 000000000..7ca75ecdf Binary files /dev/null and b/games/default/files/mobs_redo/textures/mobs_chicken_egg_overlay.png differ diff --git a/games/default/files/mobs_redo/textures/mobs_chicken_raw.png b/games/default/files/mobs_redo/textures/mobs_chicken_raw.png new file mode 100644 index 000000000..4c003e537 Binary files /dev/null and b/games/default/files/mobs_redo/textures/mobs_chicken_raw.png differ diff --git a/games/default/files/mobs/textures/mobs_leather.png b/games/default/files/mobs_redo/textures/mobs_leather.png similarity index 100% rename from games/default/files/mobs/textures/mobs_leather.png rename to games/default/files/mobs_redo/textures/mobs_leather.png diff --git a/games/default/files/mobs/textures/mobs_magic_lasso.png b/games/default/files/mobs_redo/textures/mobs_magic_lasso.png similarity index 100% rename from games/default/files/mobs/textures/mobs_magic_lasso.png rename to games/default/files/mobs_redo/textures/mobs_magic_lasso.png diff --git a/games/default/files/mobs/textures/mobs_meat.png b/games/default/files/mobs_redo/textures/mobs_meat.png similarity index 100% rename from games/default/files/mobs/textures/mobs_meat.png rename to games/default/files/mobs_redo/textures/mobs_meat.png diff --git a/games/default/files/mobs/textures/mobs_meat_raw.png b/games/default/files/mobs_redo/textures/mobs_meat_raw.png similarity index 100% rename from games/default/files/mobs/textures/mobs_meat_raw.png rename to games/default/files/mobs_redo/textures/mobs_meat_raw.png diff --git a/games/default/files/mobs/textures/mobs_nametag.png b/games/default/files/mobs_redo/textures/mobs_nametag.png similarity index 100% rename from games/default/files/mobs/textures/mobs_nametag.png rename to games/default/files/mobs_redo/textures/mobs_nametag.png diff --git a/games/default/files/mobs/textures/mobs_shears.png b/games/default/files/mobs_redo/textures/mobs_shears.png similarity index 100% rename from games/default/files/mobs/textures/mobs_shears.png rename to games/default/files/mobs_redo/textures/mobs_shears.png diff --git a/games/default/files/playerplus/init.lua b/games/default/files/playerplus/init.lua index 08b669f43..f2b306ffa 100644 --- a/games/default/files/playerplus/init.lua +++ b/games/default/files/playerplus/init.lua @@ -1,116 +1,116 @@ ---[[ - walking on ice makes player walk faster, - stepping through snow or water slows player down, - touching a cactus hurts player, - stuck inside node suffocates player. - - PlayerPlus by TenPlus1 -]] - --- get node but use fallback for nil or unknown -local function node_ok(pos, fallback) - - fallback = fallback or "air" - - local node = minetest.get_node_or_nil(pos) - - if not node then - return fallback - end - - if minetest.registered_nodes[node.name] then - return node.name - end - - return fallback -end - -local pp = {} -local def = {} -local time = 0 - -minetest.register_globalstep(function(dtime) - - time = time + dtime - - -- every 1 second - if time < 1 then - return - end - - -- reset time for next check - time = 0 - - -- check players - for _,player in pairs(minetest.get_connected_players()) do - - -- where am I? - local pos = player:getpos() - - -- what is around me? - pos.y = pos.y - 0.1 -- standing on - local nod_stand = node_ok(pos) - - pos.y = pos.y + 1.5 -- head level - local nod_head = node_ok(pos) - - pos.y = pos.y - 1.2 -- feet level - local nod_feet = node_ok(pos) - - pos.y = pos.y - 0.2 -- reset pos - - -- is 3d_armor mod active? if so make armor physics default - if minetest.get_modpath("3d_armor") then - def = armor.def[player:get_player_name()] or {} - end - - -- set to armor physics or defaults - pp.speed = def.speed or 1 - pp.jump = def.jump or 1 - pp.gravity = def.gravity or 1 - - -- standing on ice? if so walk faster - if nod_stand == "default:ice" then - pp.speed = pp.speed + 0.6 - end - - -- standing on snow? if so walk slower - if nod_stand == "default:snow" - or nod_stand == "default:snowblock" - -- wading in water? if so walk slower - or minetest.registered_nodes[nod_feet].groups.water then - pp.speed = pp.speed - 0.1 - end - - -- set player physics - player:set_physics_override(pp.speed, pp.jump, pp.gravity) - --print ("Speed:", pp.speed, "Jump:", pp.jump, "Gravity:", pp.gravity) - - -- is player suffocating inside node? (only solid "normal" type nodes) - if minetest.registered_nodes[nod_head].walkable - and minetest.registered_nodes[nod_head].drawtype == "normal" - and not minetest.check_player_privs(player:get_player_name(), {noclip = true}) then - - if player:get_hp() > 0 then - player:set_hp(player:get_hp() - 2) - end - end - - -- am I near a cactus? - local near = minetest.find_node_near(pos, 1, "default:cactus") - - if near then - - -- am I touching the cactus? if so it hurts - for _,object in pairs(minetest.get_objects_inside_radius(near, 1.1)) do - - if object:get_hp() > 0 then - object:set_hp(object:get_hp() - 2) - end - end - - end - - end - -end) +--[[ + walking on ice makes player walk faster, + stepping through snow or water slows player down, + touching a cactus hurts player, + stuck inside node suffocates player. + + PlayerPlus by TenPlus1 +]] + +-- get node but use fallback for nil or unknown +local function node_ok(pos, fallback) + + fallback = fallback or "air" + + local node = minetest.get_node_or_nil(pos) + + if not node then + return fallback + end + + if minetest.registered_nodes[node.name] then + return node.name + end + + return fallback +end + +local pp = {} +local def = {} +local time = 0 + +minetest.register_globalstep(function(dtime) + + time = time + dtime + + -- every 1 second + if time < 1 then + return + end + + -- reset time for next check + time = 0 + + -- check players + for _,player in pairs(minetest.get_connected_players()) do + + -- where am I? + local pos = player:getpos() + + -- what is around me? + pos.y = pos.y - 0.1 -- standing on + local nod_stand = node_ok(pos) + + pos.y = pos.y + 1.5 -- head level + local nod_head = node_ok(pos) + + pos.y = pos.y - 1.2 -- feet level + local nod_feet = node_ok(pos) + + pos.y = pos.y - 0.2 -- reset pos + + -- is 3d_armor mod active? if so make armor physics default + if minetest.get_modpath("3d_armor") then + def = armor.def[player:get_player_name()] or {} + end + + -- set to armor physics or defaults + pp.speed = def.speed or 1 + pp.jump = def.jump or 1 + pp.gravity = def.gravity or 1 + + -- standing on ice? if so walk faster + if nod_stand == "default:ice" then + pp.speed = pp.speed + 0.6 + end + + -- standing on snow? if so walk slower + if nod_stand == "default:snow" + or nod_stand == "default:snowblock" + -- wading in water? if so walk slower + or minetest.registered_nodes[nod_feet].groups.water then + pp.speed = pp.speed - 0.1 + end + + -- set player physics + player:set_physics_override(pp.speed, pp.jump, pp.gravity) + --print ("Speed:", pp.speed, "Jump:", pp.jump, "Gravity:", pp.gravity) + + -- is player suffocating inside node? (only solid "normal" type nodes) + if minetest.registered_nodes[nod_head].walkable + and minetest.registered_nodes[nod_head].drawtype == "normal" + and not minetest.check_player_privs(player:get_player_name(), {noclip = true}) then + + if player:get_hp() > 0 then + player:set_hp(player:get_hp() - 2) + end + end + + -- am I near a cactus? + local near = minetest.find_node_near(pos, 1, "default:cactus") + + if near then + + -- am I touching the cactus? if so it hurts + for _,object in pairs(minetest.get_objects_inside_radius(near, 1.1)) do + + if object:get_hp() > 0 then + object:set_hp(object:get_hp() - 2) + end + end + + end + + end + +end) diff --git a/games/default/files/railtrack/textures/carts_rail_brk.png b/games/default/files/railtrack/textures/carts_rail_brk.png index 990087f29..23d396ce3 100644 Binary files a/games/default/files/railtrack/textures/carts_rail_brk.png and b/games/default/files/railtrack/textures/carts_rail_brk.png differ diff --git a/games/default/files/railtrack/textures/carts_rail_swt.png b/games/default/files/railtrack/textures/carts_rail_swt.png index 08eadc708..4dbfe2e49 100644 Binary files a/games/default/files/railtrack/textures/carts_rail_swt.png and b/games/default/files/railtrack/textures/carts_rail_swt.png differ diff --git a/games/default/files/railtrack/textures/carts_rail_t_junction_brk.png b/games/default/files/railtrack/textures/carts_rail_t_junction_brk.png index 850526408..e32581a03 100644 Binary files a/games/default/files/railtrack/textures/carts_rail_t_junction_brk.png and b/games/default/files/railtrack/textures/carts_rail_t_junction_brk.png differ diff --git a/games/default/files/railtrack/textures/carts_rail_t_junction_swt.png b/games/default/files/railtrack/textures/carts_rail_t_junction_swt.png index bb3dc09ce..75edd900f 100644 Binary files a/games/default/files/railtrack/textures/carts_rail_t_junction_swt.png and b/games/default/files/railtrack/textures/carts_rail_t_junction_swt.png differ diff --git a/games/default/files/railtrack/textures/railtrack_fixer.png b/games/default/files/railtrack/textures/railtrack_fixer.png index 77e10bb42..1b32e3f82 100644 Binary files a/games/default/files/railtrack/textures/railtrack_fixer.png and b/games/default/files/railtrack/textures/railtrack_fixer.png differ