diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index f5d19f6..0b13248 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -1243,7 +1243,7 @@ minetest.register_node( default.write_name(pos, meta:get_string("text")) end, on_destruct = function(pos) - default.write_name(pos, "") + default.write_name(pos, "") end }) diff --git a/mods/default/sounds.lua b/mods/default/sounds.lua index 2e11772..4b956d2 100644 --- a/mods/default/sounds.lua +++ b/mods/default/sounds.lua @@ -103,4 +103,4 @@ function default.node_sound_snow_defaults(table) {name="default_dig_soft", gain=0.8} default.node_sound_defaults(table) return table -end \ No newline at end of file +end diff --git a/mods/default/textures/wieldhand.png b/mods/default/textures/wieldhand.png index 1b12e27..26f70cb 100644 Binary files a/mods/default/textures/wieldhand.png and b/mods/default/textures/wieldhand.png differ diff --git a/mods/default/textures/wieldhand.xcf b/mods/default/textures/wieldhand.xcf index c1ddbb3..e6f9e19 100644 Binary files a/mods/default/textures/wieldhand.xcf and b/mods/default/textures/wieldhand.xcf differ diff --git a/mods/default/tools.lua b/mods/default/tools.lua index 8415538..c04fc49 100644 --- a/mods/default/tools.lua +++ b/mods/default/tools.lua @@ -10,18 +10,92 @@ local tool_levels=nil if minetest.setting_getbool("creative_mode") == true then tool_levels = { wood = { - [3] = creative_digtime, - [2] = creative_digtime, + crumbly = { + [3] = creative_digtime, + [2] = creative_digtime, + [1] = creative_digtime, + }, + choppy = { + [3] = creative_digtime, + [2] = creative_digtime, + [1] = creative_digtime, + }, + cracky = { + [3] = creative_digtime, + [2] = creative_digtime, + [1] = creative_digtime, + }, + snappy = { + [3] = creative_digtime, + [2] = creative_digtime, + [1] = creative_digtime, + }, }, stone = { - [3] = creative_digtime, - [2] = creative_digtime, - [1] = creative_digtime, + crumbly = { + [3] = creative_digtime, + [2] = creative_digtime, + [1] = creative_digtime, + }, + choppy = { + [3] = creative_digtime, + [2] = creative_digtime, + [1] = creative_digtime, + }, + cracky = { + [3] = creative_digtime, + [2] = creative_digtime, + [1] = creative_digtime, + }, + snappy = { + [3] = creative_digtime, + [2] = creative_digtime, + [1] = creative_digtime, + }, }, steel = { - [3] = creative_digtime, - [2] = creative_digtime, - [1] = creative_digtime, + crumbly = { + [3] = creative_digtime, + [2] = creative_digtime, + [1] = creative_digtime, + }, + choppy = { + [3] = creative_digtime, + [2] = creative_digtime, + [1] = creative_digtime, + }, + cracky = { + [3] = creative_digtime, + [2] = creative_digtime, + [1] = creative_digtime, + }, + snappy = { + [3] = creative_digtime, + [2] = creative_digtime, + [1] = creative_digtime, + }, + }, + carbonsteel = { + crumbly = { + [3] = creative_digtime, + [2] = creative_digtime, + [1] = creative_digtime, + }, + choppy = { + [3] = creative_digtime, + [2] = creative_digtime, + [1] = creative_digtime, + }, + cracky = { + [3] = creative_digtime, + [2] = creative_digtime, + [1] = creative_digtime, + }, + snappy = { + [3] = creative_digtime, + [2] = creative_digtime, + [1] = creative_digtime, + }, }, } @@ -30,7 +104,7 @@ if minetest.setting_getbool("creative_mode") == true then { type = "none", wield_image = "wieldhand.png", - wield_scale = {x=1.5,y=3,z=3}, + wield_scale = {x=1.0,y=1.0,z=2.0}, tool_capabilities = { full_punch_interval = 1.0, max_drop_level = 0, @@ -49,18 +123,84 @@ if minetest.setting_getbool("creative_mode") == true then else tool_levels = { wood = { - [3] = 2.0, - [2] = 2.8, + crumbly = { + [3] = 1.6, + [2] = 2.0, + }, + choppy = { + [3] = 2.6, + [2] = 3.0, + }, + cracky = { + [3] = 3.8, + [2] = 4.2, + }, + snappy = { + [3] = 0.5, + [2] = 1.0, + }, }, stone = { - [3] = 1.0, - [2] = 1.7, - [1] = 2.1, + crumbly = { + [3] = 1.3, + [2] = 1.7, + }, + choppy = { + [3] = 2.3, + [2] = 2.7, + }, + cracky = { + [3] = 3.3, + [2] = 3.7, + }, + snappy = { + [3] = 0.4, + [2] = 0.9, + }, }, steel = { - [3] = 0.4, - [2] = 0.9, - [1] = 1.7, + crumbly = { + [3] = 1.0, + [2] = 1.4, + [1] = 2.5, + }, + choppy = { + [3] = 2.0, + [2] = 2.4, + [1] = 3.9, + }, + cracky = { + [3] = 2.8, + [2] = 3.2, + [1] = 4.5, + }, + snappy = { + [3] = 0.3, + [2] = 0.8, + [1] = 1.3, + }, + }, + carbonsteel = { + crumbly = { + [3] = 0.7, + [2] = 2.1, + [1] = 3.5, + }, + choppy = { + [3] = 1.7, + [2] = 2.1, + [1] = 3.6, + }, + cracky = { + [3] = 2.3, + [2] = 2.7, + [1] = 3.8, + }, + snappy = { + [3] = 0.2, + [2] = 0.7, + [1] = 1.2, + }, }, } @@ -69,15 +209,17 @@ else { type = "none", wield_image = "wieldhand.png", - wield_scale = {x=1.5,y=3,z=3}, + wield_scale = {x=1.0,y=1.0,z=2.0}, tool_capabilities = { full_punch_interval = 1.0, max_drop_level = 0, groupcaps = { fleshy = {times={[2]=1.6, [3]=1.0}, uses=0, maxlevel=1}, - crumbly = {times={[2]=3.0, [3]=2.0}, uses=0, maxlevel=1}, - snappy = {times={[3]=0.8}, uses=0, maxlevel=1}, - oddly_breakable_by_hand = {times={[1]=7.0,[2]=5.5,[3]=4.0}, uses=0, maxlevel=3}, + crumbly = {times={[2]=3.2, [3]=2.1}, uses=0, maxlevel=1}, + choppy = {times={[2]=3.5, [3]=3.8}, uses=0, maxlevel=1}, + cracky = {times={[2]=8.5, [3]=7.0}, uses=0, maxlevel=1}, + snappy = {times={[1]=2.5, [2]=2.0, [3]=1.5}, uses=0, maxlevel=1}, + oddly_breakable_by_hand = {times={[1]=7.0,[2]=5.5,[3]=4.0}, uses=0, maxlevel=1}, }, range = 3.8, damage_groups = {fleshy = 1} @@ -118,7 +260,7 @@ minetest.register_tool( tool_capabilities = { max_drop_level=0, groupcaps={ - cracky={times=tool_levels.wood, uses=10, maxlevel=1} + cracky={times=tool_levels.wood.cracky, uses=10, maxlevel=1} }, damage_groups = {fleshy = 2} }, @@ -132,7 +274,7 @@ minetest.register_tool( tool_capabilities = { max_drop_level=0, groupcaps={ - cracky={times=tool_levels.stone, uses=20, maxlevel=1} + cracky={times=tool_levels.stone.cracky, uses=20, maxlevel=1} }, damage_groups = {fleshy = 3} }, @@ -146,7 +288,7 @@ minetest.register_tool( tool_capabilities = { max_drop_level=1, groupcaps={ - cracky={times=tool_levels.steel, uses=25, maxlevel=2} + cracky={times=tool_levels.steel.cracky, uses=25, maxlevel=2} }, damage_groups = {fleshy = 4} }, @@ -160,7 +302,7 @@ minetest.register_tool( tool_capabilities = { max_drop_level=1, groupcaps={ - cracky={times=tool_levels.steel, uses=35, maxlevel=2} + cracky={times=tool_levels.carbonsteel.cracky, uses=35, maxlevel=2} }, damage_groups = {fleshy = 6} }, @@ -176,7 +318,7 @@ minetest.register_tool( tool_capabilities = { max_drop_level=0, groupcaps={ - crumbly={times=tool_levels.wood, uses=10, maxlevel=1} + crumbly={times=tool_levels.wood.crumbly, uses=10, maxlevel=1} }, damage_groups = {fleshy = 2} }, @@ -190,7 +332,7 @@ minetest.register_tool( tool_capabilities = { max_drop_level=0, groupcaps={ - crumbly={times=tool_levels.stone, uses=20, maxlevel=1} + crumbly={times=tool_levels.stone.crumbly, uses=20, maxlevel=1} }, damage_groups = {fleshy = 3} }, @@ -204,7 +346,7 @@ minetest.register_tool( tool_capabilities = { max_drop_level=1, groupcaps={ - crumbly={times=tool_levels.steel, uses=25, maxlevel=2} + crumbly={times=tool_levels.steel.crumbly, uses=25, maxlevel=2} }, damage_groups = {fleshy = 4} }, @@ -218,7 +360,7 @@ minetest.register_tool( tool_capabilities = { max_drop_level=1, groupcaps={ - crumbly={times=tool_levels.steel, uses=35, maxlevel=2} + crumbly={times=tool_levels.carbonsteel.crumbly, uses=35, maxlevel=2} }, damage_groups = {fleshy = 6} }, @@ -234,7 +376,7 @@ minetest.register_tool( tool_capabilities = { max_drop_level=0, groupcaps={ - choppy={times=tool_levels.wood, uses=10, maxlevel=1}, + choppy={times=tool_levels.wood.choppy, uses=10, maxlevel=1}, fleshy={times={[2]=1.20, [3]=0.60}, uses=10, maxlevel=1} }, damage_groups = {fleshy = 3} @@ -249,7 +391,7 @@ minetest.register_tool( tool_capabilities = { max_drop_level=0, groupcaps={ - choppy={times=tool_levels.stone, uses=20, maxlevel=1}, + choppy={times=tool_levels.stone.choppy, uses=20, maxlevel=1}, fleshy={times={[2]=1.10, [3]=0.40}, uses=20, maxlevel=1} }, damage_groups = {fleshy = 4} @@ -264,7 +406,7 @@ minetest.register_tool( tool_capabilities = { max_drop_level=1, groupcaps={ - choppy={times=tool_levels.steel, uses=25, maxlevel=2}, + choppy={times=tool_levels.steel.choppy, uses=25, maxlevel=2}, fleshy={times={[2]=1.00, [3]=0.20}, uses=40, maxlevel=1} }, damage_groups = {fleshy = 5} @@ -279,7 +421,7 @@ minetest.register_tool( tool_capabilities = { max_drop_level=1, groupcaps={ - choppy={times=tool_levels.steel, uses=35, maxlevel=2}, + choppy={times=tool_levels.carbonsteel.choppy, uses=35, maxlevel=2}, fleshy={times={[2]=1.00, [3]=0.20}, uses=40, maxlevel=1} }, damage_groups = {fleshy = 7} @@ -298,8 +440,7 @@ minetest.register_tool( max_drop_level=0, groupcaps={ fleshy={times={[2]=1.10, [3]=0.60}, uses=10, maxlevel=1}, - snappy={times={[2]=1.00, [3]=0.50}, uses=10, maxlevel=1}, - choppy={times=tool_levels.wood, uses=20, maxlevel=0} + snappy={times=tool_levels.wood.snappy, uses=10, maxlevel=1}, }, damage_groups = {fleshy = 4} } @@ -315,8 +456,7 @@ minetest.register_tool( max_drop_level=0, groupcaps={ fleshy={times={[2]=0.80, [3]=0.40}, uses=20, maxlevel=1}, - snappy={times={[2]=0.80, [3]=0.40}, uses=20, maxlevel=1}, - choppy={times=tool_levels.stone, uses=20, maxlevel=0} + snappy={times=tool_levels.stone.snappy, uses=20, maxlevel=1}, }, damage_groups = {fleshy = 5} } @@ -332,8 +472,7 @@ minetest.register_tool( max_drop_level=1, groupcaps={ fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=10, maxlevel=2}, - snappy={times={[2]=0.70, [3]=0.30}, uses=40, maxlevel=1}, - choppy={times=tool_levels.steel, uses=40, maxlevel=0} + snappy={times=tool_levels.steel.snappy, uses=40, maxlevel=1}, }, damage_groups = {fleshy = 6} } @@ -349,14 +488,14 @@ minetest.register_tool( max_drop_level=1, groupcaps={ fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=25, maxlevel=2}, - snappy={times={[2]=0.70, [3]=0.30}, uses=55, maxlevel=1}, - choppy={times=tool_levels.steel, uses=55, maxlevel=0} + snappy={times=tool_levels.carbonsteel.snappy, uses=55, maxlevel=1}, }, damage_groups = {fleshy = 10} } }) -- Broadsword + minetest.register_tool( "default:broadsword", { @@ -371,6 +510,7 @@ minetest.register_tool( }) -- Other + minetest.register_tool( "default:shears", { diff --git a/mods/mobs/api.lua b/mods/mobs/api.lua index 807db0d..113c48f 100644 --- a/mods/mobs/api.lua +++ b/mods/mobs/api.lua @@ -96,7 +96,7 @@ function mobs:register_mob(name, def) on_spawn = def.on_spawn or nil, check_fed = function(self, name, feed_count, breed) -- check if a mob is fed self.food = (self.food or 0) + 1 - + -- make children grow quicker if self.child == true then self.hornytimer = self.hornytimer + 20 @@ -173,9 +173,9 @@ function mobs:register_mob(name, def) local d = { x = vx / ds, z = vz / ds } local p = { x = pos.x / ps, z = pos.z / ps } local an = ( d.x * p.x ) + ( d.z * p.z ) - + a = math.deg( math.acos( an ) ) - + if a > ( self.fov / 2 ) then return false else @@ -308,7 +308,7 @@ function mobs:register_mob(name, def) y = self.fall_speed, z = 0 }) - + -- fall damage if self.fall_damage == 1 and self.object:getvelocity().y == 0 then @@ -322,7 +322,7 @@ function mobs:register_mob(name, def) end end end - + -- knockback timer if self.pause_timer > 0 then self.pause_timer = self.pause_timer - dtime @@ -331,7 +331,7 @@ function mobs:register_mob(name, def) end return end - + -- attack timer self.timer = self.timer + dtime if self.state ~= "attack" then @@ -350,7 +350,7 @@ function mobs:register_mob(name, def) max_hear_distance = self.sounds.distance }) end - + local do_env_damage = function(self) local pos = self.object:getpos() @@ -390,7 +390,7 @@ function mobs:register_mob(name, def) end end - + local do_jump = function(self) if self.fly then return @@ -417,14 +417,15 @@ function mobs:register_mob(name, def) }) --print ("in front:", nod.name, pos.y) if nod and nod.name and - (nod.name ~= "air" + (nod.name ~= "air" or self.walk_chance == 0) then local def = minetest.registered_items[nod.name] if (def and def.walkable and not nod.name:find("fence")) or self.walk_chance == 0 then - local v = self.object:getvelocity() + local v = self.object:getvelocity() + print(dump(v)) v.y = self.jump_height + 1 v.x = v.x * 2.2 v.z = v.z * 2.2 @@ -444,7 +445,7 @@ function mobs:register_mob(name, def) self.jumptimer = 0 end end - + -- environmental damage timer self.env_damage_timer = self.env_damage_timer + dtime if self.state == "attack" @@ -454,7 +455,7 @@ function mobs:register_mob(name, def) elseif self.state ~= "attack" then do_env_damage(self) end - + -- find someone to attack if self.type == "monster" and damage_enabled @@ -480,7 +481,7 @@ function mobs:register_mob(name, def) type = obj.type end end - + if type == "player" or type == "npc" then s = self.object:getpos() @@ -505,7 +506,7 @@ function mobs:register_mob(name, def) self.do_attack(self, min_player, min_dist) end end - + -- npc, find closest monster to attack local min_dist = self.view_range + 1 local min_player = nil @@ -728,7 +729,7 @@ function mobs:register_mob(name, def) if self.type == "npc" then local o = minetest.get_objects_inside_radius(self.object:getpos(), 3) - + local yaw = 0 for _,o in ipairs(o) do if o:is_player() then @@ -744,7 +745,7 @@ function mobs:register_mob(name, def) if lp.x > s.x then yaw = yaw + math.pi end - else + else yaw = self.object:getyaw() + ((math.random(0, 360) - 180) / 180 * math.pi) end self.object:setyaw(yaw) @@ -817,7 +818,7 @@ function mobs:register_mob(name, def) end -- exploding mobs - elseif self.state == "attack" and self.attack_type == "explode" then + elseif self.state == "attack" and self.attack_type == "explode" then if not self.attack.player or not self.attack.player:is_player() then self.state = "stand" @@ -842,7 +843,7 @@ function mobs:register_mob(name, def) self:set_animation("walk") self.attack.dist = dist end - + local vec = {x = p.x - s.x, y = p.y - s.y, z = p.z - s.z} yaw = math.atan(vec.z / vec.x) + math.pi / 2 - self.rotate if p.x > s.x then @@ -966,7 +967,7 @@ function mobs:register_mob(name, def) else self.attack.dist = dist end - + local vec = {x = p.x - s.x, y = p.y - s.y, z = p.z - s.z} yaw = (math.atan(vec.z / vec.x) + math.pi / 2) - self.rotate if p.x > s.x then @@ -1039,7 +1040,7 @@ function mobs:register_mob(name, def) else self.attack.dist = dist end - + local vec = {x = p.x - s.x, y = p.y - s.y, z = p.z - s.z} yaw = (math.atan(vec.z / vec.x) + math.pi / 2) - self.rotate if p.x > s.x then @@ -1047,7 +1048,7 @@ function mobs:register_mob(name, def) end self.object:setyaw(yaw) self.set_velocity(self, 0) - + if self.shoot_interval and self.timer > self.shoot_interval and math.random(1, 100) <= 60 then self.timer = 0 diff --git a/mods/mobs/sheep.lua b/mods/mobs/sheep.lua index 4b7d6ca..7f30438 100644 --- a/mods/mobs/sheep.lua +++ b/mods/mobs/sheep.lua @@ -110,4 +110,4 @@ mobs:register_mob( }) mobs:register_egg("mobs:sheep", "Sheep", "mobs_sheep_inventory.png") -mobs:register_spawn("mobs:sheep", {"default:dirt_with_grass"}, 20, 10, 15000, 1, 31000) \ No newline at end of file +mobs:register_spawn("mobs:sheep", {"default:dirt_with_grass"}, 20, 10, 15000, 1, 31000)