diff --git a/api/api.lua b/api/api.lua index b83f136..f190e49 100644 --- a/api/api.lua +++ b/api/api.lua @@ -1,12 +1,14 @@ ------------- ---- API ---- ------------- --- Ver 0.1 -- +-- Ver 0.2 -- local hitbox = mob_core.get_hitbox local find_string = mob_core.find_val +local creative = minetest.settings:get_bool("creative_mode") + ---------- -- Math -- ---------- @@ -23,13 +25,13 @@ end local function round(x) -- Round to nearest multiple of 0.5 return x + 0.5 - (x + 0.5) % 1 end + local function clamp(num, min, max) if num < min then num = min elseif num > max then num = max end - return num end @@ -86,6 +88,10 @@ end local is_movable = mob_core.is_moveable +local function walkable(pos) + return minetest.registered_nodes[minetest.get_node(pos).name].walkable +end + ------------------- -- API Functions -- ------------------- @@ -199,7 +205,7 @@ function animalia.feed_tame(self, clicker, feed_count, tame, breed) local pos = self.object:get_pos() local mob_name = mob_core.get_name_proper(self.name) if mob_core.follow_holding(self, clicker) then - if creative == false then + if not creative then item:take_item() clicker:set_wielded_item(item) end @@ -582,8 +588,7 @@ end local function is_under_solid(pos) local pos2 = vector.new(pos.x, pos.y + 1, pos.z) - local def = minetest.registered_nodes[minetest.get_node(pos2).name] - return (def.walkable or ((mobkit.get_node_height(pos2) or 0) < 1.5)) + return (walkable(pos2) or ((mobkit.get_node_height(pos2) or 0) < 1.5)) end local function vec_center(vec) @@ -598,21 +603,28 @@ local function do_step(self, moveresult) local width = hitbox(self)[4] - 0.1 if not self._step then for _, data in ipairs(moveresult.collisions) do - if data.type == "node" - and data.node_pos.y + 0.5 > pos.y - and not is_under_solid(data.node_pos) - and not vector.equals(vec_center(pos), vec_center(data.node_pos)) then - local vel_yaw = self.object:get_yaw() - local dir_yaw = minetest.dir_to_yaw(vector.direction(pos, data.node_pos)) - if diff(vel_yaw, dir_yaw) < 1.6 then - self._step = data.node_pos - break + if data.type == "node" then + local step_pos = data.node_pos + local halfway = vector.add(pos, vector.multiply(vector.direction(pos, step_pos), 0.5)) + if step_pos.y + 0.5 > pos.y + and is_movable({x = halfway.x, y = data.node_pos.y + 1, z = halfway.z}, width, self.height) + and not is_under_solid(data.node_pos) + and walkable({x = pos.x, y = pos.y - 1, z = pos.z}) + and not vector.equals(vec_center(pos), vec_center(data.node_pos)) then + local vel_yaw = self.object:get_yaw() + local dir_yaw = minetest.dir_to_yaw(vector.direction(pos, data.node_pos)) + if diff(vel_yaw, dir_yaw) < width * 2 then + self._step = data.node_pos + break + end + else + self._step = nil end end end else local vel = self.object:get_velocity() - self.object:set_velocity(vector.new(vel.x, 4, vel.z)) + self.object:set_velocity(vector.new(vel.x, 7, vel.z)) if self._step.y < pos.y - 0.5 then self.object:set_velocity(vector.new(vel.x, 0.5, vel.z)) self._step = nil @@ -1304,8 +1316,12 @@ function animalia.hq_mount_logic(self, prty) if self.isinliquid then tvel = tvel * 0.4 vel.y = vel.y * 0.4 - elseif jumping then - tvel = tvel * 0.4 + else + if jumping then + tvel = tvel * 0.4 + else + tvel = tvel * 0.6 + end end end if tvel > 0 then diff --git a/mobs/chicken.lua b/mobs/chicken.lua index 3c58661..0f0f8f6 100644 --- a/mobs/chicken.lua +++ b/mobs/chicken.lua @@ -165,14 +165,14 @@ minetest.register_craftitem("animalia:poultry_raw", { description = "Raw Poultry", inventory_image = "animalia_poultry_raw.png", on_use = minetest.item_eat(1), - groups = {flammable = 2}, + groups = {flammable = 2, meat = 1}, }) minetest.register_craftitem("animalia:poultry_cooked", { description = "Cooked Poultry", inventory_image = "animalia_poultry_cooked.png", on_use = minetest.item_eat(6), - groups = {flammable = 2}, + groups = {flammable = 2, meat = 1}, }) minetest.register_craft({ diff --git a/mobs/cow.lua b/mobs/cow.lua index 56e122b..c0e2cee 100644 --- a/mobs/cow.lua +++ b/mobs/cow.lua @@ -227,14 +227,14 @@ minetest.register_craftitem("animalia:beef_raw", { description = "Raw Beef", inventory_image = "animalia_beef_raw.png", on_use = minetest.item_eat(1), - groups = {flammable = 2}, + groups = {flammable = 2, meat = 1}, }) minetest.register_craftitem("animalia:beef_cooked", { description = "Steak", inventory_image = "animalia_beef_cooked.png", on_use = minetest.item_eat(8), - groups = {flammable = 2}, + groups = {flammable = 2, meat = 1}, }) minetest.register_craft({ diff --git a/mobs/horse.lua b/mobs/horse.lua index 383b4e2..9eb0b7a 100644 --- a/mobs/horse.lua +++ b/mobs/horse.lua @@ -245,6 +245,10 @@ animalia.register_mob("horse", { self.object:set_properties({ textures = {texture .. "^animalia_horse_saddle.png"} }) + self.drops = { + {name = "animalia:leather", chance = 2, min = 1, max = 4}, + {name = "animalia:saddle", chance = 1, min = 1, max = 1} + } end end, on_rightclick = function(self, clicker) diff --git a/mobs/pig.lua b/mobs/pig.lua index a2fcf20..f522897 100644 --- a/mobs/pig.lua +++ b/mobs/pig.lua @@ -145,14 +145,14 @@ minetest.register_craftitem("animalia:porkchop_raw", { description = "Raw Porkchop", inventory_image = "animalia_porkchop_raw.png", on_use = minetest.item_eat(1), - groups = {flammable = 2}, + groups = {flammable = 2, meat = 1}, }) minetest.register_craftitem("animalia:porkchop_cooked", { description = "Cooked Porkchop", inventory_image = "animalia_porkchop_cooked.png", on_use = minetest.item_eat(7), - groups = {flammable = 2}, + groups = {flammable = 2, meat = 1}, }) minetest.register_craft({ diff --git a/mobs/sheep.lua b/mobs/sheep.lua index 4fddecc..17b3fd1 100644 --- a/mobs/sheep.lua +++ b/mobs/sheep.lua @@ -265,14 +265,14 @@ minetest.register_craftitem("animalia:mutton_raw", { description = "Raw Mutton", inventory_image = "animalia_mutton_raw.png", on_use = minetest.item_eat(1), - groups = {flammable = 2}, + groups = {flammable = 2, meat = 1}, }) minetest.register_craftitem("animalia:mutton_cooked", { description = "Cooked Mutton", inventory_image = "animalia_mutton_cooked.png", on_use = minetest.item_eat(6), - groups = {flammable = 2}, + groups = {flammable = 2, meat = 1}, }) minetest.register_craft({ diff --git a/sounds/cat/animalia_cat_hurt.ogg b/sounds/cat/animalia_cat_hurt.ogg index 3a37d55..64c8a34 100644 Binary files a/sounds/cat/animalia_cat_hurt.ogg and b/sounds/cat/animalia_cat_hurt.ogg differ diff --git a/sounds/cat/animalia_cat_idle.ogg b/sounds/cat/animalia_cat_idle.ogg index ef8fbbe..cd3043d 100644 Binary files a/sounds/cat/animalia_cat_idle.ogg and b/sounds/cat/animalia_cat_idle.ogg differ diff --git a/textures/animalia_shears.png b/textures/animalia_shears.png index 5d582cf..6f1eade 100644 Binary files a/textures/animalia_shears.png and b/textures/animalia_shears.png differ diff --git a/textures/items/animalia_porkchop_cooked.png b/textures/items/animalia_porkchop_cooked.png index d12be15..02663e3 100644 Binary files a/textures/items/animalia_porkchop_cooked.png and b/textures/items/animalia_porkchop_cooked.png differ diff --git a/textures/items/animalia_porkchop_raw.png b/textures/items/animalia_porkchop_raw.png index d13393b..fd3afee 100644 Binary files a/textures/items/animalia_porkchop_raw.png and b/textures/items/animalia_porkchop_raw.png differ