0
0
Fork 0

Update Mobs redo and add mobs_mc, modified

This commit is contained in:
Wuzzy 2017-01-16 17:40:08 +01:00
parent 8619545f48
commit 8a5fc728ad
275 changed files with 88778 additions and 19881 deletions

View File

@ -637,7 +637,7 @@ minetest.register_craft({
minetest.register_craft({
type = 'shapeless',
output = 'default:book',
recipe = { 'default:paper', 'default:paper', 'default:paper', 'mobs:leather',
recipe = { 'default:paper', 'default:paper', 'default:paper', 'mcl_mobitems:leather',
}
})

View File

@ -338,11 +338,11 @@ minetest.register_tool("default:pole", {
-- TODO: Damaged
itemname = "default:pole"
elseif r <= 22 then
itemname = "mobs:leather"
itemname = "mcl_mobitems:leather"
elseif r <= 32 then
itemname = "3d_armor:boots_leather"
elseif r <= 42 then
itemname = "mobs:rotten_flesh"
itemname = "mcl_mobitems:rotten_flesh"
elseif r <= 47 then
itemname = "default:stick"
elseif r <= 52 then
@ -372,7 +372,7 @@ minetest.register_tool("default:pole", {
-- TODO: Enchanted and damaged
itemname = "default:pole"
elseif r == 4 then
itemname = "mobs:spider_eye"
itemname = "mcl_mobitems:spider_eye"
-- TODO itemname = "mobs:naming_tag"
elseif r == 5 then
itemname = "flowers:dandelion"

247
mods/mcl_mobitems/init.lua Normal file
View File

@ -0,0 +1,247 @@
-- TODO: Add special status effects for raw flesh
minetest.register_craftitem("mcl_mobitems:rotten_flesh", {
description = "Rotten Flesh",
inventory_image = "mcl_mobitems_rotten_flesh.png",
wield_image = "mcl_mobitems_rotten_flesh.png",
-- TODO: Raise to 4
on_use = minetest.item_eat(1),
groups = { food = 2, eatable = 1 },
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:mutton", {
description = "Raw Mutton",
inventory_image = "mcl_mobitems_mutton_raw.png",
wield_image = "mcl_mobitems_mutton_raw.png",
on_use = minetest.item_eat(2),
groups = { food = 2, eatable = 2 },
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:cooked_mutton", {
description = "Cooked Mutton",
inventory_image = "mcl_mobitems_mutton_cooked.png",
wield_image = "mcl_mobitems_mutton_cooked.png",
on_use = minetest.item_eat(6),
groups = { food = 2, eatable = 6 },
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:beef", {
description = "Raw Beef",
inventory_image = "mcl_mobitems_beef_raw.png",
wield_image = "mcl_mobitems_beef_raw.png",
on_use = minetest.item_eat(3),
groups = { food = 2, eatable = 3 },
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:cooked_beef", {
description = "Steak",
inventory_image = "mcl_mobitems_beef_cooked.png",
wield_image = "mcl_mobitems_beef_cooked.png",
on_use = minetest.item_eat(8),
groups = { food = 2, eatable = 8 },
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:chicken", {
description = "Raw Chicken",
inventory_image = "mcl_mobitems_chicken_raw.png",
wield_image = "mcl_mobitems_chicken_raw.png",
on_use = minetest.item_eat(2),
groups = { food = 2, eatable = 2 },
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:cooked_chicken", {
description = "Cooked Chicken",
inventory_image = "mcl_mobitems_chicken_cooked.png",
wield_image = "mcl_mobitems_chicken_cooked.png",
on_use = minetest.item_eat(6),
groups = { food = 2, eatable = 6 },
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:porkchop", {
description = "Raw Porkchop",
inventory_image = "mcl_mobitems_porkchop_raw.png",
wield_image = "mcl_mobitems_porkchop.png",
on_use = minetest.item_eat(3),
groups = { food = 2, eatable = 3 },
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:cooked_porkchop", {
description = "Cooked Porkchop",
inventory_image = "mcl_mobitems_porkchop_cooked.png",
wield_image = "mcl_mobitems_porkchop_cooked.png",
on_use = minetest.item_eat(8),
groups = { food = 2, eatable = 8 },
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:rabbit", {
description = "Raw Rabbit",
inventory_image = "mcl_mobitems_rabbit_raw.png",
wield_image = "mcl_mobitems_rabbit_raw.png",
on_use = minetest.item_eat(3),
groups = { food = 2, eatable = 3 },
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:cooked_rabbit", {
description = "Cooked Rabbit",
inventory_image = "mcl_mobitems_rabbit_cooked.png",
wield_image = "mcl_mobitems_rabbit_cooked.png",
on_use = minetest.item_eat(5),
groups = { food = 2, eatable = 5 },
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:spider_eye", {
description = "Spider Eye",
inventory_image = "mcl_mobitems_spider_eye.png",
wield_image = "mcl_mobitems_spider_eye.png",
on_use = minetest.item_eat(2),
groups = { food = 2, eatable = 2 },
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:blaze_rod", {
description = "Blaze Rod",
wield_image = "mcl_mobitems_blaze_rod.png",
inventory_image = "mcl_mobitems_blaze_rod.png",
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:blaze_powder", {
description = "Blaze Powder",
wield_image = "mcl_mobitems_blaze_powder.png",
inventory_image = "mcl_mobitems_blaze_powder.png",
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:magma_cream", {
description = "Magma Cream",
wield_image = "mcl_mobitems_magma_cream.png",
inventory_image = "mcl_mobitems_magma_cream.png",
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:ghast_tear", {
description = "Ghast Tear",
wield_image = "mcl_mobitems_ghast_tear.png",
inventory_image = "mcl_mobitems_ghast_tear.png",
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:nether_star", {
description = "Nether Star",
wield_image = "mcl_mobitems_nether_star.png",
inventory_image = "mcl_mobitems_nether_star.png",
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:leather", {
description = "Leather",
wield_image = "mcl_mobitems_leather.png",
inventory_image = "mcl_mobitems_leather.png",
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:feather", {
description = "Feather",
wield_image = "mcl_mobitems_feather.png",
inventory_image = "mcl_mobitems_feather.png",
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:rabbit_hide", {
description = "Rabbit Hide",
wield_image = "mcl_mobitems_rabbit_hide.png",
inventory_image = "mcl_mobitems_rabbit_hide.png",
stack_max = 64,
})
minetest.register_craftitem("mcl_mobitems:rabbit_foot", {
description = "Rabbit's Foot",
wield_image = "mcl_mobitems_rabbit_foot.png",
inventory_image = "mcl_mobitems_rabbit_foot.png",
stack_max = 64,
})
-----------
-- Crafting
-----------
minetest.register_craft({
output = "mcl_mobitems:leather",
recipe = {
{ "mcl_mobitems:rabbit_hide", "mcl_mobitems:rabbit_hide" },
{ "mcl_mobitems:rabbit_hide", "mcl_mobitems:rabbit_hide" },
}
})
minetest.register_craft({
output = "mcl_mobitems:blaze_powder 2",
recipe = {{"mcl_mobitems:blaze_rod"}},
})
minetest.register_craft({
type = "shapeless",
output = "mcl_mobitems:magma_cream",
recipe = {"mcl_mobitems:blaze_powder", "mesecons_materials:glue"},
})
minetest.register_craft({
type = "cooking",
output = "mcl_mobitems:cooked_mutton",
recipe = "mcl_mobitems:mutton",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_mobitems:cooked_rabbit",
recipe = "mcl_mobitems:rabbit",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_mobitems:cooked_chicken",
recipe = "mcl_mobitems:chicken",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_mobitems:cooked_beef",
recipe = "mcl_mobitems:beef",
cooktime = 10,
})
minetest.register_craft({
type = "fuel",
recipe = "mcl_mobitems:blaze_rod",
burntime = 120,
})
-- Temporary helper recipes
-- TODO: Remove them
minetest.register_craft({
type = "shapeless",
output = "mcl_mobitems:leather",
recipe = { "default:paper", "default:paper" },
})
minetest.register_craft({
output = "mcl_mobitems:feather 3",
recipe = {
{ "flowers:oxeye_daisy" },
{ "flowers:oxeye_daisy" },
}
})

View File

@ -0,0 +1 @@
name = mcl_mobitems

View File

Before

Width:  |  Height:  |  Size: 452 B

After

Width:  |  Height:  |  Size: 452 B

View File

Before

Width:  |  Height:  |  Size: 482 B

After

Width:  |  Height:  |  Size: 482 B

View File

Before

Width:  |  Height:  |  Size: 516 B

After

Width:  |  Height:  |  Size: 516 B

View File

Before

Width:  |  Height:  |  Size: 314 B

After

Width:  |  Height:  |  Size: 314 B

View File

Before

Width:  |  Height:  |  Size: 159 B

After

Width:  |  Height:  |  Size: 159 B

View File

Before

Width:  |  Height:  |  Size: 447 B

After

Width:  |  Height:  |  Size: 447 B

View File

Before

Width:  |  Height:  |  Size: 523 B

After

Width:  |  Height:  |  Size: 523 B

View File

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 255 B

View File

Before

Width:  |  Height:  |  Size: 609 B

After

Width:  |  Height:  |  Size: 609 B

View File

Before

Width:  |  Height:  |  Size: 207 B

After

Width:  |  Height:  |  Size: 207 B

View File

Before

Width:  |  Height:  |  Size: 329 B

After

Width:  |  Height:  |  Size: 329 B

View File

Before

Width:  |  Height:  |  Size: 762 B

After

Width:  |  Height:  |  Size: 762 B

View File

Before

Width:  |  Height:  |  Size: 395 B

After

Width:  |  Height:  |  Size: 395 B

View File

Before

Width:  |  Height:  |  Size: 376 B

After

Width:  |  Height:  |  Size: 376 B

View File

Before

Width:  |  Height:  |  Size: 314 B

After

Width:  |  Height:  |  Size: 314 B

View File

Before

Width:  |  Height:  |  Size: 712 B

After

Width:  |  Height:  |  Size: 712 B

View File

Before

Width:  |  Height:  |  Size: 425 B

After

Width:  |  Height:  |  Size: 425 B

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 695 B

After

Width:  |  Height:  |  Size: 695 B

View File

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

View File

@ -1,42 +0,0 @@
=== MOBS-MOD for MINETEST-C55 ===
by PilzAdam
Inroduction:
This mod adds some basic hostile and friendly mobs to the game.
How to install:
Unzip the archive an place it in minetest-base-directory/mods/minetest/
if you have a windows client or a linux run-in-place client. If you have
a linux system-wide instalation place it in ~/.minetest/mods/minetest/.
If you want to install this mod only in one world create the folder
worldmods/ in your worlddirectory.
For further information or help see:
http://wiki.minetest.com/wiki/Installing_Mods
How to use the mod:
See https://github.com/PilzAdam/mobs/wiki
For developers:
The API documentation is moved to https://github.com/PilzAdam/mobs/wiki/API
License:
Sourcecode: WTFPL (see below)
Grahpics: WTFPL (see below)
Models: WTFPL (by Pavel_S, see below)
See also:
http://minetest.net/
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

File diff suppressed because it is too large Load Diff

259
mods/mobs/api.txt Normal file
View File

@ -0,0 +1,259 @@
MOB API (28th September 2016)
The mob api is a function that can be called on by other mods to add new animals or monsters into minetest.
minetest.conf settings*
'enable_damage' if true monsters will attack players (default is true)
'only_peaceful_mobs' if true only animals will spawn in game (default is false)
'mobs_disable_blood' if false blood effects appear when mob is hit (default is false)
'mobs_spawn_protected' if set to 1 then mobs will not spawn in protected areas (default is 0)
'remove_far_mobs' if true then mobs that are outside players visual range will be removed (default is false)
'mobname' can change specific mob chance rate (0 to disable) and spawn number e.g. mobs_animal:cow = 1000,5
'mob_difficulty' sets difficulty level (health and hit damage multiplied by this number), defaults to 1.0.
mobs:register_mob(name, definition)
This functions registers a new mob as a Minetest entity.
'name' is the name of the mob (e.g. "mobs:dirt_monster")
definition is a table with the following fields
'type' the type of the mob ("monster", "animal" or "npc")
'passive' will mob defend itself, set to false to attack
'docile_by_day' when true, mob will not attack during daylight hours unless provoked
'attacks_monsters' usually for npc's to attack monsters in area
'group_attack' true to defend same kind of mobs from attack in area
'attack_animals' true for monster to attack animals as well as player and npc's
'attack_specific' has a table of entity names that monsters can attack {"player", "mobs_animal:chicken"}
'hp_min' minimum health
'hp_max' maximum health (mob health is randomly selected between both)
'physical' same is in minetest.register_entity()
'collisionbox' same is in minetest.register_entity()
'visual' same is in minetest.register_entity()
'visual_size' same is in minetest.register_entity()
'textures' same is in minetest.register_entity()
although you can add multiple lines for random textures {{"texture1.png"},{"texture2.png"}},
'gotten_texture' alt. texture for when self.gotten value is set to true (used for shearing sheep)
'child_texture' texture of mod for when self.child is set to true
'mesh' same is in minetest.register_entity()
'gotten_mesh' alternative mesh for when self.gotten is true (used for sheep)
'makes_footstep_sound' same is in minetest.register_entity()
'follow' item when held will cause mob to follow player, can be single string "default:apple" or table {"default:apple", "default:diamond"}
'view_range' the range in that the monster will see the playerand follow him
'walk_chance' chance of mob walking around
'jump_chance' chance of mob jumping around, set above to 0 for jumping mob only
'walk_velocity' the velocity when the monster is walking around
'run_velocity' the velocity when the monster is attacking a player
'runaway' when true mob will turn and run away when punched
'stepheight' minimum node height mob can walk onto without jumping (default: 0.6)
'jump' can mob jump, true or false
'jump_height' height mob can jump, default is 6
'fly' can mob fly, true or false (used for swimming mobs also)
'fly_in' node name that mob flys inside, e.g "air", "default:water_source" for fish
'damage' the damage per second
'recovery_time' how much time from when mob is hit to recovery (default: 0.5)
'knock_back' strength of knock-back when mob hit (default: 3)
'immune_to' table holding special tool/item names and damage the incur e.g.
{"default:sword_wood", 0}, {"default:gold_lump", -10} immune to sword, gold lump heals
'blood_amount' number of droplets that appear when hit
'blood_texture' texture of blood droplets (default: "mobs_blood.png")
'drops' is list of tables with the following fields:
'name' itemname e.g. default:stone
'chance' the inverted chance (same as in abm) to get the item
'min' the minimum number of items
'max' the maximum number of items
'armor' the armor (integer)(3=lowest; 1=highest)(fleshy group is used)
'drawtype' "front" or "side" (DEPRECATED, replaced with below)
'rotate' set mob rotation, 0=front, 90=side, 180=back, 270=other side
'water_damage' the damage per second if the mob is in water
'lava_damage' the damage per second if the mob is in lava
'light_damage' the damage per second if the mob is in light
'fall_damage' will mob be hurt when falling from height
'fall_speed' speed mob falls (default: -10 and has to be lower than -2)
'fear_height' when mob walks near a drop then anything over this value makes it stop and turn back (default is 0 to disable)
'on_die' a function that is called when the mob is killed the parameters are (self, pos)
'floats' 1 to float in water, 0 to sink
'on_rightclick' its same as in minetest.register_entity()
'pathfinding' set to 1 for mobs to use pathfinder feature to locate player, set to 2 so they can build/break also (only works with dogfight attack)
'attack_type' the attack type of a monster
'dogfight' follows player in range and attacks when in reach
'shoot' shoots defined arrows when player is within range
'explode' follows player in range and will flash and explode when in reach
'dogshoot' shoots arrows when in range and one on one attack when in reach
'dogshoot_switch' allows switching between shoot and dogfight modes inside dogshoot using timer (1 = shoot, 2 = dogfight)
'dogshoot_count_max' number of seconds before switching above modes.
'custom_attack' is a function that is called when mob is in range to attack player, parameters are (self, to_attack)
'double_melee_attack' if false then api will choose randomly between 'punch' and 'punch2' attack animations
'on_blast' is called when TNT explodes near mob, function uses (object, damage) and returns (do_damage, do_knockback, drops)
'explosion_radius' radius of explosion attack (defaults to 1)
'arrow' if the attack_type is "shoot" or "dogshoot" then the entity name of the arrow is required
'shoot_interval' the minimum shoot interval
'shoot_offset' +/- value to position arrow/fireball when fired
'reach' how far a reach this mob has, default is 3
'sounds' this is a table with sounds of the mob
'random' random sounds during gameplay
'war_cry' sound when starting to attack player
'attack' sound when attacking player
'shoot_attack' sound when attacking player by shooting arrow/entity
'damage' sound when being hit
'death' sound when killed
'jump' sound when jumping
'explode' sound when exploding
'distance' maximum distance sounds are heard from (default is 10)
'animation' a table with the animation ranges and speed of the model
'stand_start' start frame of stand animation
'stand_end' end frame of stand animation
'walk_start' start frame of walk animation
'walk_end' end frame of walk animation
'run_start' start frame of run animation
'run_end' end frame of run animation
'punch_start' start frame of punch animation
'punch_end' end frame of punch animation
'punch2_start' start frame of alt.punch animation
'punch2_end' end frame of alt.punch animation
'shoot_start' start frame of shoot animation
'shoot_end' end frame of shoot animation
'speed_normal' normal animation speed
'speed_run' running animation speed
'speed_punch' punching animation speed
'speed_punch2' alternative punching animation speed
'speed_shoot' shooting animation speed
'replace_what' group if items to replace e.g. {"farming:wheat_8", "farming:carrot_8"}
'replace_with' replace with what e.g. "air" or in chickens case "mobs:egg"
'replace_rate' how random should the replace rate be (typically 10)
'replace_offset' +/- value to check specific node to replace
The mob api also has some preset variables and functions that it will remember for each mob
'self.gotten' this is used for obtaining milk from cow and wool from sheep
'self.horny' when animal fed enough it is set to true and animal can breed with same animal
'self.child' used for when breeding animals have child, will use child_texture and be half size
'self.owner' string used to set owner of npc mobs, typically used for dogs
'self.order' set to "follow" or "stand" so that npc will follow owner or stand it's ground
'on_die' a function that is called when mob is killed
'do_custom' a custom function that is called while mob is active and which has access to all of the self.* variables e.g. (self.health for health or self.standing_in for node status), return with 'false' to skip remainder of mob API.
mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height, day_toggle)
mobs:spawn_specfic(name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height, day_toggle, on_spawn)
These functions register a spawn algorithm for the mob. Without this function the call the mobs won't spawn.
'name' is the name of the animal/monster
'nodes' is a list of nodenames on that the animal/monster can spawn on top of
'neighbors' is a list of nodenames on that the animal/monster will spawn beside (default is {"air"} for mobs:register_spawn)
'max_light' is the maximum of light
'min_light' is the minimum of light
'interval' is same as in register_abm() (default is 30 for mobs:register_spawn)
'chance' is same as in register_abm()
'active_object_count' mob is only spawned if active_object_count_wider of ABM is <= this
'min_height' is the maximum height the mob can spawn
'max_height' is the maximum height the mob can spawn
'day_toggle' true for day spawning, false for night or nil for anytime
'on_spawn' is a custom function which runs after mob has spawned and gives self and pos values.
... also a simpler way to handle mob spawns has been added with the mobs:spawn(def) command which uses above names to make settings clearer:
mobs:spawn({name = "mobs_monster:tree_monster",
nodes = {"group:leaves"},
max_light = 7,
})
Players can override the spawn chance for each mob registered by adding a line to their minetest.conf file with a new value, the lower the value the more each mob will spawn e.g.
mobs_animal:sheep_chance 11000 or mobs_monster:sand_monster_chance 100
For each mob that spawns with this function is a field in mobs.spawning_mobs. It tells if the mob should spawn or not. Default is true. So other mods can only use the API of this mod by disabling the spawning of the default mobs in this mod.
mobs:register_arrow(name, definition)
This function registers a arrow for mobs with the attack type shoot.
'name' is the name of the arrow
-definition' is a table with the following values:
'visual' same is in minetest.register_entity()
'visual_size' same is in minetest.register_entity()
'textures' same is in minetest.register_entity()
'velocity' the velocity of the arrow
'drop' if set to true any arrows hitting a node will drop as item
'hit_player' a function that is called when the arrow hits a player; this function should hurt the player
the parameters are (self, player)
'hit_mob' a function that is called when the arrow hits a mob; this function should hurt the mob
the parameters are (self, player)
'hit_node' a function that is called when the arrow hits a node
the parameters are (self, pos, node)
'tail' when set to 1 adds a trail or tail to mob arrows
'tail_texture' texture string used for above effect
'tail_size' has size for above texture (defaults to between 5 and 10)
'on_step' is a custom function when arrow is active, nil for default.
mobs:register_egg(name, description, background, addegg)
This function registers a spawn egg which can be used by admin to properly spawn in a mob.
'name' this is the name of your new mob to spawn e.g. "mob:sheep"
'description' the name of the new egg you are creating e.g. "Spawn Sheep"
'background' the texture displayed for the egg in inventory
'addegg' would you like an egg image in front of your texture (1=yes, 0=no)
'no_creative' when set to true this stops spawn egg appearing in creative mode for destructive mobs like Dungeon Masters
mobs:explosion(pos, radius, fire, smoke)
This function generates an explosion which removes nodes in a specific radius and replace them with fire or air. Protection nodes, obsidian and locked chests will not be destroyed although a normal chest will drop it's contents.
'pos' centre position of explosion
'radius' radius of explosion (typically set to 3)
'fire' should fire appear in explosion (1=yes, 0=no)
'smoke' should smoke appear in explosion (1=yes, 0=no)
'sound' sound played when mob explodes
mobs:capture_mob(self, clicker, chance_hand, chance_net, chance_lasso, force_take, replacewith)
This function is generally called inside the on_rightclick section of the mob api code, it provides a chance of capturing the mob by hand, using the net or magic lasso items, and can also have the player take the mob by force if tamed and replace with another item entirely.
'self' mob information
'clicker' player information
'chance_hand' chance of capturing mob by hand (1 to 100) 0 to disable
'chance_net' chance of capturing mob using net (1 to 100) 0 to disable
'chance_lasso' chance of capturing mob using magic lasso (1 to 100) 0 to disable
'force_take' take mob by force, even if tamed (true or false)
'replacewith' once captured replace mob with this item instead
mobs:feed_tame(self, clicker, feed_count, breed)
This function allows the mob to be fed the item inside self.follow be it apple, wheat or whatever a set number of times and be tamed or bred as a result.
'self' mob information
'clicker' player information
'feed_count' number of times mob must be fed to tame or breed
'breed' true or false stating if mob can be bred and a child created afterwards
'tame' true or false stating if mob can be tamed so player can pick them up
mobs:protect(self, clicker)
This function can be used to right-click any tamed mob with mobs:protector item, this will protect the mob from harm inside of a protected area from other players.
'self' mob information
'clicker' player information
Useful Internal Variables
'self.health' contains current health of mob
'self.texture_list' contains list of all mob textures
'self.child_texture' contains mob child texture when growing up
'self.base_texture' contains current skin texture which was randomly selected from textures list
'self.gotten' true when sheep have been sheared or cows have been milked, a toggle switch which can be used for many functions
'self.child' true when mob is currently a child (when two mobs have bred and current mob is the outcome)
'self.hornytimer' background timer that controls breeding functions and mob childhood timings

45
mods/mobs/crafts.lua Normal file
View File

@ -0,0 +1,45 @@
local S = mobs.intllib
-- name tag
minetest.register_craftitem("mobs:nametag", {
description = S("Nametag"),
inventory_image = "mobs_nametag.png",
})
core.register_craft({
type = "shapeless",
output = "mobs:nametag",
recipe = {"default:paper", "dye:black", "farming:string"},
})
-- golden lasso
minetest.register_tool("mobs:magic_lasso", {
description = S("Magic Lasso (right-click animal to put in inventory)"),
inventory_image = "mobs_magic_lasso.png",
})
minetest.register_craft({
output = "mobs:magic_lasso",
recipe = {
{"farming:string", "default:gold_lump", "farming:string"},
{"default:gold_lump", "default:diamondblock", "default:gold_lump"},
{"farming:string", "default:gold_lump", "farming:string"},
}
})
-- net
minetest.register_tool("mobs:net", {
description = S("Net (right-click animal to put in inventory)"),
inventory_image = "mobs_net.png",
})
minetest.register_craft({
output = "mobs:net",
recipe = {
{"default:stick", "", "default:stick"},
{"default:stick", "", "default:stick"},
{"farming:string", "default:stick", "farming:string"},
}
})

View File

@ -1,29 +0,0 @@
mobs:register_mob("mobs:creeper", {
type = "monster",
hp_max = 10,
collisionbox = {-0.2, 0, -0.2, 0.2, 1.4, 0.2},
visual = "mesh",
mesh = "creatures_creeper.x",
textures = {"mobs_creeper.png"},
--visual_size = {x = 1.1, y = 1.1},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1.3,
randomsound= "creeper_random",
run_velocity = 1.1,
on_rightclick = nil,
jump = 0,
damage = 0,
drops = {
{name = "default:gunpowder",
chance = 1,
min = 0,
max = 2,},
},
armor = 70,
drawtype = "front",
lava_damage = 15,
light_damage = 0,
attack_type = "kamicaze",
})

View File

@ -1 +1,4 @@
default
invisibility?
intllib?
lucky_block?

View File

@ -0,0 +1 @@
Adds a mob api for mods to add animals or monsters etc.

View File

@ -1,34 +1,16 @@
local init = os.clock()
dofile(minetest.get_modpath("mobs").."/api.lua")
local path = minetest.get_modpath("mobs")
-- Items
dofile(minetest.get_modpath("mobs").."/item.lua")
-- Mob API
dofile(path .. "/api.lua")
-- Mouton
dofile(minetest.get_modpath("mobs").."/sheep.lua")
-- Mob Items
dofile(path .. "/crafts.lua")
-- Zombie
dofile(minetest.get_modpath("mobs").."/zombie.lua")
-- Mob Spawner
dofile(path .. "/spawner.lua")
-- Slime
dofile(minetest.get_modpath("mobs").."/slime.lua")
-- Creeper
dofile(minetest.get_modpath("mobs").."/creeper.lua")
-- Spider
dofile(minetest.get_modpath("mobs").."/spider.lua")
if minetest.setting_getbool("spawn_friendly_mobs") ~= false then -- “If not defined or set to true then”
mobs:register_spawn("mobs:sheep", "Sheep", {"default:dirt_with_grass"},16, 8, 2, 250, 100)
end
if minetest.setting_getbool("spawn_hostile_mobs") ~= false then -- “If not defined or set to true then”
mobs:register_spawn("mobs:slime", "Slime", { "default:dirt_with_grass"}, 20, 1, 11, 80, 0)
mobs:register_spawn("mobs:zombie", "Zombie", {"default:stone", "default:dirt", "default:dirt_with_grass", "default:sand"}, 1, -1, 7, 80, 0)
mobs:register_spawn("mobs:spider", "Spider", {"default:stone", "default:dirt", "default:dirt_with_grass", "default:sand"}, 1, -1, 7, 40, 0)
end
local time_to_load= os.clock() - init
print(string.format("[MOD] "..minetest.get_current_modname().." loaded in %.4f s", time_to_load))
-- Lucky Blocks
dofile(path .. "/lucky_block.lua")
print ("[MOD] Mobs Redo loaded")

View File

@ -1,335 +0,0 @@
----------------
-- Spawn eggs --
----------------
minetest.register_craftitem("mobs:sheep", {
description = "Spawn Sheep",
inventory_image = "spawn_sheep.png",
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
groups = {},
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.above then
minetest.add_entity(pointed_thing.above, "mobs:sheep")
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
minetest.log("action", placer:get_player_name() .. " placed a sheep at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
end
return itemstack
end,
})
minetest.register_craftitem("mobs:slime", {
description = "Spawn Slime",
inventory_image = "spawn_slime.png",
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
groups = {},
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.above then
minetest.add_entity(pointed_thing.above, "mobs:slime")
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
minetest.log("action", placer:get_player_name() .. " placed a slime at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
end
return itemstack
end,
})
minetest.register_craftitem("mobs:zombie", {
description = "Spawn Zombie",
inventory_image = "spawn_zombie.png",
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
groups = {},
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.above then
minetest.add_entity(pointed_thing.above, "mobs:zombie")
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
minetest.log("action", placer:get_player_name() .. " placed a zombie at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
end
return itemstack
end,
})
minetest.register_craftitem("mobs:spider", {
description = "Spawn Spider",
inventory_image = "spawn_spider.png",
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
groups = {},
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.above then
minetest.add_entity(pointed_thing.above, "mobs:spider")
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
minetest.log("action", placer:get_player_name() .. " placed a spider at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
end
return itemstack
end,
})
minetest.register_craftitem("mobs:creeper", {
description = "Spawn Creeper",
inventory_image = "spawn_creeper.png",
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
groups = {},
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.above then
minetest.add_entity(pointed_thing.above, "mobs:creeper")
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
minetest.log("action", placer:get_player_name() .. " placed a creeper at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
end
return itemstack
end,
})
---------------------
-- Drop de monstre --
---------------------
-- TODO: Add special status effects for raw flesh
minetest.register_craftitem("mobs:rotten_flesh", {
description = "Rotten Flesh",
inventory_image = "rotten_flesh.png",
wield_image = "rotten_flesh.png",
-- TODO: Raise to 4
on_use = minetest.item_eat(1),
groups = { food = 2, eatable = 1 },
stack_max = 64,
})
minetest.register_craftitem("mobs:mutton", {
description = "Raw Mutton",
inventory_image = "mutton_raw.png",
wield_image = "mutton_raw.png",
on_use = minetest.item_eat(2),
groups = { food = 2, eatable = 2 },
stack_max = 64,
})
minetest.register_craftitem("mobs:cooked_mutton", {
description = "Cooked Mutton",
inventory_image = "mutton_cooked.png",
wield_image = "mutton_cooked.png",
on_use = minetest.item_eat(6),
groups = { food = 2, eatable = 6 },
stack_max = 64,
})
minetest.register_craftitem("mobs:beef", {
description = "Raw Beef",
inventory_image = "mobs_beef_raw.png",
wield_image = "mobs_beef_raw.png",
on_use = minetest.item_eat(3),
groups = { food = 2, eatable = 3 },
stack_max = 64,
})
minetest.register_craftitem("mobs:cooked_beef", {
description = "Steak",
inventory_image = "mobs_beef_cooked.png",
wield_image = "mobs_beef_cooked.png",
on_use = minetest.item_eat(8),
groups = { food = 2, eatable = 8 },
stack_max = 64,
})
minetest.register_craftitem("mobs:chicken", {
description = "Raw Chicken",
inventory_image = "mobs_chicken_raw.png",
wield_image = "mobs_chicken_raw.png",
on_use = minetest.item_eat(2),
groups = { food = 2, eatable = 2 },
stack_max = 64,
})
minetest.register_craftitem("mobs:cooked_chicken", {
description = "Cooked Chicken",
inventory_image = "mobs_chicken_cooked.png",
wield_image = "mobs_chicken_cooked.png",
on_use = minetest.item_eat(6),
groups = { food = 2, eatable = 6 },
stack_max = 64,
})
minetest.register_craftitem("mobs:porkchop", {
description = "Raw Porkchop",
inventory_image = "mobs_porkchop_raw.png",
wield_image = "mobs_porkchop.png",
on_use = minetest.item_eat(3),
groups = { food = 2, eatable = 3 },
stack_max = 64,
})
minetest.register_craftitem("mobs:cooked_porkchop", {
description = "Cooked Porkchop",
inventory_image = "mobs_porkchop_cooked.png",
wield_image = "mobs_porkchop_cooked.png",
on_use = minetest.item_eat(8),
groups = { food = 2, eatable = 8 },
stack_max = 64,
})
minetest.register_craftitem("mobs:rabbit", {
description = "Raw Rabbit",
inventory_image = "mobs_rabbit_raw.png",
wield_image = "mobs_rabbit_raw.png",
on_use = minetest.item_eat(3),
groups = { food = 2, eatable = 3 },
stack_max = 64,
})
minetest.register_craftitem("mobs:cooked_rabbit", {
description = "Cooked Rabbit",
inventory_image = "mobs_rabbit_cooked.png",
wield_image = "mobs_rabbit_cooked.png",
on_use = minetest.item_eat(5),
groups = { food = 2, eatable = 5 },
stack_max = 64,
})
minetest.register_craftitem("mobs:spider_eye", {
description = "Spider Eye",
inventory_image = "spider_eye.png",
wield_image = "spider_eye.png",
on_use = minetest.item_eat(2),
groups = { food = 2, eatable = 2 },
stack_max = 64,
})
minetest.register_craftitem("mobs:blaze_rod", {
description = "Blaze Rod",
wield_image = "mobs_blaze_rod.png",
inventory_image = "mobs_blaze_rod.png",
stack_max = 64,
})
minetest.register_craftitem("mobs:blaze_powder", {
description = "Blaze Powder",
wield_image = "mobs_blaze_powder.png",
inventory_image = "mobs_blaze_powder.png",
stack_max = 64,
})
minetest.register_craftitem("mobs:magma_cream", {
description = "Magma Cream",
wield_image = "mobs_magma_cream.png",
inventory_image = "mobs_magma_cream.png",
stack_max = 64,
})
minetest.register_craftitem("mobs:ghast_tear", {
description = "Ghast Tear",
wield_image = "mobs_ghast_tear.png",
inventory_image = "mobs_ghast_tear.png",
stack_max = 64,
})
minetest.register_craftitem("mobs:nether_star", {
description = "Nether Star",
wield_image = "mobs_nether_star.png",
inventory_image = "mobs_nether_star.png",
stack_max = 64,
})
minetest.register_craftitem("mobs:leather", {
description = "Leather",
wield_image = "mobs_leather.png",
inventory_image = "mobs_leather.png",
stack_max = 64,
})
minetest.register_craftitem("mobs:feather", {
description = "Feather",
wield_image = "mobs_feather.png",
inventory_image = "mobs_feather.png",
stack_max = 64,
})
minetest.register_craftitem("mobs:rabbit_hide", {
description = "Rabbit Hide",
wield_image = "mobs_rabbit_hide.png",
inventory_image = "mobs_rabbit_hide.png",
stack_max = 64,
})
minetest.register_craftitem("mobs:rabbit_foot", {
description = "Rabbit's Foot",
wield_image = "mobs_rabbit_foot.png",
inventory_image = "mobs_rabbit_foot.png",
stack_max = 64,
})
-----------
-- Crafting
-----------
minetest.register_craft({
output = "mobs:leather",
recipe = {
{ "mobs:rabbit_hide", "mobs:rabbit_hide" },
{ "mobs:rabbit_hide", "mobs:rabbit_hide" },
}
})
minetest.register_craft({
output = "mobs:blaze_powder 2",
recipe = {{"mobs:blaze_rod"}},
})
minetest.register_craft({
type = "shapeless",
output = "mobs:magma_cream",
recipe = {"mobs:blaze_powder", "mesecons_materials:glue"},
})
minetest.register_craft({
type = "cooking",
output = "mobs:cooked_mutton",
recipe = "mobs:mutton",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mobs:cooked_rabbit",
recipe = "mobs:rabbit",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mobs:cooked_chicken",
recipe = "mobs:chicken",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mobs:cooked_beef",
recipe = "mobs:beef",
cooktime = 10,
})
minetest.register_craft({
type = "fuel",
recipe = "mobs:blaze_rod",
burntime = 120,
})
-- Temporary helper recipes
-- TODO: Remove them
minetest.register_craft({
type = "shapeless",
output = "mobs:leather",
recipe = { "default:paper", "default:paper" },
})
minetest.register_craft({
output = "mobs:feather 3",
recipe = {
{ "flowers:oxeye_daisy" },
{ "flowers:oxeye_daisy" },
}
})

21
mods/mobs/license.txt Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 TenPlus1
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
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.

38
mods/mobs/locale/de.txt Normal file
View File

@ -0,0 +1,38 @@
# German Translation for mobs_redo mod
# Deutsche Übersetzung der mobs_redo Mod
# last update: 2016/June/10
# Author: Xanthin
#init.lua
[MOD] Mobs Redo loaded = [MOD] Mobs Redo geladen
#api.lua
[MOBS] mod profiling enabled, damage not enabled = [MOBS] Modanalyse aktiviert, Schaden deaktiviert
lifetimer expired, removed @1 = Lebensdauer abgelaufen, @1 wurde entfernt
[Mobs Redo] @1 has spawning disabled = [Mobs Redo] Spawnen von @1 ist deaktiviert
[Mobs Redo] Chance setting for @1 is now @2 = [Mobs Redo] Wahrscheinlichkeitswert für @1 ist jetzt @2
[mobs] @1 failed to spawn at @2 = [mobs] @1 konnte nicht bei @2 spawnen
Not tamed! = Nicht gezähmt!
@1 is owner! = @1 ist Besitzer!
Missed! = Verfehlt!
@1 at full health (@2) = @1 bei voller Gesundheit (@2)
@1 has been tamed! = @1 ist gezähmt worden!
Enter name: = Namen eingeben:
Rename = Umbenennen
#crafts.lua
Nametag = Namensschild
Leather = Leder
Raw Meat = Rohes Fleisch
Meat = Fleisch
Magic Lasso (right-click animal to put in inventory) = Magisches Lasso (Rechtsklick auf Tier,\num es ins Inventar zu legen)
Net (right-click animal to put in inventory) = Netz (Rechtsklick auf Tier,\num es ins Inventar zu legen)
Steel Shears (right-click to shear) = Stahlschere (Rechtsklick zum Scheren)
#spawner.lua
Mob Spawner = Mobspawner
Mob MinLight MaxLight Amount PlayerDist = Mob MinLicht MaxLicht Menge SpielerEntfng
Spawner Not Active (enter settings) = Spawner nicht aktiv (Einstellungen eintragen)
Spawner Active (@1) = Spawner aktiv (@1)
Mob Spawner settings failed! = Mobspawnereinstellungen gescheitert!
> name min_light[0-14] max_light[0-14] max_mobs_in_area[0 to disable] distance[1-20] y_offset[-10 to 10] = Name min. Licht[0-14] max. Licht[0-14] max. Mobs in Gebiet[0 zum deaktivieren] Entfernung zum Spieler[1-20] Höhe[-10 bis 10]

38
mods/mobs/locale/pt.txt Normal file
View File

@ -0,0 +1,38 @@
# Portuguese Translation for mobs_redo mod
# Tradução em Portugues do mod mobs_redo
# Ultima revisao: 30/Ago/2016
# Autor: BrunoMine
#init.lua
[MOD] Mobs Redo loaded = [MOD] Mobs Redo carregado
#api.lua
[MOBS] mod profiling enabled, damage not enabled = [MOBS] Mod criador de perfis ativado, dano desabilitado
lifetimer expired, removed @1 = tempo de vida expirado, @1 removido
[Mobs Redo] @1 has spawning disabled = [Mobs Redo] @1 teve spawn desabilitado
[Mobs Redo] Chance setting for @1 is now @2 = [Mobs Redo] Chances para @1 agora vai ser @2
[mobs] @1 failed to spawn at @2 = [mobs] @1 falhou ao spawnar em @2
Not tamed! = Indomesticado!
@1 is owner! = Dono @1!
Missed! = Faltou!
@1 at full health (@2) = @1 em plena saude (@2)
@1 has been tamed! = @1 foi domesticado!
Enter name: = Insira um nome:
Rename = Renomear
#crafts.lua
Nametag = Etiqueta
Leather = Couro
Raw Meat = Carne crua
Meat = Carne
Magic Lasso (right-click animal to put in inventory) = Laço Magico (clique-direito no animal para por no inventario)
Net (right-click animal to put in inventory) = Net (clique-direito no animal para por no inventario)
Steel Shears (right-click to shear) = Tesoura de Aço (clique-direito para tosquiar)
#spawner.lua
Mob Spawner = Spawnador de Mob
Mob MinLight MaxLight Amount PlayerDist = Mob LuzMinima LuzMaxima Valor DistJogador
Spawner Not Active (enter settings) = Spawnador Inativo (configurar)
Spawner Active (@1) = Spawnador Ativo (@1)
Mob Spawner settings failed! = Configuraçao de Spawnador do Mob falhou!
> name min_light[0-14] max_light[0-14] max_mobs_in_area[0 to disable] distance[1-20] y_offset[-10 to 10] = > nome luz_min[0-14] luz_max[0-14] max_mobs_na_area[0 para desabilitar] distancia[1-20] y_offset[-10 a 10]

View File

@ -0,0 +1,36 @@
# Template for translations of mobs_redo mod
# last update: 2016/June/10
#init.lua
[MOD] Mobs Redo loaded =
#api.lua
[MOBS] mod profiling enabled, damage not enabled =
lifetimer expired, removed @1 =
[Mobs Redo] @1 has spawning disabled =
[Mobs Redo] Chance setting for @1 is now @2 =
[mobs] @1 failed to spawn at @2 =
Not tamed! =
@1 is owner! =
Missed! =
@1 at full health (@2) =
@1 has been tamed! =
Enter name: =
Rename =
#crafts.lua
Nametag =
Leather =
Raw Meat =
Meat =
Magic Lasso (right-click animal to put in inventory) =
Net (right-click animal to put in inventory) =
Steel Shears (right-click to shear) =
#spawner.lua
Mob Spawner =
Mob MinLight MaxLight Amount PlayerDist =
Spawner Not Active (enter settings) =
Spawner Active (@1) =
Mob Spawner settings failed! =
> name min_light[0-14] max_light[0-14] max_mobs_in_area[0 to disable] distance[1-20] y_offset[-10 to 10] =

15
mods/mobs/lucky_block.lua Normal file
View File

@ -0,0 +1,15 @@
if minetest.get_modpath("lucky_block") then
lucky_block:add_blocks({
{"dro", {"mobs:meat_raw"}, 5},
{"dro", {"mobs:meat"}, 5},
{"dro", {"mobs:nametag"}, 1},
{"dro", {"mobs:leather"}, 5},
{"dro", {"mobs:net"}, 1},
{"dro", {"mobs:magic_lasso"}, 1},
{"dro", {"mobs:shears"}, 1},
{"dro", {"mobs:protector"}, 1},
{"lig"},
})
end

1
mods/mobs/mod.conf Normal file
View File

@ -0,0 +1 @@
name = mobs

View File

@ -1,441 +0,0 @@
xof 0302txt 0064
// File created by CINEMA 4D
template Vector {
<3D82AB5E-62DA-11cf-AB39-0020AF71E433>
FLOAT x;
FLOAT y;
FLOAT z;
}
template Coords2d {
<F6F23F44-7686-11cf-8F52-0040333594A3>
FLOAT u;
FLOAT v;
}
template Matrix4x4 {
<F6F23F45-7686-11cf-8F52-0040333594A3>
array FLOAT matrix[16];
}
template ColorRGBA {
<35FF44E0-6C7C-11cf-8F52-0040333594A3>
FLOAT red;
FLOAT green;
FLOAT blue;
FLOAT alpha;
}
template ColorRGB {
<D3E16E81-7835-11cf-8F52-0040333594A3>
FLOAT red;
FLOAT green;
FLOAT blue;
}
template IndexedColor {
<1630B820-7842-11cf-8F52-0040333594A3>
DWORD index;
ColorRGBA indexColor;
}
template Boolean {
<4885AE61-78E8-11cf-8F52-0040333594A3>
SWORD truefalse;
}
template Boolean2d {
<4885AE63-78E8-11cf-8F52-0040333594A3>
Boolean u;
Boolean v;
}
template MaterialWrap {
<4885AE60-78E8-11cf-8F52-0040333594A3>
Boolean u;
Boolean v;
}
template TextureFilename {
<A42790E1-7810-11cf-8F52-0040333594A3>
STRING filename;
}
template Material {
<3D82AB4D-62DA-11cf-AB39-0020AF71E433>
ColorRGBA faceColor;
FLOAT power;
ColorRGB specularColor;
ColorRGB emissiveColor;
[...]
}
template MeshFace {
<3D82AB5F-62DA-11cf-AB39-0020AF71E433>
DWORD nFaceVertexIndices;
array DWORD faceVertexIndices[nFaceVertexIndices];
}
template MeshFaceWraps {
<4885AE62-78E8-11cf-8F52-0040333594A3>
DWORD nFaceWrapValues;
Boolean2d faceWrapValues;
}
template MeshTextureCoords {
<F6F23F40-7686-11cf-8F52-0040333594A3>
DWORD nTextureCoords;
array Coords2d textureCoords[nTextureCoords];
}
template MeshMaterialList {
<F6F23F42-7686-11cf-8F52-0040333594A3>
DWORD nMaterials;
DWORD nFaceIndexes;
array DWORD faceIndexes[nFaceIndexes];
[Material]
}
template MeshNormals {
<F6F23F43-7686-11cf-8F52-0040333594A3>
DWORD nNormals;
array Vector normals[nNormals];
DWORD nFaceNormals;
array MeshFace faceNormals[nFaceNormals];
}
template MeshVertexColors {
<1630B821-7842-11cf-8F52-0040333594A3>
DWORD nVertexColors;
array IndexedColor vertexColors[nVertexColors];
}
template Mesh {
<3D82AB44-62DA-11cf-AB39-0020AF71E433>
DWORD nVertices;
array Vector vertices[nVertices];
DWORD nFaces;
array MeshFace faces[nFaces];
[...]
}
template FrameTransformMatrix {
<F6F23F41-7686-11cf-8F52-0040333594A3>
Matrix4x4 frameMatrix;
}
template Frame {
<3D82AB46-62DA-11cf-AB39-0020AF71E433>
[...]
}
Mesh CINEMA4D_Mesh {
48;
// Head
-2.149;9.488;-4.004;,
-2.152;13.894;-4.005;,
1.98;9.491;-4.036;,
1.978;13.897;-4.038;,
2.012;9.492;0.093;,
2.01;13.898;0.092;,
-2.117;9.489;0.125;,
-2.119;13.896;0.124;,
// Body
-2.133;2.881;-2.988;,
-2.133;9.49;-2.988;,
1.996;2.881;-2.988;,
1.996;9.49;-2.988;,
1.996;2.881;-0.923;,
1.996;9.49;-0.923;,
-2.133;2.881;-0.923;,
-2.133;9.49;-0.923;,
// Right_Foot_Front
-2.133;0.528;-5.985;,
-2.133;3.634;-4.926;,
-0.068;0.528;-5.985;,
-0.068;3.634;-4.926;,
-0.068;-0.225;-4.045;,
-0.068;2.88;-2.986;,
-2.133;-0.225;-4.045;,
-2.133;2.88;-2.986;,
// Right_Foot_Back
-2.133;-0.225;0.134;,
-2.133;2.88;-0.925;,
-0.068;-0.225;0.134;,
-0.068;2.88;-0.925;,
-0.068;0.528;2.074;,
-0.068;3.634;1.015;,
-2.133;0.528;2.074;,
-2.133;3.634;1.015;,
// Left_Foot_Front
-0.068;-0.479;-5.081;,
-0.068;2.802;-5.068;,
1.996;-0.479;-5.081;,
1.996;2.802;-5.068;,
1.996;-0.4;-3.001;,
1.996;2.881;-2.988;,
-0.068;-0.4;-3.001;,
-0.068;2.881;-2.988;,
// Left_Foot_Back
-0.068;-0.225;-1.98;,
-0.068;2.88;-0.921;,
1.996;-0.225;-1.98;,
1.996;2.88;-0.921;,
1.996;-0.979;-0.04;,
1.996;2.127;1.02;,
-0.068;-0.979;-0.04;,
-0.068;2.127;1.02;;
36;
// Head
4;0,1,3,2;,
4;2,3,5,4;,
4;4,5,7,6;,
4;6,7,1,0;,
4;1,7,5,3;,
4;6,0,2,4;,
// Body
4;8,9,11,10;,
4;10,11,13,12;,
4;12,13,15,14;,
4;14,15,9,8;,
4;9,15,13,11;,
4;14,8,10,12;,
// Right_Foot_Front
4;16,17,19,18;,
4;18,19,21,20;,
4;20,21,23,22;,
4;22,23,17,16;,
4;17,23,21,19;,
4;22,16,18,20;,
// Right_Foot_Back
4;24,25,27,26;,
4;26,27,29,28;,
4;28,29,31,30;,
4;30,31,25,24;,
4;25,31,29,27;,
4;30,24,26,28;,
// Left_Foot_Front
4;32,33,35,34;,
4;34,35,37,36;,
4;36,37,39,38;,
4;38,39,33,32;,
4;33,39,37,35;,
4;38,32,34,36;,
// Left_Foot_Back
4;40,41,43,42;,
4;42,43,45,44;,
4;44,45,47,46;,
4;46,47,41,40;,
4;41,47,45,43;,
4;46,40,42,44;;
MeshNormals {
48;
// Head
-0.582;-0.578;-0.573;,
-0.582;0.577;-0.573;,
0.573;-0.577;-0.582;,
0.572;0.578;-0.582;,
0.582;-0.577;0.573;,
0.582;0.578;0.573;,
-0.572;-0.578;0.582;,
-0.573;0.577;0.582;,
// Body
-0.333;-0.667;-0.667;,
-0.333;0.667;-0.667;,
0.333;-0.667;-0.667;,
0.333;0.667;-0.667;,
0.333;-0.667;0.667;,
0.333;0.667;0.667;,
-0.333;-0.667;0.667;,
-0.333;0.667;0.667;,
// Right_Foot_Front
-0.572;-0.346;-0.743;,
-0.588;0.733;-0.341;,
0.572;-0.346;-0.743;,
0.588;0.733;-0.341;,
0.588;-0.733;0.341;,
0.572;0.346;0.743;,
-0.588;-0.733;0.341;,
-0.572;0.346;0.743;,
// Right_Foot_Back
-0.588;-0.733;-0.341;,
-0.572;0.346;-0.743;,
0.588;-0.733;-0.341;,
0.572;0.346;-0.743;,
0.572;-0.346;0.743;,
0.588;0.733;0.341;,
-0.572;-0.346;0.743;,
-0.588;0.733;0.341;,
// Left_Foot_Front
-0.588;-0.581;-0.562;,
-0.572;0.57;-0.59;,
0.588;-0.581;-0.562;,
0.572;0.57;-0.59;,
0.572;-0.57;0.59;,
0.588;0.581;0.562;,
-0.572;-0.57;0.59;,
-0.588;0.581;0.562;,
// Left_Foot_Back
-0.572;-0.346;-0.743;,
-0.588;0.733;-0.341;,
0.572;-0.346;-0.743;,
0.588;0.733;-0.341;,
0.588;-0.733;0.341;,
0.572;0.346;0.743;,
-0.588;-0.733;0.341;,
-0.572;0.346;0.743;;
36;
// Head
4;0,1,3,2;,
4;2,3,5,4;,
4;4,5,7,6;,
4;6,7,1,0;,
4;1,7,5,3;,
4;6,0,2,4;,
// Body
4;8,9,11,10;,
4;10,11,13,12;,
4;12,13,15,14;,
4;14,15,9,8;,
4;9,15,13,11;,
4;14,8,10,12;,
// Right_Foot_Front
4;16,17,19,18;,
4;18,19,21,20;,
4;20,21,23,22;,
4;22,23,17,16;,
4;17,23,21,19;,
4;22,16,18,20;,
// Right_Foot_Back
4;24,25,27,26;,
4;26,27,29,28;,
4;28,29,31,30;,
4;30,31,25,24;,
4;25,31,29,27;,
4;30,24,26,28;,
// Left_Foot_Front
4;32,33,35,34;,
4;34,35,37,36;,
4;36,37,39,38;,
4;38,39,33,32;,
4;33,39,37,35;,
4;38,32,34,36;,
// Left_Foot_Back
4;40,41,43,42;,
4;42,43,45,44;,
4;44,45,47,46;,
4;46,47,41,40;,
4;41,47,45,43;,
4;46,40,42,44;;
}
MeshTextureCoords {
48;
// Head
0.25;0.0;,
0.125;0.25;,
0.375;0.0;,
0.25;0.25;,
0.375;0.25;,
0.25;0.0;,
0.25;0.25;,
0.125;0.0;,
// Body
0.438;0.5;,
0.313;0.625;,
0.562;0.501;,
0.438;0.625;,
0.562;0.625;,
0.438;0.5;,
0.438;0.625;,
0.313;0.5;,
// Right_Foot_Front
0.125;0.5;,
0.063;0.625;,
0.188;0.5;,
0.125;0.625;,
0.188;0.626;,
0.125;0.5;,
0.125;0.625;,
0.063;0.5;,
// Right_Foot_Back
0.125;0.5;,
0.063;0.625;,
0.188;0.5;,
0.125;0.625;,
0.188;0.626;,
0.125;0.5;,
0.125;0.625;,
0.063;0.5;,
// Left_Foot_Front
0.125;0.5;,
0.063;0.625;,
0.188;0.5;,
0.125;0.625;,
0.188;0.626;,
0.125;0.5;,
0.125;0.625;,
0.063;0.5;,
// Left_Foot_Back
0.125;0.5;,
0.063;0.625;,
0.188;0.5;,
0.125;0.625;,
0.188;0.626;,
0.125;0.5;,
0.125;0.625;,
0.063;0.5;;
}
MeshMaterialList {
1;
36;
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0;
Material C4DMAT_NONE {
1.0;1.0;1.0;1.0;;
1.0;
0.0;0.0;0.0;;
0.0;0.0;0.0;;
}
}
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

68
mods/mobs/readme.MD Normal file
View File

@ -0,0 +1,68 @@
MOBS REDO for MINETEST
Built from PilzAdam's original Simple Mobs with additional mobs by KrupnoPavel, Zeg9, ExeterDad and AspireMint.
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
Crafts:
- Nametag (paper, black dye, string) can be used right-click on a tamed mob to give them a name.
- Nets can be used to right-click tamed mobs to pick them up and place inside inventory as a spawn egg.
- Magic Lasso is similar to nets but with a better chance of picking up larger mobs.
- Shears are used to right-click sheep and return 1-3 wool.
- Protection Rune lets you protect tamed mobs from harm by other players
Lucky Blocks: 9
Changelog:
- 1.32- Added new spawn check to count specific mobs AND new minetest.conf setting to chance spawn chance and numbers, added ability to protect tamed mobs
- 1.31- Added 'attack_animals' and 'specific_attack' flags for custom monster attacks, also 'mob_difficulty' .conf setting to make mobs harder.
- 1.30- Added support for invisibility mod (mobs cant attack what they cant see), tweaked and tidied code
- 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

View File

@ -1,74 +0,0 @@
mobs:register_mob("mobs:sheep", {
type = "animal",
hp_max = 8,
collisionbox = {-0.5, -0.01, -0.5, 0.5, 1, 0.5},
textures = {"creatures_sheep.png"},
visual = "mesh",
mesh = "creatures_sheep.x",
makes_footstep_sound = true,
walk_velocity = 1,
run_velocity = 3,
armor = 100,
drops = {
{name = "mobs:meat_raw_sheep",
chance = 1,
min = 1,
max = 2,},
},
drawtype = "front",
water_damage = 0,
lava_damage = 8,
animation = {
speed_normal = 17,
speed_run = 25,
stand_start = 0,
stand_end = 80,
walk_start = 81,
walk_end = 100,
},
follow = "farming:wheat_harvested",
view_range = 6,
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
if item:get_name() == "farming:wheat_harvested" then
if not self.tamed then
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
self.tamed = true
self.object:set_hp(self.object:get_hp() + 3)
if self.object:get_hp() > 15 then self.object:set_hp(15) end
else
if not minetest.setting_getbool("creative_mode") and self.naked then
item:take_item()
clicker:set_wielded_item(item)
end
self.food = (self.food or 0) + 1
if self.food >= 8 then
self.food = 0
self.naked = false
self.object:set_properties({
textures = {"creatures_sheep.png"},
})
end
self.object:set_hp(self.object:get_hp() + 3)
if self.object:get_hp() > 15 then self.object:set_hp(15) return end
if not self.naked then
item:take_item()
clicker:set_wielded_item(item)
end
end
return
end
if item:get_name() == "default:shears" and not self.naked then
self.naked = true
clicker:get_inventory():add_item("main", ItemStack("wool:white "..math.random(1,3)))
minetest.sound_play("default_snow_footstep", {object = self.object, gain = 0.5,})
self.object:set_properties({
textures = {"creatures_sheep_shaved.png"},
})
end
end,
})

View File

@ -1,40 +0,0 @@
SLIME_SIZE = 1
SLIME_BOX = math.sqrt(2*math.pow(SLIME_SIZE, 2))/2
GRAVITY = 9.8
mobs:register_mob("mobs:slime", {
type = "monster",
hp_max = 8,
--collisionbox = {-0.4, -1.0, -0.4, 0.4, 0.8, 0.4},
collisionbox = {-SLIME_BOX, -SLIME_SIZE/2, -SLIME_BOX, SLIME_BOX, SLIME_SIZE/2, SLIME_BOX},
visual = "cube",
textures = {
"slime_top.png",
"slime_bottom.png",
"slime_front.png",
"slime_sides.png",
"slime_sides.png",
"slime_sides.png",
},
--visual_size = {x = 1.1, y = 1.1},
makes_footstep_sound = true,
view_range = 20,
walk_velocity = 0.2,
randomsound= "slime_random",
run_velocity = 0.2,
on_rightclick = nil,
jump = 1,
damage = 1,
drops = {
{name = "mesecons_materials:glue",
chance = 1,
min = 0,
max = 2,},
},
armor = 100,
drawtype = "front",
lava_damage = 15,
light_damage = 0,
attack_type = "dogfight",
})

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

163
mods/mobs/spawner.lua Normal file
View File

@ -0,0 +1,163 @@
local S = mobs.intllib
-- mob spawner
local spawner_default = "mobs_animal:pumba 10 15 0 0"
minetest.register_node("mobs:spawner", {
tiles = {"mob_spawner.png"},
drawtype = "glasslike",
paramtype = "light",
walkable = true,
description = S("Mob Spawner"),
groups = {cracky = 1},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
-- text entry formspec
meta:set_string("formspec",
"field[text;" .. S("Mob MinLight MaxLight Amount PlayerDist") .. ";${command}]")
meta:set_string("infotext", S("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
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)
local yof = tonumber(comm[6]) or 0 -- Y offset to spawn mob
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
and yof and yof > -10 and yof < 10 then
meta:set_string("command", fields.text)
meta:set_string("infotext", S("Spawner Active (@1)", mob))
else
minetest.chat_send_player(name, S("Mob Spawner settings failed!"))
minetest.chat_send_player(name,
S("> name min_light[0-14] max_light[0-14] max_mobs_in_area[0 to disable] distance[1-20] y_offset[-10 to 10]"))
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)
-- 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
local yof = tonumber(comm[6]) or 0
-- if amount is 0 then do nothing
if num == 0 then
return
end
-- check objects inside 9x9 area around spawner
local objs = minetest.get_objects_inside_radius(pos, 9)
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 + yof, z = pos.z - 5},
{x = pos.x + 5, y = pos.y + yof, 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
})

View File

@ -1,49 +0,0 @@
mobs:register_mob("mobs:spider", {
type = "monster",
hp_max = 16,
--collisionbox = {-0.4, -1.0, -0.4, 0.4, 0.8, 0.4},
collisionbox = {-0.9, -0.01, -0.7, 0.7, 0.6, 0.7},
visual_size = {x=7,y=7},
visual = "mesh",
mesh = "creatures_spider.x",
textures = {"mobs_spider.png"},
--visual_size = {x = 1.1, y = 1.1},
makes_footstep_sound = true,
view_range = 20,
walk_velocity = 1,
run_velocity = 4,
hostile_type = 2,
on_rightclick = nil,
jump = false,
damage = 2,
drops = {
{name = "farming:string",
chance = 2,
min = 1,
max = 3,},
{name = "mobs:spider_eye",
chance = 30,
min = 1,
max = 1,},
},
armor = 200,
light_resistant = true,
drawtype = "front",
water_damage = 0,
lava_damage = 15,
light_damage = 0,
step = 1,
attack_type = "dogfight",
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 1,
stand_end = 1,
walk_start = 20,
walk_end = 40,
run_start = 20,
run_end = 40,
punch_start = 50,
punch_end = 90,
},
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 885 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 791 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 667 B

View File

@ -1,58 +0,0 @@
mobs:register_mob("mobs:zombie", {
type = "monster",
hp_max = 20,
--collisionbox = {-0.4, -1.0, -0.4, 0.4, 0.8, 0.4},
collisionbox = {-0.4, -1.3, -0.4, 0.4, 1, 0.4},
visual = "mesh",
mesh = "creatures_zombie.x",
textures = {"mobs_zombie.png"},
--visual_size = {x = 1.1, y = 1.1},
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 0.8,
randomsound= "zombie_random",
run_velocity = 1.1,
on_rightclick = nil,
damage = 1,
drops = {
{name = "mobs:rotten_flesh",
chance = 2,
min = 1,
max = 2,},
{name = "default:sword_steel",
chance = 15,
min = 0,
max = 1,},
{name = "default:shovel_gold",
chance = 18,
min = 0,
max = 1,},
{name = "default:steel_ingot",
chance = 24,
min = 1,
max = 5,},
{name = "farming:carrot_item",
chance = 10,
min = 0,
max = 1,},
{name = "farming:potato_item",
chance = 25,
min = 0,
max = 1,},
},
armor = 100,
drawtype = "front",
lava_damage = 15,
light_damage = 5,
attack_type = "dogfight",
animation = {
speed_normal = 10,
speed_run = 30,
stand_start = 0,
stand_end = 79,
walk_start = 168,
walk_end = 187,
die_start = 162,
die_end = 166,
},
})

872
mods/mobs_mc/api-mcorg.lua Normal file
View File

@ -0,0 +1,872 @@
mobs = {}
mobs.default_definition = {
physical = true,
jump = function (self)
local v = self.object:getvelocity()
v.y = 5
self.object:setvelocity(v)
end,
timer = 0,
env_damage_timer = 0, -- only if state = "attack"
bombtimer = -999,
attack = {player=nil, dist=nil},
state = "stand",
v_start = false,
old_y = nil,
lifetimer = 600,
tamed = false,
boom = function(self, tnt_range)
local pos = self.object:getpos()
self.object:remove()
tnt:boom(pos)
end,
set_velocity = function(self, v)
local get_flowing_dir = function(self)
local pos = self.object:getpos()
local param2 = minetest.get_node(pos).param2
local p4 = {
{x=1,y=0,z=0},
{x=-1,y=0,z=0},
{x=0,y=0,z=1},
{x=0,y=0,z=-1},
}
local out = {x=0,y=0,z=0}
local num = 0
for i=1,4 do
local p2 = vector.add(pos, p4[i])
local name = minetest.get_node(p2).name
local par2 = minetest.get_node(p2).param2
-- param2 == 13 means water is falling down a block
if (name == "default:water_flowing" and par2 < param2 and param2 < 13) or (name == "default:water_flowing" and par2 == 13) or name == "air" then
out = vector.add(out, p4[i])
num = num + 1
end
end
if num then
return out
else
return false
end
end
local yaw = self.object:getyaw()
if self.drawtype == "side" then
yaw = yaw+(math.pi/2)
end
local x = math.sin(yaw) * -v
local z = math.cos(yaw) * v
local v1 = {x=x, y=self.object:getvelocity().y, z=z}
local pos = self.object:getpos()
local name = minetest.get_node(pos).name
if name == "default:water_flowing" then
local v = get_flowing_dir(self)
if v then
v1 = vector.add(v1, vector.multiply(v, 1.3))
end
end
self.object:setvelocity(v1)
end,
get_velocity = function(self)
local v = self.object:getvelocity()
return (v.x^2 + v.z^2)^(0.5)
end,
set_animation = function(self, type)
if not self.animation then
return
end
if not self.animation.current then
self.animation.current = ""
end
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
self.object:set_animation(
{x=self.animation.stand_start,y=self.animation.stand_end},
self.animation.speed_normal, 0
)
self.animation.current = "stand"
end
elseif type == "look" and self.animation.current ~= "look" then
if
self.animation.look_start
and self.animation.look_end
and self.animation.speed_normal
then
self.object:set_animation(
{x=self.animation.look_start,y=self.animation.look_end},
self.animation.speed_normal, 0
)
self.animation.current = "look"
end
elseif type == "eat" and self.animation.current ~= "eat" then
if
self.animation.eat_start
and self.animation.eat_end
and self.animation.speed_normal
then
self.object:set_animation(
{x=self.animation.eat_start,y=self.animation.eat_end},
self.animation.speed_normal, 0
)
self.animation.current = "eat"
if self.name == "mobs:sheep" and self.naked then
local pos = self.object:getpos()
pos.y = pos.y - 1
if minetest.get_node(pos).name == "default:dirt_with_grass" then
minetest.set_node(pos, {name = "default:dirt"})
self.naked = false
if not self.color then
self.object:set_properties({
textures = {"sheep.png"},
})
else
self.object:set_properties({
textures = {"sheep_"..self.color..".png"},
})
end
end
end
end
elseif type == "shoot" and self.animation.current ~= "shoot" then
if
self.animation.shoot_start
and self.animation.shoot_end
and self.animation.speed_normal
then
self.object:set_animation(
{x=self.animation.shoot_start,y=self.animation.shoot_end},
self.animation.speed_normal, 0
)
self.animation.shootdur = (self.animation.shoot_end - self.animation.shoot_start)/self.animation.speed_normal - .5
self.animation.current = "shoot"
end
elseif type == "fly" and self.animation.current ~= "fly" then
if
self.animation.fly_start
and self.animation.fly_end
and self.animation.speed_normal
then
self.object:set_animation(
{x=self.animation.fly_start,y=self.animation.fly_end},
self.animation.speed_normal, 0
)
self.animation.current = "fly"
end
elseif type == "walk" and self.animation.current ~= "walk" then
if
self.animation.walk_start
and self.animation.walk_end
and self.animation.speed_normal
then
self.object:set_animation(
{x=self.animation.walk_start,y=self.animation.walk_end},
self.animation.speed_normal, 0
)
self.animation.current = "walk"
end
elseif type == "run" and self.animation.current ~= "run" then
if
self.animation.run_start
and self.animation.run_end
and self.animation.speed_run
then
self.object:set_animation(
{x=self.animation.run_start,y=self.animation.run_end},
self.animation.speed_run, 0
)
self.animation.current = "run"
end
elseif type == "punch" and self.animation.current ~= "punch" then
if
self.animation.punch_start
and self.animation.punch_end
and self.animation.speed_normal
then
self.object:set_animation(
{x=self.animation.punch_start,y=self.animation.punch_end},
self.animation.speed_normal, 0
)
self.animation.current = "punch"
end
elseif type == "hurt" and self.animation.current ~= "hurt" then
self.animation.hurtdur = .5
if
self.animation.hurt_start
and self.animation.hurt_end
and self.animation.speed_normal
then
self.object:set_animation(
{x=self.animation.hurt_start,y=self.animation.hurt_end},
self.animation.speed_normal, 0
)
self.animation.current = "hurt"
self.animation.hurtdur = (self.animation.hurt_end - self.animation.hurt_start)/self.animation.speed_normal - 1
end
elseif type == "death" and self.animation.current ~= "death" then
self.animation.deathdur = 1
if
self.animation.death_start
and self.animation.death_end
and self.animation.speed_normal
then
self.object:set_animation(
{x=self.animation.death_start,y=self.animation.death_end},
self.animation.speed_normal, 0
)
self.animation.current = "death"
self.animation.deathdur = (self.animation.death_end - self.animation.death_start)/self.animation.speed_normal - .5
end
end
end,
on_step = function(self, dtime)
if self.type == "monster" and minetest.setting_getbool("only_peaceful_mobs") then
self.object:remove()
end
self.lifetimer = self.lifetimer - dtime
if self.lifetimer <= 0 and not self.tamed then
local player_count = 0
for _,obj in ipairs(minetest.get_objects_inside_radius(self.object:getpos(), 30)) do
if obj:is_player() then
player_count = player_count+1
end
end
if player_count == 0 and self.state ~= "attack" then
self.object:remove()
return
end
end
if self.object:getvelocity().y > 0.1 then
local yaw = self.object:getyaw()
if self.drawtype == "side" then
yaw = yaw+(math.pi/2)
end
local x = math.sin(yaw) * -2
local z = math.cos(yaw) * 2
self.object:setacceleration({x=x, y=-10, z=z})
else
self.object:setacceleration({x=0, y=-10, z=0})
end
if self.disable_fall_damage and self.object:getvelocity().y == 0 then
if not self.old_y then
self.old_y = self.object:getpos().y
else
local d = self.old_y - self.object:getpos().y
if d > 5 then
local damage = d-5
self.object:set_hp(self.object:get_hp()-damage)
if self.object:get_hp() == 0 then
self.object:remove()
end
end
self.old_y = self.object:getpos().y
end
end
self.timer = self.timer+dtime
self.bombtimer = self.bombtimer+dtime
if self.state ~= "attack" then
if self.timer < 1 then
return
end
self.timer = 0
end
if self.sounds and self.sounds.random and math.random(1, 100) <= 1 then
minetest.sound_play(self.sounds.random, {object = self.object})
end
local do_env_damage = function(self)
local pos = self.object:getpos()
local n = minetest.get_node(pos)
if self.light_damage and self.light_damage ~= 0
and pos.y>0
and minetest.get_node_light(pos)
and minetest.get_node_light(pos) > 4
and minetest.get_timeofday() > 0.2
and minetest.get_timeofday() < 0.8
then
self.object:set_hp(self.object:get_hp()-self.light_damage)
if self.object:get_hp() == 0 then
self.object:remove()
end
end
if self.water_damage and self.water_damage ~= 0 and
minetest.get_item_group(n.name, "water") ~= 0
then
self.object:set_hp(self.object:get_hp()-self.water_damage)
if self.object:get_hp() == 0 then
self.object:remove()
end
end
if self.lava_damage and self.lava_damage ~= 0 and
minetest.get_item_group(n.name, "lava") ~= 0
then
self.object:set_hp(self.object:get_hp()-self.lava_damage)
if self.object:get_hp() == 0 then
self.object:remove()
end
end
end
-- ridable pigs
if self.name == "mobs:pig" and self.saddle == "yes" and self.driver then
local item = self.driver:get_wielded_item()
if item:get_name() == "mobs:carrotstick" then
local yaw = self.driver:get_look_yaw() - math.pi / 2
local velo = self.object:getvelocity()
local v = 1.5
if math.abs(velo.x) + math.abs(velo.z) < .6 then velo.y = 5 end
self.state = "walk"
self:set_animation("walk")
self.object:setyaw(yaw)
self.object:setvelocity({x = -math.sin(yaw) * v, y = velo.y, z = math.cos(yaw) * v})
local inv = self.driver:get_inventory()
local stack = inv:get_stack("main", self.driver:get_wield_index())
stack:add_wear(100)
if stack:get_wear() > 65400 then
stack = {name = "fishing:pole", count = 1}
end
inv:set_stack("main", self.driver:get_wield_index(), stack)
return
end
end
self.env_damage_timer = self.env_damage_timer + dtime
if self.state == "attack" and self.env_damage_timer > 1 then
self.env_damage_timer = 0
do_env_damage(self)
elseif self.state ~= "attack" then
do_env_damage(self)
end
if self.type == "monster" and minetest.setting_getbool("enable_damage") then
for _,player in pairs(minetest.get_connected_players()) do
local s = self.object:getpos()
local p = player:getpos()
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
if dist < 2 and self.attack_type == "bomb" and self.bombmode ~= "armed" then
if self.sounds and self.sounds.approach then
minetest.sound_play(self.sounds.approach, {object = self.object})
end
self.bombmode = "armed"
self.bombtimer = 0
end
if dist < self.view_range then
if self.attack.dist then
if dist < self.attack.dist then
self.attack.player = player
self.attack.dist = dist
end
else
self.state = "attack"
self.attack.player = player
self.attack.dist = dist
end
end
end
end
if self.follow and self.follow ~= "" and not self.following then
for _,player in pairs(minetest.get_connected_players()) do
local s = self.object:getpos()
local p = player:getpos()
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
if self.view_range and dist < self.view_range then
self.following = player
end
end
end
if self.following and self.following:is_player() then
if self.following:get_wielded_item():get_name() ~= self.follow then
self.following = nil
self.v_start = false
else
local s = self.object:getpos()
local p = self.following:getpos()
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
if dist > self.view_range then
self.following = nil
self.v_start = false
else
local vec = {x=p.x-s.x, y=p.y-s.y, z=p.z-s.z}
local yaw = math.atan(vec.z/vec.x)+math.pi/2
if self.drawtype == "side" then
yaw = yaw+(math.pi/2)
end
if p.x > s.x then
yaw = yaw+math.pi
end
self.object:setyaw(yaw)
if dist > 2 then
if not self.v_start then
self.v_start = true
self.set_velocity(self, self.walk_velocity)
else
if self.jump and self.get_velocity(self) <= 0.5 and self.object:getvelocity().y == 0 then
self:jump()
end
self.set_velocity(self, self.walk_velocity)
end
self:set_animation("walk")
else
self.v_start = false
self.set_velocity(self, 0)
self:set_animation("stand")
end
return
end
end
end
if self.state == "stand" then
if math.random(1, 4) == 1 then
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/180*math.pi))
end
self.set_velocity(self, 0)
self.set_animation(self, "stand")
local standanim = math.random(1,4)
if standanim == 2 then
self.set_animation(self, "look")
elseif standanim == 3 then
self.set_animation(self, "eat")
elseif standanim == 4 then
self.set_animation(self, "fly")
end
if math.random(1, 100) <= 50 then
self.set_velocity(self, self.walk_velocity)
self.state = "walk"
self.set_animation(self, "walk")
end
elseif self.state == "walk" then
if math.random(1, 100) <= 30 then
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/180*math.pi))
end
if self.jump and self.get_velocity(self) <= 0.5 and self.object:getvelocity().y == 0 then
self:jump()
end
self:set_animation("walk")
self.set_velocity(self, self.walk_velocity)
if math.random(1, 100) <= 10 then
self.set_velocity(self, 0)
self.state = "stand"
self:set_animation("stand")
end
elseif self.state == "attack" and (self.attack_type == "dogfight" or self.attack_type == "bomb") then
if not self.attack.player or not self.attack.player:is_player() then
self.state = "stand"
self:set_animation("stand")
self.attack = {player=nil, dist=nil}
return
end
local s = self.object:getpos()
local p = self.attack.player:getpos()
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
if dist > self.view_range or self.attack.player:get_hp() <= 0 then
self.state = "stand"
self.v_start = false
self.set_velocity(self, 0)
self.attack = {player=nil, dist=nil}
self:set_animation("stand")
return
else
self.attack.dist = dist
end
if self.attack_type == "bomb" and self.bombmode == "armed" and self.bombtimer > 2 then
-- print("***BOOM",self.bombtimer)
self.bombmode = "exploded"
self.boom(self, math.random(2, 4))
end
local vec = {x=p.x-s.x, y=p.y-s.y, z=p.z-s.z}
local yaw = math.atan(vec.z/vec.x)+math.pi/2
if self.drawtype == "side" then
yaw = yaw+(math.pi/2)
end
if p.x > s.x then
yaw = yaw+math.pi
end
-- creepers use a spiraling approach:
if self.attack_type == "bomb" then
yaw = yaw - 14*math.pi/180
end
self.object:setyaw(yaw)
if self.attack.dist > 2 then
if not self.v_start then
self.v_start = true
self.set_velocity(self, self.run_velocity)
else
if self.jump and self.get_velocity(self) <= 0.5 and self.object:getvelocity().y == 0 then
self:jump()
end
self.set_velocity(self, self.run_velocity)
end
self:set_animation("run")
else
self.set_velocity(self, 0)
self:set_animation("punch")
self.v_start = false
if self.timer > 1 then
self.timer = 0
if self.sounds and self.sounds.attack then
minetest.sound_play(self.sounds.attack, {object = self.object})
end
self.attack.player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=self.damage}
}, vec)
end
end
elseif self.state == "attack" and self.attack_type == "shoot" then
if not self.attack.player or not self.attack.player:is_player() then
self.state = "stand"
self:set_animation("stand")
self.attack = {player=nil, dist=nil}
return
end
local s = self.object:getpos()
local p = self.attack.player:getpos()
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
if dist > self.view_range or self.attack.player:get_hp() <= 0 then
self.state = "stand"
self.v_start = false
self.set_velocity(self, 0)
self.attack = {player=nil, dist=nil}
self:set_animation("stand")
return
else
self.attack.dist = dist
self.shoot_interval = (dist + self.view_range) / self.view_range
end
local vec = {x=p.x-s.x, y=p.y-s.y, z=p.z-s.z}
local yaw = math.atan(vec.z/vec.x)+math.pi/2
if self.drawtype == "side" then
yaw = yaw+(math.pi/2)
end
if p.x > s.x then
yaw = yaw+math.pi
end
self.object:setyaw(yaw)
if self.attack.dist < 4 then
self.set_velocity(self, -self.run_velocity)
elseif self.attack.dist > 8 then
self.set_velocity(self, self.run_velocity)
else
self.set_velocity(self, 0)
end
if self.timer > self.shoot_interval and math.random(1, 100) <= 60 then
self.timer = 0
self:set_animation("shoot")
minetest.after(self.animation.shootdur, function()
self:set_animation("walk")
end)
if self.sounds and self.sounds.attack then
minetest.sound_play(self.sounds.attack, {object = self.object})
end
local p = self.object:getpos()
p.y = p.y + (self.collisionbox[2]+self.collisionbox[5])/2
local obj = minetest.add_entity(p, self.arrow)
local amount = (vec.x^2+vec.y^2+vec.z^2)^0.5
local v = 15
vec.y = vec.y+1
vec.x = vec.x*v/amount
vec.y = vec.y*v/amount
vec.z = vec.z*v/amount
obj:setvelocity(vec)
end
end
end,
on_activate = function(self, staticdata, dtime_s)
self.object:set_armor_groups({fleshy=self.armor})
self.object:setacceleration({x=0, y=-10, z=0})
self.state = "stand"
self.attack = {player = nil, dist = nil}
self.object:setvelocity({x=0, y=self.object:getvelocity().y, z=0})
self.object:setyaw(math.random(1, 360)/180*math.pi)
if self.type == "monster" and minetest.setting_getbool("only_peaceful_mobs") then
self.object:remove()
end
self.lifetimer = 600 - dtime_s
if staticdata then
local tmp = minetest.deserialize(staticdata)
if tmp and tmp.lifetimer then
self.lifetimer = tmp.lifetimer - dtime_s
end
if tmp and tmp.tamed then
self.tamed = tmp.tamed
end
if tmp and tmp.color then
self.color = tmp.color
end
if tmp and tmp.naked then
self.naked = tmp.naked
end
if tmp and tmp.saddle then
self.saddle = tmp.saddle
end
end
if self.name == "mobs:sheep" and self.color and not self.naked then
self.object:set_properties({
textures = {"sheep_"..self.color..".png"},
})
self.drops = {
{name = "mobs:mutton_raw",
chance = 1,
min = 1,
max = 2,},
{name = "wool:"..self.color,
chance = 1,
min = 1,
max = 1,},
}
end
if self.name == "mobs:sheep" and not self.color then
local col = "white"
local cols = {"dark_grey", "grey", "black", "brown", "pink"}
if math.random(100) > 80 then
col = cols[math.random(1,5)]
end
self.color = col
self.object:set_properties({
textures = {"sheep_"..self.color..".png"},
})
self.drops = {
{name = "mobs:mutton_raw",
chance = 1,
min = 1,
max = 2,},
{name = "wool:"..self.color,
chance = 1,
min = 1,
max = 1,},
}
end
if self.name == "mobs:sheep" and self.naked then
self.object:set_properties({
textures = {"sheep_sheared.png"},
})
end
if self.name == "mobs:pig" and self.saddle == "yes" then
self.object:set_properties({
textures = {"pig_with_saddle.png"},
})
end
if self.lifetimer <= 0 and not self.tamed then
self.object:remove()
end
end,
get_staticdata = function(self)
local tmp = {
lifetimer = self.lifetimer,
tamed = self.tamed,
color = self.color,
naked = self.naked,
saddle = self.saddle,
}
return minetest.serialize(tmp)
end,
on_punch = function(self, hitter)
-- death happens at 20 hp so we can play the death animation:
if self.object:get_hp() <= 20 then
local pos = self.object:getpos()
minetest.add_particlespawner({
amount = 20,
time = .2,
minpos = {x=pos.x-1, y=pos.y-.5, z=pos.z-1},
maxpos = {x=pos.x+1, y=pos.y+.5, z=pos.z+1},
minvel = {x=0, y=.3, z=0},
maxvel = {x=0, y=2, z=0},
minacc = {x=-.2, y=-.2, z=-.2},
maxacc = {x=.2, y=.2, z=.2},
minexptime = 1,
maxexptime = 5,
minsize = 1,
maxsize = 1,
collisiondetection = false,
vertical = false,
texture = "bettertnt_smoke.png",
})
self:set_animation("death")
self.object:set_hp(1000)
if self.name == "mobs:pig" and self.driver then
local name = self.driver:get_player_name()
self.driver:set_detach()
default.player_attached[name] = false
default.player_set_animation(self.driver, "stand" , 30)
self.driver = nil
end
minetest.after(self.animation.deathdur, function()
self.object:remove()
end)
if self.sounds and self.sounds.death then
minetest.sound_play(self.sounds.death, {object = self.object})
end
pos.y = pos.y + 0.5
local obj = nil
local ndrops = 0
for _,drop in ipairs(self.drops) do
if math.random(1, drop.chance) == 1 and ndrops < (self.maxdrops or 100) then
obj = minetest.add_item(pos, ItemStack(drop.name.." "..math.random(drop.min, drop.max)))
ndrops = ndrops + 1
if obj then
obj:setvelocity({x=math.random(-1,1), y=5, z=math.random(-1,1)})
end
end
end
else
if self.sounds and self.sounds.hurt then
minetest.sound_play(self.sounds.hurt, {object = self.object})
end
self:set_animation("hurt")
minetest.after(self.animation.hurtdur, function()
self:set_animation("walk")
end)
end
end,
__index = function(table,key)
return mobs.default_definition[key]
end,}
function mobs:register_mob(name, def)
setmetatable (def,mobs.default_definition)
minetest.register_entity(name, def)
end
function mobs:check_player_dist(pos, node)
for _,player in pairs(minetest.get_connected_players()) do
local p = player:getpos()
local dist = ((p.x-pos.x)^2 + (p.y-pos.y)^2 + (p.z-pos.z)^2)^0.5
if dist < 24 then
return 1
end
end
return nil
end
mobs.spawning_mobs = {}
function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height, spawn_func)
if minetest.setting_getbool(string.gsub(name,":","_").."_spawn") ~= false then
mobs.spawning_mobs[name] = true
minetest.register_abm({
nodenames = nodes,
neighbors = {"air"},
interval = 10,
chance = chance,
action = function(pos, node, _, active_object_count_wider)
if node.name == "default:ice" or node.name == "default:glass" then
return
end
if active_object_count_wider > active_object_count then
return
end
if not mobs.spawning_mobs[name] then
return
end
pos.y = pos.y+1
if not minetest.get_node_light(pos) then
return
end
if minetest.get_node_light(pos) > max_light then
return
end
if minetest.get_node_light(pos) < min_light then
return
end
if pos.y > max_height then
return
end
if minetest.get_node(pos).name ~= "air" then
return
end
pos.y = pos.y+1
if minetest.get_node(pos).name ~= "air" then
return
end
if spawn_func and not spawn_func(pos, node) then
return
end
if mobs:check_player_dist(pos, node) then
return
end
if minetest.setting_getbool("display_mob_spawn") then
minetest.chat_send_all("[mobs] Add "..name.." at "..minetest.pos_to_string(pos))
end
minetest.add_entity(pos, name)
end
})
end
end
function mobs:register_arrow(name, def)
minetest.register_entity(name, {
physical = false,
visual = def.visual,
visual_size = def.visual_size,
textures = def.textures,
velocity = def.velocity,
hit_player = def.hit_player,
hit_node = def.hit_node,
on_step = function(self, dtime)
local pos = self.object:getpos()
if minetest.get_node(self.object:getpos()).name ~= "air" then
minetest.sound_play("bowhit1", {pos = pos})
self.hit_node(self, pos, node)
self.object:remove()
return
end
pos.y = pos.y-1
for _,player in pairs(minetest.get_objects_inside_radius(pos, 1)) do
if player:is_player() then
self.hit_player(self, player)
minetest.sound_play("damage", {pos = pos})
self.object:remove()
return
end
end
end
})
end
function mobs:register_egg(mob, desc, img)
minetest.register_craftitem(mob, {
description = "Spawn "..desc,
inventory_image = img,
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.above
if pointed_thing.above and not minetest.is_protected(pos, placer:get_player_name()) then
pos.y = pos.y + 0.5
minetest.add_entity(pos, mob)
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
end
return itemstack
end,
})
end

File diff suppressed because it is too large Load Diff

159
mods/mobs_mc/chicken.lua Normal file
View File

@ -0,0 +1,159 @@
--MCmobs v0.2
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
--dofile(minetest.get_modpath("mobs").."/api.lua")
mobs:register_mob("mobs_mc:chicken", {
type = "animal",
hp_max = 24,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
visual = "mesh",
mesh = "mobs_mc_chicken.x",
textures = {
{"mobs_mc_chicken.png"}
},
makes_footstep_sound = true,
walk_velocity = 1,
armor = 200,
drops = {
{name = "mcl_mobitems:chicken_raw",
chance = 1,
min = 1,
max = 1,},
{name = "mcl_mobitems:feather",
chance = 1,
min = 0,
max = 2,},
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
sounds = {
random = "Chicken1",
death = "Chickenhurt1",
hurt = "Chickenhurt1",
},
animation = {
speed_normal = 24,
stand_start = 0,
stand_end = 23,
walk_start = 24,
walk_end = 49,
hurt_start = 118,
hurt_end = 154,
death_start = 154,
death_end = 179,
eat_start = 49,
eat_end = 78,
look_start = 78,
look_end = 108,
fly_start = 181,
fly_end = 187,
},
--[[
follow = "farming:seed_wheat",
view_range = 5,
on_rightclick = function(self, clicker)
if clicker:get_inventory() then
if minetest.registered_items[":mobs:egg"] then
clicker:get_inventory():add_item("main", ItemStack(":mobs:egg 1"))
end
end
end,
do_custom = function(self)
if self.child
or math.random(1, 5000) > 1 then
return
end
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,
]]
--from mobs_animals
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 self.child
or math.random(1, 5000) > 1 then
return
end
local pos = self.object:getpos()
minetest.add_item(pos, "mcl_mobitems:egg")
minetest.sound_play("default_place_node_hard", {
pos = pos,
gain = 1.0,
max_hear_distance = 5,
})
end,
})
--mobs:register_spawn("mobs_mc:chicken", {"default:dirt_with_grass"}, 20, 8, 7000, 1, 31000)
-- from mobs_redo
-- 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
})
-- compatibility
mobs:alias_mob("mobs:chicken", "mobs_mc:chicken")
-- spawn eggs
mobs:register_egg("mobs_mc:chicken", "Chicken", "spawn_egg_chicken.png")
if minetest.setting_get("log_mods") then
minetest.log("action", "MC chicken loaded")
end

139
mods/mobs_mc/cow.lua Normal file
View File

@ -0,0 +1,139 @@
--MCmobs v0.2
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
--dofile(minetest.get_modpath("mobs").."/api.lua")
mobs:register_mob("mobs_mc:cow", {
type = "animal",
hp_max = 28,
collisionbox = {-0.6, -0.01, -0.6, 0.6, 1.8, 0.6},
visual = "mesh",
mesh = "mobs_mc_cow.x",
textures = {
{"mobs_mc_cow.png"}
},
makes_footstep_sound = true,
walk_velocity = 1,
armor = 200,
drops = {
{name = "mobs:beef_raw",
chance = 1,
min = 1,
max = 3,},
{name = "mobs:leather",
chance = 1,
min = 0,
max = 2,},
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
fear_height = 3,
sounds = {
random = "Cow1",
death = "Cowhurt1",
damage = "Cowhurt1",
},
animation = {
speed_normal = 24,
stand_start = 0,
stand_end = 23,
walk_start = 24,
walk_end = 49,
hurt_start = 118,
hurt_end = 154,
death_start = 154,
death_end = 179,
eat_start = 49,
eat_end = 78,
look_start = 78,
look_end = 108,
},
--[[
follow = "farming:wheat",
view_range = 5,
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
if item:get_name() == "bucket:bucket_empty" and clicker:get_inventory() then
local inv = clicker:get_inventory()
inv:remove_item("main", "bucket:bucket_empty")
-- if room add bucket of milk to inventory, otherwise drop as item
if inv:room_for_item("main", {name="mobs:bucket_milk"}) then
clicker:get_inventory():add_item("main", "mobs:bucket_milk")
else
local pos = self.object:getpos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {name = "mobs:bucket_milk"})
end
end
end,
]]
--from mobs_animals
follow = "farming:wheat",
view_range = 7,
replace_rate = 10,
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)
-- feed or tame
if mobs:feed_tame(self, clicker, 8, true, true) then
return
end
local tool = clicker:get_wielded_item()
-- milk cow with empty bucket
if tool:get_name() == "bucket:bucket_empty" then
--if self.gotten == true
if self.child == true then
return
end
if self.gotten == true then
minetest.chat_send_player(clicker:get_player_name(),
"Cow already milked!")
return
end
local inv = clicker:get_inventory()
inv:remove_item("main", "bucket:bucket_empty")
if inv:room_for_item("main", {name = "mobs:bucket_milk"}) then
clicker:get_inventory():add_item("main", "mobs:bucket_milk")
else
local pos = self.object:getpos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {name = "mobs:bucket_milk"})
end
self.gotten = true -- milked
return
end
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
end,
})
--mobs:register_spawn("mobs_mc:cow", {"default:dirt_with_grass"}, 20, 8, 7000, 1, 31000)
-- compatibility
mobs:alias_mob("mobs:cow", "mobs_mc:cow")
-- spawn egg
mobs:register_egg("mobs_mc:cow", "Cow", "spawn_egg_cow.png")
if minetest.setting_get("log_mods") then
minetest.log("action", "MC Cow loaded")
end

111
mods/mobs_mc/creeper.lua Normal file
View File

@ -0,0 +1,111 @@
--MCmobs v0.2
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
--dofile(minetest.get_modpath("mobs").."/api.lua")
mobs:register_mob("mobs_mc:creeper", {
type = "monster",
hp_max = 30,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.6, 0.4},
pathfinding = true,
group_attack = true,
visual = "mesh",
visual_size = {x=.75, y=.75, z=.75},
mesh = "mobs_creeper.x",
textures = {
{"mobs_creeper.png"}
},
makes_footstep_sound = false,
sounds = {
attack = "Fuse",
death = "Creeperdeath",
damage = "Creeper4",
war_cry = "Fuse",
explode = "explo",
},
walk_velocity = 1.5,
run_velocity = 3,
damage = 1,
explosion_radius = 3,
armor = 200,
maxdrops = 3,
drops = {
{name = "tnt:gunpowder",
chance = 1,
min = 0,
max = 2,},
{name = "default:flint_and_steel",
chance = 1,
min = 0,
max = 1,},
{name = "farorb:farorb",
chance = 1,
min = 0,
max = 1,},
{name = "jdukebox:disc_1",
chance = 10,
min = 0,
max = 1,},
{name = "jdukebox:disc_2",
chance = 10,
min = 0,
max = 1,},
{name = "jdukebox:disc_3",
chance = 10,
min = 0,
max = 1,},
{name = "jdukebox:disc_4",
chance = 10,
min = 0,
max = 1,},
{name = "jdukebox:disc_5",
chance = 10,
min = 0,
max = 1,},
{name = "jdukebox:disc_6",
chance = 10,
min = 0,
max = 1,},
},
animation = {
speed_normal = 24,
speed_run = 48,
stand_start = 0,
stand_end = 23,
walk_start = 24,
walk_end = 49,
run_start = 24,
run_end = 49,
hurt_start = 110,
hurt_end = 139,
death_start = 140,
death_end = 189,
look_start = 50,
look_end = 108,
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
view_range = 16,
attack_type = "explode",
})
mobs:register_spawn("mobs_mc:creeper", {"group:crumbly", "group:cracky", "group:choppy", "group:snappy"}, 7, -1, 5000, 4, 31000)
-- compatibility
mobs:alias_mob("mobs:creeper", "mobs_mc:creeper")
-- spawn eggs
mobs:register_egg("mobs_mc:creeper", "Creeper", "spawn_egg_creeper.png")
if minetest.setting_get("log_mods") then
minetest.log("action", "MC Creeper loaded")
end

5
mods/mobs_mc/depends.txt Normal file
View File

@ -0,0 +1,5 @@
default
fire
mobs
tnt
mcl_mobitems

View File

@ -0,0 +1 @@
Adds Minecraft-like monsters and animals.

80
mods/mobs_mc/enderman.lua Normal file
View File

@ -0,0 +1,80 @@
--MCmobs v0.2
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
--dofile(minetest.get_modpath("mobs").."/api.lua")
mobs:register_mob("mobs_mc:enderman", {
type = "monster",
hp_max = 39,
collisionbox = {-0.4, -2.4, -0.4, 0.4, 1.8, 0.4},
visual = "mesh",
mesh = "mobs_sand_monster.b3d",
textures = {
{"mobs_endermen.png"}
},
visual_size = {x=1.2, y=2.5},
makes_footstep_sound = true,
sounds = {
random = "mobs_sandmonster",
death = "green_slime_death",
damage = "Creeperdeath",
},
walk_velocity = 3.2,
run_velocity = 5.4,
damage = 1,
armor = 200,
drops = {
{name = "default:obsidian",
chance = 4,
min = 0,
max = 2,},
{name = "default:diamond",
chance = 11,
min = 1,
max = 1,},
{name = "farorb:farorb",
chance = 3,
min = 0,
max = 1,},
},
animation = {
speed_normal = 45,
speed_run = 15,
stand_start = 0,
stand_end = 39,
walk_start = 41,
walk_end = 72,
run_start = 74,
run_end = 105,
punch_start = 74,
punch_end = 105,
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
view_range = 16,
attack_type = "dogfight",
replace_rate = 1,
replace_what = {"default:torch","default:sand","default:desert_sand","default:cobble","default:dirt","default:dirt_with_glass","default:dirt_with_dry_grass","default:wood","default:stone","default:sandstone"},
replace_with = "air",
replace_offset = -1,
})
mobs:register_spawn("mobs_mc:enderman", { "default:sand", "default:desert_sand"}, 5, -1, 5000, 4, 31000)
-- spawn eggs
mobs:register_egg("mobs_mc:enderman", "Enderman", "spawn_egg_overlay.png")
if minetest.setting_get("log_mods") then
minetest.log("action", "MC Enderman loaded")
end

125
mods/mobs_mc/ghast.lua Normal file
View File

@ -0,0 +1,125 @@
--MCmobs v0.2
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
--dofile(minetest.get_modpath("mobs").."/api.lua")
mobs:register_mob("mobs_mc:ghast", {
type = "monster",
pathfinding = true,
group_attack = true,
hp_max = 50,
collisionbox = {-1.45, -1.45, -1.45 ,1.45, 1.45, 1.45},
visual_size = {x=3.0, y=3.0},
-- textures = {
-- {"ghast_top.png", "ghast_bottom.png", "ghast_front.png", "ghast_sides.png", "ghast_sides.png", "ghast_sides.png"}
-- },
textures = {
{"ghast_white.png", "ghast_white.png", "ghast_front.png", "ghast_white.png", "ghast_white.png", "ghast_white.png"}
},
visual = "cube",
blood_texture ="mobs_blood.png",
rotate = 270,
makes_footstep_sound = true,
sounds = {
shoot = "mobs_fireball",
death = "zombiedeath",
damage = "ghast_damage",
attack = "mobs_fireball",
random = "mobs_eerie",
},
walk_velocity = .8,
run_velocity = 2.6,
damage = 1,
armor = 100,
drops = {
{name = "default:lava_source 1",
chance = 3,
min = 1,
max = 4,},
{name = "default:diamond",
chance = 1,
min = 1,
max = 5,},
},
animation = {
speed_normal = 24,
speed_run = 48,
stand_start = 0,
stand_end = 23,
walk_start = 24,
walk_end = 47,
run_start = 48,
run_end = 62,
hurt_start = 64,
hurt_end = 86,
death_start = 88,
death_end = 118,
},
drawtype = "front",
water_damage = 10,
lava_damage = 0,
light_damage = 0,
fall_damage = 0,
view_range = 16,
--attack_type = "dogshoot",
attack_type = "dogshoot",
arrow = "mobs_monster:fireball",
shoot_interval = 3.5,
shoot_offset = 1,
--'dogshoot_switch' allows switching between shoot and dogfight modes inside dogshoot using timer (1 = shoot, 2 = dogfight)
--'dogshoot_count_max' number of seconds before switching above modes.
dogshoot_switch = 1,
dogshoot_count_max =1,
passive = false,
jump = true,
jump_height = 4,
floats=1,
fly = true,
jump_chance = 98,
fear_height = 120,
})
mobs:register_spawn("mobs_mc:ghast", {"default:flowing_lava", "nether:rack","air"}, 17, -1, 5000, 1, -2000)
-- fireball (weapon)
mobs:register_arrow(":mobs_monster:fireball", {
visual = "sprite",
visual_size = {x = 0.5, y = 0.5},
textures = {"mobs_fireball.png"},
velocity = 6,
-- direct hit, no fire... just plenty of pain
hit_player = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 8},
}, nil)
end,
hit_mob = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 8},
}, nil)
end,
-- node hit, bursts into flame
hit_node = function(self, pos, node)
mobs:explosion(pos, 1, 1, 0)
end
})
-- spawn eggs
mobs:register_egg("mobs_mc:ghast", "Ghast", "ghast_front.png")
if minetest.setting_get("log_mods") then
minetest.log("action", "MC Ghast loaded")
end

359
mods/mobs_mc/horse.lua Normal file
View File

@ -0,0 +1,359 @@
--MCmobs v0.2
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
--dofile(minetest.get_modpath("mobs").."/api.lua")
-------------------------
--KPGMOBS HORSE
-------------------------
--By: KrupnovPavel
--Tweaked by: maikerumine
local function is_ground(pos)
local nn = minetest.get_node(pos).name
return minetest.get_item_group(nn, "crumbly") ~= 0 or
minetest.get_item_group(nn, "choppy") ~= 0 or
minetest.get_item_group(nn, "cracky") ~= 0 or
minetest.get_item_group(nn, "snappy") ~= 0 or
minetest.get_item_group(nn, "unbreakable") ~= 0 or
minetest.get_item_group(nn, "immortal") ~= 0
end
local function get_sign(i)
if i == 0 then
return 0
else
return i/math.abs(i)
end
end
local function get_velocity(v, yaw, y)
local x = math.cos(yaw)*v
local z = math.sin(yaw)*v
return {x=x, y=y, z=z}
end
local function get_v(v)
return math.sqrt(v.x^2+v.z^2)
end
function merge(a, b)
if type(a) == 'table' and type(b) == 'table' then
for k,v in pairs(b) do if type(v)=='table' and type(a[k] or false)=='table' then merge(a[k],v) else a[k]=v end end
end
return a
end
-- HORSE go go goooo :)
local horse = {
physical = true,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
visual = "mesh",
stepheight = 1.1,
visual_size = {x=1,y=1},
mesh = "mobs_horseh1.x",
driver = nil,
v = 0,
on_rightclick = function(self, clicker)
if not clicker or not clicker:is_player() then
return
end
if self.driver and clicker == self.driver then
self.driver = nil
clicker:set_detach()
elseif not self.driver then
self.driver = clicker
clicker:set_attach(self.object, "", {x=0,y=11,z=0}, {x=0,y=0,z=0})
self.object:setyaw(clicker:get_look_yaw())
end
end,
on_activate = function(self, staticdata, dtime_s)
self.object:set_armor_groups({immortal=1})
print (self.texture, self.jmp)
end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, direction)
if puncher and puncher:is_player() then
puncher:get_inventory():add_item("main", self.name)
self.object:remove()
end
end,
on_step = function(self, dtime)
self.v = get_v(self.object:getvelocity())*get_sign(self.v)
if self.driver then
local ctrl = self.driver:get_player_control()
if ctrl.up then
self.v = self.v + self.jmp
end
if ctrl.down then
self.v = self.v-0.1
end
if ctrl.left then
self.object:setyaw(self.object:getyaw()+math.pi/120+dtime*math.pi/120)
end
if ctrl.right then
self.object:setyaw(self.object:getyaw()-math.pi/120-dtime*math.pi/120)
end
if ctrl.jump then
local p = self.object:getpos()
p.y = p.y-0.5
if is_ground(p) then
local pos = self.object:getpos()
pos.y = math.floor(pos.y)+4
self.object:setpos(pos)
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), 0))
end
end
end
local s = get_sign(self.v)
self.v = self.v - 0.02*s
if s ~= get_sign(self.v) then
self.object:setvelocity({x=0, y=0, z=0})
self.v = 0
return
end
if math.abs(self.v) > 4.5 then
self.v = 4.5*get_sign(self.v)
end
local p = self.object:getpos()
p.y = p.y-0.5
if not is_ground(p) then
if minetest.registered_nodes[minetest.get_node(p).name].walkable then
self.v = 0
end
self.object:setacceleration({x=0, y=-10, z=0})
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y))
else
p.y = p.y+1
if is_ground(p) then
self.object:setacceleration({x=0, y=3, z=0})
local y = self.object:getvelocity().y
if y > 2 then
y = 2
end
if y < 0 then
self.object:setacceleration({x=0, y=10, z=0})
end
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), y))
else
self.object:setacceleration({x=0, y=0, z=0})
if math.abs(self.object:getvelocity().y) < 1 then
local pos = self.object:getpos()
pos.y = math.floor(pos.y)+0.5
self.object:setpos(pos)
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), 0))
else
self.object:setvelocity(get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y))
end
end
end
end,
}
--END HORSE
-- backup table
local hbak = horse
-- Brown Horse
local hrs = {
textures = {"mobs_horseh1.png"},
jmp = 2,
}
minetest.register_entity("mobs_mc:horseh1", merge(hrs, horse))
-- White Horse
horse = hbak
local peg = {
textures = {"mobs_horsepegh1.png"},
jmp = 2,
}
minetest.register_entity("mobs_mc:horsepegh1", merge(peg, horse))
-- Black Horse
horse = hbak
local ara = {
textures = {"mobs_horsearah1.png"},
jmp = 3,
}
minetest.register_entity("mobs_mc:horsearah1", merge(ara, horse))
mobs:register_mob("mobs_mc:horse", {
type = "animal",
hp_min = 5,
hp_max = 10,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
textures = {
{"mobs_horseh.png"},
},
visual = "mesh",
mesh = "mobs_horse.x",
makes_footstep_sound = true,
walk_velocity = 1,
armor = 200,
drops = {
{name = "mcl_mobitems:meat_raw",
chance = 1,
min = 2,
max = 3,},
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
fear_height = 6,
animation = {
speed_normal = 15,
stand_start = 25, stand_end = 75,
walk_start = 75, walk_end = 100,
},
follow = "farming:wheat",
view_range = 5,
on_rightclick = function(self, clicker)
local tool = clicker:get_wielded_item()
if tool:get_name() == "mobs:saddle" then
clicker:get_inventory():remove_item("main", "mobs:saddle")
local pos = self.object:getpos()
self.object:remove()
minetest.add_entity(pos, "mobs_mc:horseh1")
end
end,
})
mobs:register_mob("mobs_mc:horse2", {
type = "animal",
hp_min = 5,
hp_max = 10,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
textures = {
{"mobs_horsepegh.png"},
},
visual = "mesh",
mesh = "mobs_horse.x",
makes_footstep_sound = true,
walk_velocity = 1,
armor = 200,
drops = {
{name = "mcl_mobitems:meat_raw",
chance = 1,
min = 2,
max = 3,},
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
fear_height = 6,
animation = {
speed_normal = 15,
stand_start = 25, stand_end = 75,
walk_start = 75, walk_end = 100,
},
follow = "farming:wheat",
view_range = 5,
on_rightclick = function(self, clicker)
local tool = clicker:get_wielded_item()
if tool:get_name() == "mobs:saddle" then
clicker:get_inventory():remove_item("main", "mobs:saddle")
local pos = self.object:getpos()
self.object:remove()
minetest.add_entity(pos, "mobs_mc:horsepegh1")
end
end,
})
mobs:register_mob("mobs_mc:horse3", {
type = "animal",
hp_min = 5,
hp_max = 10,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
textures = {
{"mobs_horsearah.png"},
},
visual = "mesh",
mesh = "mobs_horse.x",
makes_footstep_sound = true,
walk_velocity = 1,
armor = 200,
drops = {
{name = "mcl_mobitems:meat_raw",
chance = 1,
min = 2,
max = 3,},
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
fear_height = 6,
animation = {
speed_normal = 15,
stand_start = 25, stand_end = 75,
walk_start = 75, walk_end = 100,
},
follow = "farming:wheat",
view_range = 5,
on_rightclick = function(self, clicker)
local tool = clicker:get_wielded_item()
if tool:get_name() == "mobs:saddle" then
clicker:get_inventory():remove_item("main", "mobs:saddle")
local pos = self.object:getpos()
self.object:remove()
minetest.add_entity(pos, "mobs_mc:horsearah1")
end
end,
})
mobs:register_spawn("mobs_mc:horse", {"default:dirt_with_dry_grass","es:strange_grass","es:aiden_grass"}, 20, 12, 21000, 1, 12)
mobs:register_spawn("mobs_mc:horse2", {"default:dirt_with_dry_grass"}, 20, 12, 23000, 1, 31000)
mobs:register_spawn("mobs_mc:horse3", {"default:desert_sand"}, 20, 8, 17000, 1, 5)
-- saddle
minetest.register_craftitem(":mobs:saddle", {
description = "Saddle",
inventory_image = "saddle.png",
})
minetest.register_craft({
output = "mobs:saddle",
recipe = {
{"mobs:leather", "mobs:leather", "mobs:leather"},
{"farming:string", "", "farming:string"},
{"default:steel_ingot", "", "default:steel_ingot"}
},
})
-- compatibility
mobs:alias_mob("mobs:horse", "mobs_mc:horse")
mobs:alias_mob("mobs:horse2", "mobs_mc:horse2")
mobs:alias_mob("mobs:horse3", "mobs_mc:horse3")
-- spawn eggs
-- KPV wild horse spawn eggs
mobs:register_egg("mobs_mc:horse", "Brown Horse", "mobs_horse_inv.png", 0)
mobs:register_egg("mobs_mc:horse2", "White Horse", "mobs_horse_peg_inv.png", 0)
mobs:register_egg("mobs_mc:horse3", "Arabic Horse", "mobs_horse_ara_inv.png", 0)
-- KPV tamed horse spawn eggs
mobs:register_egg("mobs_mc:horseh1", "Tamed Brown Horse", "mobs_horse_inv.png", 0)
mobs:register_egg("mobs_mc:horsepegh1", "Tamed White Horse", "mobs_horse_peg_inv.png", 0)
mobs:register_egg("mobs_mc:horsearah1", "Tamed Arabic Horse", "mobs_horse_ara_inv.png", 0)
if minetest.setting_get("log_mods") then
minetest.log("action", "MC Horse loaded")
end

31
mods/mobs_mc/init.lua Normal file
View File

@ -0,0 +1,31 @@
--MCmobs v0.2
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
local path = minetest.get_modpath("mobs_mc")
-- Animals
dofile(path .. "/chicken.lua") -- Mesh and animation by Pavel_S
dofile(path .. "/cow.lua") -- Mesh by Morn76 Animation by Pavel_S
dofile(path .. "/sheep.lua") -- Mesh and animation by Pavel_S
dofile(path .. "/pig.lua") -- Mesh and animation by Pavel_S
dofile(path .. "/horse.lua") -- KrupnoPavel
dofile(path .. "/wolf.lua") -- KrupnoPavel
dofile(path .. "/horse.lua") -- KrupnoPavel
-- NPC
dofile(path .. "/villager.lua") -- KrupnoPavel
--Monsters
dofile(path .. "/creeper.lua") -- Mesh by Morn76 Animation by Pavel_S
dofile(path .. "/skeleton.lua") -- Mesh by Morn76 Animation by Pavel_S
dofile(path .. "/zombie.lua") -- Mesh by Morn76 Animation by Pavel_S
dofile(path .. "/zombiepig.lua") -- Mesh by Morn76 Animation by Pavel_S
dofile(path .. "/slimes.lua") -- Tomas J. Luis
dofile(path .. "/spider.lua") -- Spider by AspireMint (fishyWET (CC-BY-SA 3.0 license for texture)
dofile(path .. "/enderman.lua") -- maikerumine
dofile(path .. "/ghast.lua") -- maikerumine
print ("[MOD] Mobs Redo 'MC' loaded")

269
mods/mobs_mc/license.txt Normal file
View File

@ -0,0 +1,269 @@
--MCmobs v0.2
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes such as this one.
Notes
-----
cows: right-click with empty bucket gets milk
sheep: right-click gets wool
chicken: right-click to get an egg
Milk and eggs need a food mod to be installed.
Textures are from Faithful 32x32 pack (http://www.minecraftforum.net/topic/72747-faithful-32x32-pack-updateocelot-two-cats-new-saplings-ctm-17/)
Sounds are from the Minecraft Wiki (Freesound license)
=====Pig=====(at layer 1)
=====Cow=====(at layer 2)
=====Sheep=====(at layer 3)
Ver.0.3
Mesh by Morn76
Animation by Pavel_S
===Chicken===
Mesh and animation by Pavel_S
Meshes : Pig, Cow, Sheep
Armatures : Pig_Rig, Cow_Rig, Sheep_Rig
==Animation==
Optimized for 24fps.
(the last frame equal to first in each animation)
The first frame of each animation is default pose.
=List of animations :
standing (head bobbing slightly up and down) : 1-24
walking : 24-50
eating (head goes to the ground) : 50-79
eating cycle : 58-73
look around
right : 79-99
looking left pose : 89
left : 99-119
looking right pose : 109
hurt (quick half jump with legs slightly crossed) : 119-155
death (falls on left side) : 155-180
There is no delays for looking around and repeats for eating!
==Rig==
See Pig_Rig.png
==ChangeLog==
0.3
Added Cow, Sheep
Added Cow and Sheep animations
Fixed UVunwraps
Extended hurt and death animation
0.2
Added Pig animation
Fixed UVunwrap
=====Creeper=====
Ver.0.3
Mesh by Morn76
Animation by Pavel_S
Meshes : Creeper
Armatures : Creeper_Rig
==Animation==
Optimized for 24fps.
(the last frame equal to first in each animation)
The first frame of each animation is default pose.
=List of animations :
standing : 1-25
walking : 25-50
look around
right : 50-80
looking left pose : 65
left : 80-110
looking right pose : 95
hurt : 110-140
death : 140-190
=====Skeleton=====
Ver.0.3
Mesh by Morn76
Animation by Pavel_S
Meshes : Skeleton
Armatures : Skeleton_Rig
==Animation==
Optimized for 30fps.
(the last frame equal to first in each animation)
The first frame of each animation is default pose.
=List of animations :
standing (head bobbing slightly up and down) : 1-25
walking : 25-50
hurt (quick half jump with legs slightly crossed) : 85-117
death (falls on left side) : 117-146
=====Zombie=====
Mesh by Morn76
Animation by Pavel_S
1 - 24 - standing
24 - 48 - walking
48 - 64 - running
64 - 88 - hurm
88 - 120 - death
*******************************************************************************
Original "Slimes Redone" README follows
"Slimes Redone" - Mod for Minetest (http://www.minetest.net/)
Introduction
==========================================================================================================================
This mod adds two type of mobs in the world of Minetest: green slimes and lava slimes. They are hostile and will attack the
players as soon as they see them. If they are defeated, the slimes maybe will reward the player with useful resources.
Green slimes live in the tall grass of the jungles and in the ancient ruins of lost temples. And lava slimes live deep
underground near the lava pools.
I've made this mod inspired by this other: https://forum.minetest.net/viewtopic.php?f=11&t=2979&hilit=slimes which adds friendly
slimes. Thank you Jeija!
Details
==========================================================================================================================
- Adds two new hostile mobs: green slimes and lava slimes.
- They attack players and hurt them on touch. (i'm not sure if the amount of damage is enough or too much...:/)
- The biger ones split in a random amout of smaller versions when defeated: big > medium > small.
- They can get different enviromental damage: water, lava, sunlight and falling.
- They use custom textures and sounds. (more work needs to be done here ;P)
- Cartoonish animation (they deform a bit when landing and stretch out when jumping).
- Effects (blood, smoke, bubbles, footprints,..).
- API to add new slimes.
Green slimes:
> spawn in jungle grass or in temples mossy cobble (default:mossycobble).
> on die, they drop a randomish amount of glue (from mesecon mod)
> Lava hurts them.
Lava slimes:
> spawn in lava pools deep under ground.
> on die, they drop a randomish amount of gunpowder (from default tnt mod).
> water hurts them.
> when they jump they leave behind a footprint of fire. ^^
Install
==========================================================================================================================
Unzip the archive an place it in minetest-base-directory/mods/minetest/
If you have a windows client or a linux run-in-place client.
If you have a linux system-wide instalation place it in ~/.minetest/mods/minetest/.
If you want to install this mod only in one world create the folder worldmods/ in your world directory.
For further information or help see: http://wiki.minetest.com/wiki/Installing_Mods
How to use the mod:
==========================================================================================================================
Just install it an everything should work.
Mod Information
==========================================================================================================================
Version: 0.1
Required Minetest Version: >=0.4.12
Dependencies: default, default:tnt, mesecon (https://forum.minetest.net/viewtopic.php?f=11&t=628&hilit=mesecon)
Soft Dependencies: (none)
Highly Recommended: (none)
Craft Recipies: (none)
Git Repo: https://github.com/TomasJLuis/mt-slimes-redone
Modders/Developers
=========================================================================================================================
If you are a modder, you should know that I've never used LUA before. this is my first mod for Mintetest, and I've used
this mod to learn how to mod on Minetest. So may be you will find a code full of mistakes and bad practices... ;P
If you spot someting that can/must be improved/changed/removed and want to help me to improve this mode and my knowledge,
please tell me here: https://forum.minetest.net/viewtopic.php?f=9&t=11743&p=175186#p175186
Thank you!
Version history
==========================================================================================================================
0.1 - Initial release
Copyright and Licensing
==========================================================================================================================
- Author: Tomas J. Luis
- Original sound for slime damage by RandomationPictures under licence CC0 1.0.
http://www.freesound.org/people/RandomationPictures/sounds/138481/
- Original sounds for slime jump, land and death by Dr. Minky under licence CC BY 3.0.
http://www.freesound.org/people/DrMinky/sounds/
- Source code and images by Tomas J. Luis under WTFPL.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
*******************************************************************************
Original "simple mobs" README follows
=== MOBS-MOD for MINETEST-C55 ===
by PilzAdam
Inroduction:
This mod adds some basic hostile and friendly mobs to the game.
How to install:
Unzip the archive an place it in minetest-base-directory/mods/minetest/
if you have a windows client or a linux run-in-place client. If you have
a linux system-wide instalation place it in ~/.minetest/mods/minetest/.
If you want to install this mod only in one world create the folder
worldmods/ in your worlddirectory.
For further information or help see:
http://wiki.minetest.com/wiki/Installing_Mods
How to use the mod:
See https://github.com/PilzAdam/mobs/wiki
For developers:
The API documentation is moved to https://github.com/PilzAdam/mobs/wiki/API
License:
Sourcecode: WTFPL (see below)
Grahpics: WTFPL (see below)
Models: WTFPL (by Pavel_S, see below)
See also:
http://minetest.net/
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

Some files were not shown because too many files have changed in this diff Show More