diff --git a/aliases.lua b/aliases.lua index 2b7e3bb..1dfa27c 100644 --- a/aliases.lua +++ b/aliases.lua @@ -1,19 +1,18 @@ - local Ombrellone_n_list = { - { "Red Ombrellone_n", "red"}, - { "Orange Ombrellone_n", "orange"}, - { "Black Ombrellone_n", "black"}, - { "Yellow Ombrellone_n", "yellow"}, - { "Green Ombrellone_n", "green"}, - { "Blue Ombrellone_n", "blue"}, - { "Violet Ombrellone_n", "violet"}, - { "White Ombrellone_n", "white"}, + { "Red Ombrellone_n", "red" }, + { "Orange Ombrellone_n", "orange" }, + { "Black Ombrellone_n", "black" }, + { "Yellow Ombrellone_n", "yellow" }, + { "Green Ombrellone_n", "green" }, + { "Blue Ombrellone_n", "blue" }, + { "Violet Ombrellone_n", "violet" }, + { "White Ombrellone_n", "white" }, } for i in ipairs(Ombrellone_n_list) do local Ombrellone_ndesc = Ombrellone_n_list[i][1] local colour = Ombrellone_n_list[i][2] - -minetest.register_alias_force("summer:Ombrellone_n_"..colour.."", "summer:ombrellone_n_"..colour.."") -minetest.register_alias_force("summer:Ombrellone_n_"..colour.."_ch", "summer:ombrellone_n_"..colour.."_ch") + + minetest.register_alias_force("summer:Ombrellone_n_" .. colour .. "", "summer:ombrellone_n_" .. colour .. "") + minetest.register_alias_force("summer:Ombrellone_n_" .. colour .. "_ch", "summer:ombrellone_n_" .. colour .. "_ch") end diff --git a/asciugamano.lua b/asciugamano.lua index 305428a..2afcb05 100644 --- a/asciugamano.lua +++ b/asciugamano.lua @@ -1,214 +1,199 @@ - - - - local Asciugamano_list = { - { "Red Asciugamano", "red"}, - { "Orange Asciugamano", "orange"}, - { "Black Asciugamano", "black"}, - { "Yellow Asciugamano", "yellow"}, - { "Green Asciugamano", "green"}, - { "Blue Asciugamano", "blue"}, - { "Violet Asciugamano", "violet"}, +local Asciugamano_list = { + { "Red Asciugamano", "red" }, + { "Orange Asciugamano", "orange" }, + { "Black Asciugamano", "black" }, + { "Yellow Asciugamano", "yellow" }, + { "Green Asciugamano", "green" }, + { "Blue Asciugamano", "blue" }, + { "Violet Asciugamano", "violet" }, } for i in ipairs(Asciugamano_list) do local asciugamanodesc = Asciugamano_list[i][1] local colour = Asciugamano_list[i][2] - + minetest.register_node("summer:asciugamano_" .. colour .. "", { + description = asciugamanodesc .. "", + drawtype = "mesh", + mesh = "asciugamano.obj", + tiles = { "asciugsmano_" .. colour .. ".png", + }, + inventory_image = "asciugsmano_a_" .. colour .. ".png", - - minetest.register_node("summer:asciugamano_"..colour.."", { - description = asciugamanodesc.."", - drawtype = "mesh", - mesh = "asciugamano.obj", - tiles = {"asciugsmano_"..colour..".png", - }, - inventory_image = "asciugsmano_a_"..colour..".png", - - wield_image = "asciugsmano_a_"..colour..".png", - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - walkable = false, - selection_box = { - type = "fixed", - fixed = { -1.0, -0.5,-0.5, 1.0,-0.49, 0.5 }, - }, - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=0}, + wield_image = "asciugsmano_a_" .. colour .. ".png", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = { -1.0, -0.5, -0.5, 1.0, -0.49, 0.5 }, + }, + groups = { snappy = 2, cracky = 3, oddly_breakable_by_hand = 3, not_in_creative_inventory = 0 }, --sounds = default.node_sound_wood_defaults(), - drop = "summer:asciugamano_"..colour.."", - on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - return minetest.sleep_in_asciugamano( pos, node, clicker, itemstack, pointed_thing ); - end - - - }) - + drop = "summer:asciugamano_" .. colour .. "", + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + return minetest.sleep_in_asciugamano(pos, node, clicker, itemstack, pointed_thing); + end + }) -minetest.allow_sit = function( player ) - -- no check possible - if( not( player.get_player_velocity )) then - return true; - end - local velo = player:get_player_velocity(); - if( not( velo )) then + minetest.allow_sit = function(player) + -- no check possible + if (not (player.get_player_velocity)) then + return true; + end + local velo = player:get_player_velocity(); + if (not (velo)) then + return false; + end + local max_velo = 0.0010; + if (math.abs(velo.x) < max_velo + and math.abs(velo.y) < max_velo + and math.abs(velo.z) < max_velo) then + return true; + end return false; end - local max_velo = 0.0010; - if( math.abs(velo.x) < max_velo - and math.abs(velo.y) < max_velo - and math.abs(velo.z) < max_velo ) then - return true; - end - return false; -end - - -minetest.sleep_in_asciugamano = function( pos, node, clicker, itemstack, pointed_thing ) - if( not( clicker ) or not( node ) or not( node.name ) or not( pos ) or not( minetest.allow_sit( clicker))) then - return; - end - - local animation = default.player_get_animation( clicker ); - local pname = clicker:get_player_name(); - - local place_name = 'place'; - -- if only one node is present, the player can only sit; - -- sleeping requires a asciugamano head+foot or two sleeping mats - local allow_sleep = false; - local new_animation = 'lay'; - - -- let players get back up - if( animation and animation.animation=="lay" ) then - default.player_attached[pname] = false - clicker:setpos({x=pos.x,y=pos.y-0.5,z=pos.z}) - clicker:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0}) - clicker:set_physics_override({1, 1, 1}) - default.player_set_animation(clicker, "stand", 30) - minetest.chat_send_player( pname, 'That was enough sleep for now. You stand up again.'); - return; - end - - local second_node_pos = {x=pos.x, y=pos.y, z=pos.z}; - -- the node that will contain the head of the player - local p = {x=pos.x, y=pos.y, z=pos.z}; - -- the player's head is pointing in this direction - local dir = node.param2; - -- it would be odd to sleep in half a asciugamano - if( node.name=="summer:asciugamano_"..colour.."" ) then - if( node.param2==0 ) then - second_node_pos.z = pos.z-1; - elseif( node.param2==1) then - second_node_pos.x = pos.x-1; - elseif( node.param2==2) then - second_node_pos.z = pos.z+1; - elseif( node.param2==3) then - second_node_pos.x = pos.x+1; + minetest.sleep_in_asciugamano = function(pos, node, clicker, itemstack, pointed_thing) + if (not (clicker) or not (node) or not (node.name) or not (pos) or not (minetest.allow_sit(clicker))) then + return; end - local node2 = minetest.get_node( second_node_pos ); - if( not( node2 ) or not( node2.param2 ) or not( node.param2 ) - or node2.name ~= "summer:asciugamano_"..colour.."" - or node2.param2 ~= node.param2 ) then - allow_sleep = false; - else - allow_sleep = true; - end - place_name = "asciugamano_"..colour..""; - -- if the player clicked on the foot of the asciugamano, locate the head - elseif( node.name=='summer:asciugamano' ) then - if( node.param2==2 ) then - second_node_pos.z = pos.z-1; - elseif( node.param2==3) then - second_node_pos.x = pos.x-1; - elseif( node.param2==0) then - second_node_pos.z = pos.z+1; - elseif( node.param2==1) then - second_node_pos.x = pos.x+1; - end - local node2 = minetest.get_node( second_node_pos ); - if( not( node2 ) or not( node2.param2 ) or not( node.param2 ) - or node2.name ~= 'summer:asciugamano' - or node2.param2 ~= node.param2 ) then - allow_sleep = false; - else - allow_sleep = true; - end - if( allow_sleep==true ) then - p = {x=second_node_pos.x, y=second_node_pos.y, z=second_node_pos.z}; - end - place_name = 'asciugamano'; + local animation = default.player_get_animation(clicker); + local pname = clicker:get_player_name(); - elseif( node.name=='summer:sleeping_mat' or node.name=='summer:straw_mat') then - place_name = 'mat'; - dir = node.param2; - allow_sleep = false; - -- search for a second mat right next to this one - local offset = {{x=0,z=-1}, {x=-1,z=0}, {x=0,z=1}, {x=1,z=0}}; - for i,off in ipairs( offset ) do - node2 = minetest.get_node( {x=pos.x+off.x, y=pos.y, z=pos.z+off.z} ); - if( node2.name == 'summer:sleeping_mat' or node2.name=='summer:straw_mat' ) then - -- if a second mat is found, sleeping is possible + local place_name = 'place'; + -- if only one node is present, the player can only sit; + -- sleeping requires a asciugamano head+foot or two sleeping mats + local allow_sleep = false; + local new_animation = 'lay'; + + -- let players get back up + if (animation and animation.animation == "lay") then + default.player_attached[pname] = false + clicker:setpos({ x = pos.x, y = pos.y - 0.5, z = pos.z }) + clicker:set_eye_offset({ x = 0, y = 0, z = 0 }, { x = 0, y = 0, z = 0 }) + clicker:set_physics_override({ 1, 1, 1 }) + default.player_set_animation(clicker, "stand", 30) + minetest.chat_send_player(pname, 'That was enough sleep for now. You stand up again.'); + return; + end + + local second_node_pos = { x = pos.x, y = pos.y, z = pos.z }; + -- the node that will contain the head of the player + local p = { x = pos.x, y = pos.y, z = pos.z }; + -- the player's head is pointing in this direction + local dir = node.param2; + -- it would be odd to sleep in half a asciugamano + if (node.name == "summer:asciugamano_" .. colour .. "") then + if (node.param2 == 0) then + second_node_pos.z = pos.z - 1; + elseif (node.param2 == 1) then + second_node_pos.x = pos.x - 1; + elseif (node.param2 == 2) then + second_node_pos.z = pos.z + 1; + elseif (node.param2 == 3) then + second_node_pos.x = pos.x + 1; + end + local node2 = minetest.get_node(second_node_pos); + if (not (node2) or not (node2.param2) or not (node.param2) + or node2.name ~= "summer:asciugamano_" .. colour .. "" + or node2.param2 ~= node.param2) then + allow_sleep = false; + else allow_sleep = true; - dir = i-1; + end + place_name = "asciugamano_" .. colour .. ""; + + -- if the player clicked on the foot of the asciugamano, locate the head + elseif (node.name == 'summer:asciugamano') then + if (node.param2 == 2) then + second_node_pos.z = pos.z - 1; + elseif (node.param2 == 3) then + second_node_pos.x = pos.x - 1; + elseif (node.param2 == 0) then + second_node_pos.z = pos.z + 1; + elseif (node.param2 == 1) then + second_node_pos.x = pos.x + 1; + end + local node2 = minetest.get_node(second_node_pos); + if (not (node2) or not (node2.param2) or not (node.param2) + or node2.name ~= 'summer:asciugamano' + or node2.param2 ~= node.param2) then + allow_sleep = false; + else + allow_sleep = true; + end + if (allow_sleep == true) then + p = { x = second_node_pos.x, y = second_node_pos.y, z = second_node_pos.z }; + end + place_name = 'asciugamano'; + elseif (node.name == 'summer:sleeping_mat' or node.name == 'summer:straw_mat') then + place_name = 'mat'; + dir = node.param2; + allow_sleep = false; + -- search for a second mat right next to this one + local offset = { { x = 0, z = -1 }, { x = -1, z = 0 }, { x = 0, z = 1 }, { x = 1, z = 0 } }; + for i, off in ipairs(offset) do + node2 = minetest.get_node({ x = pos.x + off.x, y = pos.y, z = pos.z + off.z }); + if (node2.name == 'summer:sleeping_mat' or node2.name == 'summer:straw_mat') then + -- if a second mat is found, sleeping is possible + allow_sleep = true; + dir = i - 1; + end end end - end - -- set the right height for the asciugamano - if( place_name=='asciugamano' ) then - p.y = p.y-0.4; - end - if( allow_sleep==true ) then - -- set the right position (middle of the asciugamano) - if( dir==0 ) then - p.z = p.z-0.5; - elseif( dir==1 ) then - p.x = p.x-0.5; - elseif( dir==2 ) then - p.z = p.z+0.5; - elseif( dir==3 ) then - p.x = p.x+0.5; + -- set the right height for the asciugamano + if (place_name == 'asciugamano') then + p.y = p.y - 0.4; end - end - - if( default.player_attached[pname] and animation.animation=="sit") then - -- just changing the animation... - if( allow_sleep==true ) then - default.player_set_animation(clicker, "lay", 30) - clicker:set_eye_offset({x=0,y=-14,z=2}, {x=0,y=0,z=0}) - minetest.chat_send_player( pname, 'You lie down and take a nap. A right-click will wake you up.'); - return; - -- no sleeping on this place + if (allow_sleep == true) then + -- set the right position (middle of the asciugamano) + if (dir == 0) then + p.z = p.z - 0.5; + elseif (dir == 1) then + p.x = p.x - 0.5; + elseif (dir == 2) then + p.z = p.z + 0.5; + elseif (dir == 3) then + p.x = p.x + 0.5; + end + end + + if (default.player_attached[pname] and animation.animation == "sit") then + -- just changing the animation... + if (allow_sleep == true) then + default.player_set_animation(clicker, "lay", 30) + clicker:set_eye_offset({ x = 0, y = -14, z = 2 }, { x = 0, y = 0, z = 0 }) + minetest.chat_send_player(pname, 'You lie down and take a nap. A right-click will wake you up.'); + return; + -- no sleeping on this place + else + default.player_attached[pname] = false + clicker:setpos({ x = pos.x, y = pos.y - 0.5, z = pos.z }) + clicker:set_eye_offset({ x = 0, y = 0, z = 0 }, { x = 0, y = 0, z = 0 }) + clicker:set_physics_override({ 1, 1, 1 }) + default.player_set_animation(clicker, "stand", 30) + minetest.chat_send_player(pname, 'That was enough sitting around for now. You stand up again.'); + return; + end + end + + clicker:set_eye_offset({ x = 0, y = -7, z = 2 }, { x = 0, y = 0, z = 0 }) + clicker:setpos(p); + default.player_set_animation(clicker, new_animation, 30) + clicker:set_physics_override({ 0, 0, 0 }) + default.player_attached[pname] = true + + if (allow_sleep == true) then + minetest.chat_send_player(pname, + 'Aaah! What a comftable ' .. place_name .. '. A second right-click will let you sleep.'); else - default.player_attached[pname] = false - clicker:setpos({x=pos.x,y=pos.y-0.5,z=pos.z}) - clicker:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0}) - clicker:set_physics_override({1, 1, 1}) - default.player_set_animation(clicker, "stand", 30) - minetest.chat_send_player( pname, 'That was enough sitting around for now. You stand up again.'); - return; + minetest.chat_send_player(pname, + 'Comftable, but not good enough for a nap. Right-click again if you want to get back up.'); end end - - - clicker:set_eye_offset({x=0,y=-7,z=2}, {x=0,y=0,z=0}) - clicker:setpos( p ); - default.player_set_animation(clicker, new_animation, 30) - clicker:set_physics_override({0, 0, 0}) - default.player_attached[pname] = true - - if( allow_sleep==true) then - minetest.chat_send_player( pname, 'Aaah! What a comftable '..place_name..'. A second right-click will let you sleep.'); - else - minetest.chat_send_player( pname, 'Comftable, but not good enough for a nap. Right-click again if you want to get back up.'); - end end - - - -end - --state=true: lay, state=false: stand up - +--state=true: lay, state=false: stand up diff --git a/barche.lua b/barche.lua index 1ae0bd5..500f302 100644 --- a/barche.lua +++ b/barche.lua @@ -15,8 +15,8 @@ end local function get_velocity(v, yaw, y) local x = -math.sin(yaw) * v - local z = math.cos(yaw) * v - return {x = x, y = y, z = z} + local z = math.cos(yaw) * v + return { x = x, y = y, z = z } end @@ -24,244 +24,236 @@ local function get_v(v) return math.sqrt(v.x ^ 2 + v.z ^ 2) end local function reg_barca(color) + local barca_item_name = "summer:barca_" .. color .. "_item" + local barca_ent_name = "summer:barca_" .. color .. "_entity" - local barca_item_name = "summer:barca_"..color.."_item" - local barca_ent_name = "summer:barca_"..color.."_entity" + -- + -- Boat entity + -- --- --- Boat entity --- + local barca = { + physical = true, + collisionbox = { -2.5, -0.5, -2.5, 2.5, 0.3, 2.5 }, + visual = "mesh", + mesh = "barca.x", --"barcal.obj", + textures = { "barca_" .. color .. ".png" }, -local barca = { - physical = true, - collisionbox = {-2.5, -0.5, -2.5, 2.5, 0.3, 2.5}, - visual = "mesh", - mesh = "barca.x",--"barcal.obj", - textures = {"barca_"..color..".png" }, - - driver = nil, - v = 0, - last_v = 0, - removed = false -} + driver = nil, + v = 0, + last_v = 0, + removed = false + } -function barca.on_rightclick(self, clicker) - if not clicker or not clicker:is_player() then - return - end - local name = clicker:get_player_name() - if self.driver and clicker == self.driver then - self.driver = nil - clicker:set_detach() - default.player_attached[name] = false - default.player_set_animation(clicker, "stand" , 30) - local pos = clicker:getpos() - pos = {x = pos.x, y = pos.y + 0.2, z = pos.z} - minetest.after(0.1, function() - clicker:setpos(pos) - end) - elseif not self.driver then - local attach = clicker:get_attach() - if attach and attach:get_luaentity() then - local luaentity = attach:get_luaentity() - if luaentity.driver then - luaentity.driver = nil - end + function barca.on_rightclick(self, clicker) + if not clicker or not clicker:is_player() then + return + end + local name = clicker:get_player_name() + if self.driver and clicker == self.driver then + self.driver = nil clicker:set_detach() + default.player_attached[name] = false + default.player_set_animation(clicker, "stand", 30) + local pos = clicker:getpos() + pos = { x = pos.x, y = pos.y + 0.2, z = pos.z } + minetest.after(0.1, function() + clicker:setpos(pos) + end) + elseif not self.driver then + local attach = clicker:get_attach() + if attach and attach:get_luaentity() then + local luaentity = attach:get_luaentity() + if luaentity.driver then + luaentity.driver = nil + end + clicker:set_detach() + end + self.driver = clicker + clicker:set_attach(self.object, "", + { x = 0, y = 11, z = -3 }, { x = 0, y = 0, z = 0 }) + default.player_attached[name] = true + minetest.after(0.2, function() + default.player_set_animation(clicker, "sit", 30) + end) + self.object:setyaw(clicker:get_look_yaw() - math.pi / 2) end - self.driver = clicker - clicker:set_attach(self.object, "", - {x = 0, y = 11, z = -3}, {x = 0, y = 0, z = 0}) - default.player_attached[name] = true - minetest.after(0.2, function() - default.player_set_animation(clicker, "sit" , 30) - end) - self.object:setyaw(clicker:get_look_yaw() - math.pi / 2) end -end - -function barca.on_activate(self, staticdata, dtime_s) - self.object:set_armor_groups({immortal = 1}) - if staticdata then - self.v = tonumber(staticdata) + function barca.on_activate(self, staticdata, dtime_s) + self.object:set_armor_groups({ immortal = 1 }) + if staticdata then + self.v = tonumber(staticdata) + end + self.last_v = self.v end - self.last_v = self.v -end - -function barca.get_staticdata(self) - return tostring(self.v) -end - - -function barca.on_punch(self, puncher) - if not puncher or not puncher:is_player() or self.removed then - return + function barca.get_staticdata(self) + return tostring(self.v) end - if self.driver and puncher == self.driver then - self.driver = nil - puncher:set_detach() - default.player_attached[puncher:get_player_name()] = false - end - if not self.driver then - self.removed = true - -- delay remove to ensure player is detached - minetest.after(0.1, function() - self.object:remove() - end) - if not minetest.setting_getbool("creative_mode") then - local inv = puncher:get_inventory() - if inv:room_for_item("main", "summer:barca_"..color.."_item") then - inv:add_item("main", "summer:barca_"..color.."_item") - else - minetest.add_item(self.object:getpos(), barca_item_name) + + function barca.on_punch(self, puncher) + if not puncher or not puncher:is_player() or self.removed then + return + end + if self.driver and puncher == self.driver then + self.driver = nil + puncher:set_detach() + default.player_attached[puncher:get_player_name()] = false + end + if not self.driver then + self.removed = true + -- delay remove to ensure player is detached + minetest.after(0.1, function() + self.object:remove() + end) + if not minetest.setting_getbool("creative_mode") then + local inv = puncher:get_inventory() + if inv:room_for_item("main", "summer:barca_" .. color .. "_item") then + inv:add_item("main", "summer:barca_" .. color .. "_item") + else + minetest.add_item(self.object:getpos(), barca_item_name) + end end end end -end - -function barca.on_step(self, dtime) - self.v = get_v(self.object:getvelocity()) * get_sign(self.v) - if self.driver then - local ctrl = self.driver:get_player_control() - local yaw = self.object:getyaw() - if ctrl.up then - self.v = self.v + 0.1 - elseif ctrl.down then - self.v = self.v - 0.1 - end - if ctrl.left then - if self.v < 0 then - self.object:setyaw(yaw - (1 + dtime) * 0.03) - else - self.object:setyaw(yaw + (1 + dtime) * 0.03) + function barca.on_step(self, dtime) + self.v = get_v(self.object:getvelocity()) * get_sign(self.v) + if self.driver then + local ctrl = self.driver:get_player_control() + local yaw = self.object:getyaw() + if ctrl.up then + self.v = self.v + 0.1 + elseif ctrl.down then + self.v = self.v - 0.1 end - elseif ctrl.right then - if self.v < 0 then - self.object:setyaw(yaw + (1 + dtime) * 0.03) - else - self.object:setyaw(yaw - (1 + dtime) * 0.03) + if ctrl.left then + if self.v < 0 then + self.object:setyaw(yaw - (1 + dtime) * 0.03) + else + self.object:setyaw(yaw + (1 + dtime) * 0.03) + end + elseif ctrl.right then + if self.v < 0 then + self.object:setyaw(yaw + (1 + dtime) * 0.03) + else + self.object:setyaw(yaw - (1 + dtime) * 0.03) + end end end - end - local velo = self.object:getvelocity() - if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then - self.object:setpos(self.object:getpos()) - return - 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) > 5 then - self.v = 5 * get_sign(self.v) - end - - local p = self.object:getpos() - p.y = p.y - 0.5 - local new_velo = {x = 0, y = 0, z = 0} - local new_acce = {x = 0, y = 0, z = 0} - if not is_water(p) then - local nodedef = minetest.registered_nodes[minetest.get_node(p).name] - if (not nodedef) or nodedef.walkable then + local velo = self.object:getvelocity() + if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then + self.object:setpos(self.object:getpos()) + return + 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 - new_acce = {x = 0, y = 2, z = 0} - else - new_acce = {x = 0, y = -1.8, z = 0} + return end - new_velo = get_velocity(self.v, self.object:getyaw(), - self.object:getvelocity().y) - self.object:setpos(self.object:getpos()) - else - p.y = p.y + 1 - if is_water(p) then - local y = self.object:getvelocity().y - if y >= 7 then - y = 7 - elseif y < 0 then - new_acce = {x = 0, y = 50, z = 0} + if math.abs(self.v) > 5 then + self.v = 5 * get_sign(self.v) + end + + local p = self.object:getpos() + p.y = p.y - 0.5 + local new_velo = { x = 0, y = 0, z = 0 } + local new_acce = { x = 0, y = 0, z = 0 } + if not is_water(p) then + local nodedef = minetest.registered_nodes[minetest.get_node(p).name] + if (not nodedef) or nodedef.walkable then + self.v = 0 + new_acce = { x = 0, y = 2, z = 0 } else - new_acce = {x = 0, y = 7, z = 0} + new_acce = { x = 0, y = -1.8, z = 0 } end - new_velo = get_velocity(self.v, self.object:getyaw(), y) + new_velo = get_velocity(self.v, self.object:getyaw(), + self.object:getvelocity().y) self.object:setpos(self.object:getpos()) else - new_acce = {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) + 1. - self.object:setpos(pos) - new_velo = get_velocity(self.v, self.object:getyaw(), 0) - else - new_velo = get_velocity(self.v, self.object:getyaw(), - self.object:getvelocity().y) + p.y = p.y + 1 + if is_water(p) then + local y = self.object:getvelocity().y + if y >= 7 then + y = 7 + elseif y < 0 then + new_acce = { x = 0, y = 50, z = 0 } + else + new_acce = { x = 0, y = 7, z = 0 } + end + new_velo = get_velocity(self.v, self.object:getyaw(), y) self.object:setpos(self.object:getpos()) + else + new_acce = { 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) + 1. + self.object:setpos(pos) + new_velo = get_velocity(self.v, self.object:getyaw(), 0) + else + new_velo = get_velocity(self.v, self.object:getyaw(), + self.object:getvelocity().y) + self.object:setpos(self.object:getpos()) + end end end + self.object:setvelocity(new_velo) + self.object:setacceleration(new_acce) end - self.object:setvelocity(new_velo) - self.object:setacceleration(new_acce) -end + + minetest.register_entity("summer:barca_" .. color .. "", barca) -minetest.register_entity("summer:barca_"..color.."", barca) + minetest.register_craftitem(barca_item_name, { + description = "Barca (" .. color .. ")", + inventory_image = "barca_" .. color .. "_inv.png", + wield_image = "barca_" .. color .. "_inv.png", + wield_scale = { x = 2, y = 2, z = 1 }, + liquids_pointable = true, + + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" then + return + end + if not is_water(pointed_thing.under) then + return + end + pointed_thing.under.y = pointed_thing.under.y + 0.5 + minetest.add_entity(pointed_thing.under, "summer:barca_" .. color .. "") + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + return itemstack + end, + }) -minetest.register_craftitem(barca_item_name, { - description = "Barca ("..color..")", - inventory_image = "barca_"..color.."_inv.png", - wield_image = "barca_"..color.."_inv.png", - wield_scale = {x = 2, y = 2, z = 1}, - liquids_pointable = true, - - on_place = function(itemstack, placer, pointed_thing) - if pointed_thing.type ~= "node" then - return - end - if not is_water(pointed_thing.under) then - return - end - pointed_thing.under.y = pointed_thing.under.y + 0.5 - minetest.add_entity(pointed_thing.under, "summer:barca_"..color.."") - if not minetest.setting_getbool("creative_mode") then - itemstack:take_item() - end - return itemstack - end, -}) - - -if minetest.get_modpath("cannabis") then -minetest.register_craft({ - output = barca_item_name, - recipe = { - {"" , "" , "" }, - {"cannabis:canapa_plastic", "wool:"..color, "cannabis:canapa_plastic"}, - {"cannabis:canapa_plastic", "cannabis:canapa_plastic", "cannabis:canapa_plastic"}, - }, -}) -end -minetest.register_craft({ - output = barca_item_name, - recipe = { - {"" , "" , "" }, - {"group:wood", "wool:"..color, "group:wood"}, - {"group:wood","group:wood","group:wood"}, - }, -}) + if minetest.get_modpath("cannabis") then + minetest.register_craft({ + output = barca_item_name, + recipe = { + { "", "", "" }, + { "cannabis:canapa_plastic", "wool:" .. color, "cannabis:canapa_plastic" }, + { "cannabis:canapa_plastic", "cannabis:canapa_plastic", "cannabis:canapa_plastic" }, + }, + }) + end + minetest.register_craft({ + output = barca_item_name, + recipe = { + { "", "", "" }, + { "group:wood", "wool:" .. color, "group:wood" }, + { "group:wood", "group:wood", "group:wood" }, + }, + }) end colors = { - "black", "red", "green", "blue", "yellow", "violet","orange", + "black", "red", "green", "blue", "yellow", "violet", "orange", } -for _,color in ipairs(colors) do +for _, color in ipairs(colors) do reg_barca(color) end - - diff --git a/breccia.lua b/breccia.lua index 430bdd9..b8b672b 100644 --- a/breccia.lua +++ b/breccia.lua @@ -1,46 +1,45 @@ --BRECCIA minetest.register_node("summer:breccia", { description = "Breccia", - tiles = {"breccia.png"}, - groups = {crumbly = 2, falling_node = 1}, - --groups = {cracky = 3, stone = 1}, + tiles = { "breccia.png" }, + groups = { crumbly = 2, falling_node = 1 }, + --groups = {cracky = 3, stone = 1}, drop = '"summer:pietra" 9', --legacy_mineral = true, is_ground_content = false, -- - sounds = default.node_sound_gravel_defaults(), + sounds = default.node_sound_gravel_defaults(), --sounds = default.node_sound_stone_defaults(), }) minetest.register_node("summer:breccia_2", { description = "BrecciaB ", - tiles = {"breccia2.png"}, - groups = {crumbly = 2, falling_node = 1}, - --groups = {cracky = 3, stone = 1}, + tiles = { "breccia2.png" }, + groups = { crumbly = 2, falling_node = 1 }, + --groups = {cracky = 3, stone = 1}, drop = '"summer:pietraA" 9', --legacy_mineral = true, - sounds = default.node_sound_gravel_defaults(), + sounds = default.node_sound_gravel_defaults(), --sounds = default.node_sound_stone_defaults(), }) - minetest.register_node("summer:desert_breccia_2", { + +minetest.register_node("summer:desert_breccia_2", { description = "Red Breccia", - tiles = {"desert_breccia2.png"}, - groups = {crumbly = 2, falling_node = 1}, - --groups = {cracky = 3, stone = 1}, + tiles = { "desert_breccia2.png" }, + groups = { crumbly = 2, falling_node = 1 }, + --groups = {cracky = 3, stone = 1}, drop = '"summer:desert_pietra" 9', --legacy_mineral = true, - sounds = default.node_sound_gravel_defaults(), + sounds = default.node_sound_gravel_defaults(), --sounds = default.node_sound_stone_defaults(), -}) +}) + minetest.register_node("summer:desert_breccia", { description = "Desert Breccia", - tiles = {"desert_breccia.png"}, - groups = {crumbly = 2, falling_node = 1}, - --groups = {cracky = 3, stone = 1}, + tiles = { "desert_breccia.png" }, + groups = { crumbly = 2, falling_node = 1 }, + --groups = {cracky = 3, stone = 1}, drop = '"summer:pietraP" 9', --legacy_mineral = true, - sounds = default.node_sound_gravel_defaults(), + sounds = default.node_sound_gravel_defaults(), --sounds = default.node_sound_stone_defaults(), -}) - - - +}) diff --git a/canapa.lua b/canapa.lua index d9fe25b..e054b7a 100644 --- a/canapa.lua +++ b/canapa.lua @@ -1,123 +1,121 @@ -if minetest.get_modpath("wool") and minetest.get_modpath("dye")then -local lchest_list = { - { "Red chest", "red"}, - { "Orange chest", "orange"}, - { "Black ", "black"}, - { "Yellow chest", "yellow"}, - { "Green chest", "green"}, - { "Blue chest", "blue"}, - { "Violet chest", "violet"}, - {"white chest", "white"} -} +if minetest.get_modpath("wool") and minetest.get_modpath("dye") then + local lchest_list = { + { "Red chest", "red" }, + { "Orange chest", "orange" }, + { "Black ", "black" }, + { "Yellow chest", "yellow" }, + { "Green chest", "green" }, + { "Blue chest", "blue" }, + { "Violet chest", "violet" }, + { "white chest", "white" } + } -for i in ipairs(lchest_list) do - local desc = lchest_list[i][1] - local colour = lchest_list[i][2] + for i in ipairs(lchest_list) do + local desc = lchest_list[i][1] + local colour = lchest_list[i][2] ---sdraia -minetest.register_craft({ - output = "summer:sdraia_"..colour.."", - recipe = { - {"", "wool:"..colour, "", }, - {"cannabis:canapa_fiber", "cannabis:canapa_plastic", "cannabis:canapa_fiber", }, - {"", "cannabis:canapa_fiber", "", } - } - }) - ---portacenere - + --sdraia minetest.register_craft({ - output = "summer:Portacenere_"..colour.."", - recipe = { - {"cannabis:canapa_fiber", "", "cannabis:canapa_fiber" }, - {"cannabis:canapa_plastic", "", "cannabis:canapa_plastic" }, - {"cannabis:canapa_plastic", "wool:"..colour, "cannabis:canapa_plastic" } - } - }) ---occhiali -minetest.register_craft({ - output = "summer:occhiali_"..colour.."", - recipe = { - {"", "wool:"..colour, "", }, - {"", "cannabis:canapa_fiber", "", }, - {"cannabis:canapa_plastic", "", "cannabis:canapa_plastic", } - } - }) ---porta - minetest.register_craft({ - output = "summer:porta_"..colour.."_ch", - recipe = { - {"cannabis:canapa_fiber", "wool:"..colour, "", }, - {"wool:"..colour, "cannabis:canapa_fiber", "", }, - {"cannabis:canapa_fiber", "cannabis:canapa_fiber", "", } - } - }) + output = "summer:sdraia_" .. colour .. "", + recipe = { + { "", "wool:" .. colour, "", }, + { "cannabis:canapa_fiber", "cannabis:canapa_plastic", "cannabis:canapa_fiber", }, + { "", "cannabis:canapa_fiber", "", } + } + }) ---________________________________________________________ + --portacenere ---asciugamano ---________________________________________________________ + minetest.register_craft({ + output = "summer:Portacenere_" .. colour .. "", + recipe = { + { "cannabis:canapa_fiber", "", "cannabis:canapa_fiber" }, + { "cannabis:canapa_plastic", "", "cannabis:canapa_plastic" }, + { "cannabis:canapa_plastic", "wool:" .. colour, "cannabis:canapa_plastic" } + } + }) + --occhiali + minetest.register_craft({ + output = "summer:occhiali_" .. colour .. "", + recipe = { + { "", "wool:" .. colour, "", }, + { "", "cannabis:canapa_fiber", "", }, + { "cannabis:canapa_plastic", "", "cannabis:canapa_plastic", } + } + }) + --porta + minetest.register_craft({ + output = "summer:porta_" .. colour .. "_ch", + recipe = { + { "cannabis:canapa_fiber", "wool:" .. colour, "", }, + { "wool:" .. colour, "cannabis:canapa_fiber", "", }, + { "cannabis:canapa_fiber", "cannabis:canapa_fiber", "", } + } + }) -minetest.register_craft({ - output = "summer:asciugamano_"..colour.."", - recipe = { - {"","","", }, - {"wool:"..colour, "", "", }, - {"cannabis:canapa_fiber", "cannabis:canapa_fiber", "cannabis:canapa_fiber", } - } - }) - ---________________________________________________________ + --________________________________________________________ ---ombrellone ---________________________________________________________ - minetest.register_craft({ - output = "summer:ombrellone_"..colour.."", - recipe = { - {"", "wool:"..colour, "", }, - {"", "cannabis:canapa_plastic", "", }, - {"", "cannabis:canapa_fiber", "", } - } - }) - + --asciugamano + --________________________________________________________ + + minetest.register_craft({ + output = "summer:asciugamano_" .. colour .. "", + recipe = { + { "", "", "", }, + { "wool:" .. colour, "", "", }, + { "cannabis:canapa_fiber", "cannabis:canapa_fiber", "cannabis:canapa_fiber", } + } + }) + + --________________________________________________________ + + --ombrellone + --________________________________________________________ + minetest.register_craft({ + output = "summer:ombrellone_" .. colour .. "", + recipe = { + { "", "wool:" .. colour, "", }, + { "", "cannabis:canapa_plastic", "", }, + { "", "cannabis:canapa_fiber", "", } + } + }) - minetest.register_craft({ - output = "summer:ombrellone_n_"..colour.."", - recipe = { - {"cannabis:canapa_fiber", "wool:"..colour, "cannabis:canapa_fiber" }, - {"", "cannabis:canapa_plastic", "" }, - {"", "cannabis:canapa_plastic", "" } - } - }) - - - ---________________________________________________________ - ---chest ---________________________________________________________ -minetest.register_craft({ - output = "summer:chest"..colour.."", - recipe = { - {"cannabis:canapa_plastic","dye:"..colour.."","cannabis:canapa_plastic"}, - {"group:wood","","group:wood"}, - {"group:wood","group:wood","group:wood"} - - } - }) - - - minetest.register_craft({ - output = "summer:chest_lock"..colour.."", - recipe = { - {"summer:chest"..colour.."","cannabis:high_performance_ingot",""} - --{"","",""}, - --{"","",""} - - } - }) - + + minetest.register_craft({ + output = "summer:ombrellone_n_" .. colour .. "", + recipe = { + { "cannabis:canapa_fiber", "wool:" .. colour, "cannabis:canapa_fiber" }, + { "", "cannabis:canapa_plastic", "" }, + { "", "cannabis:canapa_plastic", "" } + } + }) + + + + --________________________________________________________ + + --chest + --________________________________________________________ + minetest.register_craft({ + output = "summer:chest" .. colour .. "", + recipe = { + { "cannabis:canapa_plastic", "dye:" .. colour .. "", "cannabis:canapa_plastic" }, + { "group:wood", "", "group:wood" }, + { "group:wood", "group:wood", "group:wood" } + + } + }) + + + minetest.register_craft({ + output = "summer:chest_lock" .. colour .. "", + recipe = { + { "summer:chest" .. colour .. "", "cannabis:high_performance_ingot", "" } + --{"","",""}, + --{"","",""} + + } + }) + end end -end - diff --git a/canoa.lua b/canoa.lua index 5fc3533..8206092 100644 --- a/canoa.lua +++ b/canoa.lua @@ -15,8 +15,8 @@ end local function get_velocity(v, yaw, y) local x = -math.sin(yaw) * v - local z = math.cos(yaw) * v - return {x = x, y = y, z = z} + local z = math.cos(yaw) * v + return { x = x, y = y, z = z } end @@ -24,248 +24,240 @@ local function get_v(v) return math.sqrt(v.x ^ 2 + v.z ^ 2) end local function reg_canoa_(color) + local canoa_item_name = "summer:canoa_" .. color .. "_item" + local canoa_ent_name = "summer:canoa_" .. color .. "_entity" - local canoa_item_name = "summer:canoa_"..color.."_item" - local canoa_ent_name = "summer:canoa_"..color.."_entity" + -- + -- Boat entity + -- --- --- Boat entity --- + local canoa_ = { + physical = true, + collisionbox = { -0.5, -0.35, -0.5, 0.5, 0.3, 0.5 }, + visual = "mesh", + mesh = "canoa.x", + textures = { "canoa_" .. color .. ".png" }, -local canoa_ = { - physical = true, - collisionbox = {-0.5, -0.35, -0.5, 0.5, 0.3, 0.5}, - visual = "mesh", - mesh = "canoa.x", - textures = {"canoa_"..color..".png" }, - - driver = nil, - v = 0, - last_v = 0, - removed = false -} + driver = nil, + v = 0, + last_v = 0, + removed = false + } -function canoa_.on_rightclick(self, clicker) - if not clicker or not clicker:is_player() then - return - end - local name = clicker:get_player_name() - if self.driver and clicker == self.driver then - self.driver = nil - clicker:set_detach() - default.player_attached[name] = false - default.player_set_animation(clicker, "stand" , 30) - local pos = clicker:getpos() - pos = {x = pos.x, y = pos.y + 0.2, z = pos.z} - minetest.after(0.1, function() - clicker:setpos(pos) - end) - elseif not self.driver then - local attach = clicker:get_attach() - if attach and attach:get_luaentity() then - local luaentity = attach:get_luaentity() - if luaentity.driver then - luaentity.driver = nil - end + function canoa_.on_rightclick(self, clicker) + if not clicker or not clicker:is_player() then + return + end + local name = clicker:get_player_name() + if self.driver and clicker == self.driver then + self.driver = nil clicker:set_detach() + default.player_attached[name] = false + default.player_set_animation(clicker, "stand", 30) + local pos = clicker:getpos() + pos = { x = pos.x, y = pos.y + 0.2, z = pos.z } + minetest.after(0.1, function() + clicker:setpos(pos) + end) + elseif not self.driver then + local attach = clicker:get_attach() + if attach and attach:get_luaentity() then + local luaentity = attach:get_luaentity() + if luaentity.driver then + luaentity.driver = nil + end + clicker:set_detach() + end + self.driver = clicker + clicker:set_attach(self.object, "", + { x = 0, y = 11, z = -3 }, { x = 0, y = 0, z = 0 }) + default.player_attached[name] = true + minetest.after(0.2, function() + default.player_set_animation(clicker, "sit", 30) + end) + self.object:setyaw(clicker:get_look_yaw() - math.pi / 2) end - self.driver = clicker - clicker:set_attach(self.object, "", - {x = 0, y = 11, z = -3}, {x = 0, y = 0, z = 0}) - default.player_attached[name] = true - minetest.after(0.2, function() - default.player_set_animation(clicker, "sit" , 30) - end) - self.object:setyaw(clicker:get_look_yaw() - math.pi / 2) end -end - -function canoa_.on_activate(self, staticdata, dtime_s) - self.object:set_armor_groups({immortal = 1}) - if staticdata then - self.v = tonumber(staticdata) + function canoa_.on_activate(self, staticdata, dtime_s) + self.object:set_armor_groups({ immortal = 1 }) + if staticdata then + self.v = tonumber(staticdata) + end + self.last_v = self.v end - self.last_v = self.v -end - -function canoa_.get_staticdata(self) - return tostring(self.v) -end - - -function canoa_.on_punch(self, puncher) - if not puncher or not puncher:is_player() or self.removed then - return + function canoa_.get_staticdata(self) + return tostring(self.v) end - if self.driver and puncher == self.driver then - self.driver = nil - puncher:set_detach() - default.player_attached[puncher:get_player_name()] = false - end - if not self.driver then - self.removed = true - -- delay remove to ensure player is detached - minetest.after(0.1, function() - self.object:remove() - end) - if not minetest.setting_getbool("creative_mode") then - local inv = puncher:get_inventory() - if inv:room_for_item("main", "summer:canoa_"..color.."_item") then - inv:add_item("main", "summer:canoa_"..color.."_item") - else - minetest.add_item(self.object:getpos(), canoa_item_name) + + function canoa_.on_punch(self, puncher) + if not puncher or not puncher:is_player() or self.removed then + return + end + if self.driver and puncher == self.driver then + self.driver = nil + puncher:set_detach() + default.player_attached[puncher:get_player_name()] = false + end + if not self.driver then + self.removed = true + -- delay remove to ensure player is detached + minetest.after(0.1, function() + self.object:remove() + end) + if not minetest.setting_getbool("creative_mode") then + local inv = puncher:get_inventory() + if inv:room_for_item("main", "summer:canoa_" .. color .. "_item") then + inv:add_item("main", "summer:canoa_" .. color .. "_item") + else + minetest.add_item(self.object:getpos(), canoa_item_name) + end end end end -end - -function canoa_.on_step(self, dtime) - self.v = get_v(self.object:getvelocity()) * get_sign(self.v) - if self.driver then - local ctrl = self.driver:get_player_control() - local yaw = self.object:getyaw() - if ctrl.up then - self.v = self.v + 0.1 - elseif ctrl.down then - self.v = self.v - 0.1 - end - if ctrl.left then - if self.v < 0 then - self.object:setyaw(yaw - (1 + dtime) * 0.03) - else - self.object:setyaw(yaw + (1 + dtime) * 0.03) + function canoa_.on_step(self, dtime) + self.v = get_v(self.object:getvelocity()) * get_sign(self.v) + if self.driver then + local ctrl = self.driver:get_player_control() + local yaw = self.object:getyaw() + if ctrl.up then + self.v = self.v + 0.1 + elseif ctrl.down then + self.v = self.v - 0.1 end - elseif ctrl.right then - if self.v < 0 then - self.object:setyaw(yaw + (1 + dtime) * 0.03) - else - self.object:setyaw(yaw - (1 + dtime) * 0.03) + if ctrl.left then + if self.v < 0 then + self.object:setyaw(yaw - (1 + dtime) * 0.03) + else + self.object:setyaw(yaw + (1 + dtime) * 0.03) + end + elseif ctrl.right then + if self.v < 0 then + self.object:setyaw(yaw + (1 + dtime) * 0.03) + else + self.object:setyaw(yaw - (1 + dtime) * 0.03) + end end end - end - local velo = self.object:getvelocity() - if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then - self.object:setpos(self.object:getpos()) - return - 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) > 5 then - self.v = 5 * get_sign(self.v) - end - - local p = self.object:getpos() - p.y = p.y - 0.5 - local new_velo = {x = 0, y = 0, z = 0} - local new_acce = {x = 0, y = 0, z = 0} - if not is_water(p) then - local nodedef = minetest.registered_nodes[minetest.get_node(p).name] - if (not nodedef) or nodedef.walkable then + local velo = self.object:getvelocity() + if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then + self.object:setpos(self.object:getpos()) + return + 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 - new_acce = {x = 0, y = 1, z = 0} - else - new_acce = {x = 0, y = -9.8, z = 0} + return end - new_velo = get_velocity(self.v, self.object:getyaw(), - self.object:getvelocity().y) - self.object:setpos(self.object:getpos()) - else - p.y = p.y + 1 - if is_water(p) then - local y = self.object:getvelocity().y - if y >= 5 then - y = 5 - elseif y < 0 then - new_acce = {x = 0, y = 20, z = 0} + if math.abs(self.v) > 5 then + self.v = 5 * get_sign(self.v) + end + + local p = self.object:getpos() + p.y = p.y - 0.5 + local new_velo = { x = 0, y = 0, z = 0 } + local new_acce = { x = 0, y = 0, z = 0 } + if not is_water(p) then + local nodedef = minetest.registered_nodes[minetest.get_node(p).name] + if (not nodedef) or nodedef.walkable then + self.v = 0 + new_acce = { x = 0, y = 1, z = 0 } else - new_acce = {x = 0, y = 5, z = 0} + new_acce = { x = 0, y = -9.8, z = 0 } end - new_velo = get_velocity(self.v, self.object:getyaw(), y) + new_velo = get_velocity(self.v, self.object:getyaw(), + self.object:getvelocity().y) self.object:setpos(self.object:getpos()) else - new_acce = {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) - new_velo = get_velocity(self.v, self.object:getyaw(), 0) - else - new_velo = get_velocity(self.v, self.object:getyaw(), - self.object:getvelocity().y) + p.y = p.y + 1 + if is_water(p) then + local y = self.object:getvelocity().y + if y >= 5 then + y = 5 + elseif y < 0 then + new_acce = { x = 0, y = 20, z = 0 } + else + new_acce = { x = 0, y = 5, z = 0 } + end + new_velo = get_velocity(self.v, self.object:getyaw(), y) self.object:setpos(self.object:getpos()) + else + new_acce = { 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) + new_velo = get_velocity(self.v, self.object:getyaw(), 0) + else + new_velo = get_velocity(self.v, self.object:getyaw(), + self.object:getvelocity().y) + self.object:setpos(self.object:getpos()) + end end end + self.object:setvelocity(new_velo) + self.object:setacceleration(new_acce) end - self.object:setvelocity(new_velo) - self.object:setacceleration(new_acce) -end + + minetest.register_entity("summer:canoa_" .. color .. "", canoa_) -minetest.register_entity("summer:canoa_"..color.."", canoa_) + minetest.register_craftitem(canoa_item_name, { + description = "canoa (" .. color .. ")", + inventory_image = "canoa_" .. color .. "_inv.png", + wield_image = "canoa_" .. color .. "_inv.png", + wield_scale = { x = 2, y = 2, z = 1 }, + liquids_pointable = true, - -minetest.register_craftitem(canoa_item_name, { - description = "canoa ("..color..")", - inventory_image = "canoa_"..color.."_inv.png", - wield_image = "canoa_"..color.."_inv.png", - wield_scale = {x = 2, y = 2, z = 1}, - liquids_pointable = true, - - on_place = function(itemstack, placer, pointed_thing) - if pointed_thing.type ~= "node" then - return - end - if not is_water(pointed_thing.under) then - return - end - pointed_thing.under.y = pointed_thing.under.y + 0.5 - minetest.add_entity(pointed_thing.under, "summer:canoa_"..color.."") - if not minetest.setting_getbool("creative_mode") then - itemstack:take_item() - end - return itemstack - end, -}) + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" then + return + end + if not is_water(pointed_thing.under) then + return + end + pointed_thing.under.y = pointed_thing.under.y + 0.5 + minetest.add_entity(pointed_thing.under, "summer:canoa_" .. color .. "") + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + return itemstack + end, + }) ---canoa -minetest.register_craft({ - output = canoa_item_name, - recipe = { - {"" , "" , "" }, - {"" , "wool:"..color, "" }, - {"group:wood","group:wood","group:wood"}, - }, -}) + --canoa + minetest.register_craft({ + output = canoa_item_name, + recipe = { + { "", "", "" }, + { "", "wool:" .. color, "" }, + { "group:wood", "group:wood", "group:wood" }, + }, + }) -if minetest.get_modpath("cannabis") then -minetest.register_craft({ - output = canoa_item_name, - recipe = { - {"" , "" , "" }, - {"" , "wool:"..color, "" }, - {"cannabis:canapa_plastic", "cannabis:canapa_plastic", "cannabis:canapa_plastic"}, - }, -}) -end + if minetest.get_modpath("cannabis") then + minetest.register_craft({ + output = canoa_item_name, + recipe = { + { "", "", "" }, + { "", "wool:" .. color, "" }, + { "cannabis:canapa_plastic", "cannabis:canapa_plastic", "cannabis:canapa_plastic" }, + }, + }) + end end colors = { - "black", "red", "green", "blue", "yellow", "violet","orange" + "black", "red", "green", "blue", "yellow", "violet", "orange" } -for _,color in ipairs(colors) do +for _, color in ipairs(colors) do reg_canoa_(color) end - - diff --git a/chest.lua b/chest.lua index a291a89..390a805 100644 --- a/chest.lua +++ b/chest.lua @@ -8,7 +8,7 @@ local chest_formspec = "list[current_player;main;0,6.09;8,3;8]" .. "listring[current_name;main]" .. "listring[current_player;main]" .. - default.get_hotbar_bg(0,4.95) + default.get_hotbar_bg(0, 4.95) local function get_locked_chest_formspec(pos) local spos = pos.x .. "," .. pos.y .. "," .. pos.z @@ -22,8 +22,8 @@ local function get_locked_chest_formspec(pos) "list[current_player;main;0,6.09;8,3;8]" .. "listring[nodemeta:" .. spos .. ";main]" .. "listring[current_player;main]" .. - default.get_hotbar_bg(0,4.95) - return formspec + default.get_hotbar_bg(0, 4.95) + return formspec end local function has_locked_chest_privilege(meta, player) @@ -40,185 +40,186 @@ local function has_locked_chest_privilege(meta, player) return true end local chest_list = { - { "Red chest", "red"}, - { "Orange chest", "orange"}, - { "Black chest", "black"}, - { "Yellow chest", "yellow"}, - { "Green chest", "green"}, - { "Blue chest", "blue"}, - { "Violet chest", "violet"}, + { "Red chest", "red" }, + { "Orange chest", "orange" }, + { "Black chest", "black" }, + { "Yellow chest", "yellow" }, + { "Green chest", "green" }, + { "Blue chest", "blue" }, + { "Violet chest", "violet" }, } for i in ipairs(chest_list) do local chestdesc = chest_list[i][1] local colour = chest_list[i][2] - -minetest.register_node("summer:chest"..colour.."", { - description = chestdesc..colour.."", - tiles = {"chest_top_"..colour..".png", "chest_top_"..colour..".png", "chest_side_"..colour..".png", - "chest_side_"..colour..".png", "chest_side_"..colour..".png", "chest_front_"..colour..".png"}, ---inventory_image = "chest_front_"..colour.."_inv.png", - ---wield_image = {"chest_front_"..colour..".png", - -- }, - paramtype2 = "facedir", - groups = {choppy = 2, oddly_breakable_by_hand = 2,tubedevice = 1, tubedevice_receiver = 1}, - tube = { - insert_object = function(pos, node, stack, direction) - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() - return inv:add_item("main", stack) - end, - can_insert = function(pos, node, stack, direction) - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() - return inv:room_for_item("main", stack) - end, - input_inventory = "main", - connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1} -}, - legacy_facedir_simple = true, - is_ground_content = false, - sounds = default.node_sound_wood_defaults(), - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec", chest_formspec) - meta:set_string("infotext", "Chest") - local inv = meta:get_inventory() - inv:set_size("main", 16*4) - end, - can_dig = function(pos,player) - local meta = minetest.get_meta(pos); - local inv = meta:get_inventory() - return inv:is_empty("main") - end, - on_metadata_inventory_move = function(pos, from_list, from_index, - to_list, to_index, count, player) - minetest.log("action", player:get_player_name() .. - " moves stuff in chest at " .. minetest.pos_to_string(pos)) - end, - on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name() .. - " moves " .. stack:get_name() .. - " to chest at " .. minetest.pos_to_string(pos)) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name() .. - " takes " .. stack:get_name() .. - " from chest at " .. minetest.pos_to_string(pos)) - end, - on_blast = function(pos) - local drops = {} - default.get_inventory_drops(pos, "main", drops) - drops[#drops+1] = "summer:chest"..colour.."" - minetest.remove_node(pos) - return drops - end, -}) -local lockchest_list = { - { "Red lockchest", "red"}, - { "Orange lockchest", "orange"}, - { "Black lockchest", "black"}, - { "Yellow lockchest", "yellow"}, - { "Green lockchest", "green"}, - { "Blue lockchest", "blue"}, - { "Violet lockchest", "violet"}, -} + minetest.register_node("summer:chest" .. colour .. "", { + description = chestdesc .. colour .. "", + tiles = { "chest_top_" .. colour .. ".png", "chest_top_" .. colour .. ".png", "chest_side_" .. colour .. ".png", + "chest_side_" .. colour .. ".png", "chest_side_" .. colour .. ".png", "chest_front_" .. colour .. ".png" }, + --inventory_image = "chest_front_"..colour.."_inv.png", -for i in ipairs(lockchest_list) do - local lockchestdesc = lockchest_list[i][1] - local colour = lockchest_list[i][2] + --wield_image = {"chest_front_"..colour..".png", + -- }, + paramtype2 = "facedir", + groups = { choppy = 2, oddly_breakable_by_hand = 2, tubedevice = 1, tubedevice_receiver = 1 }, + tube = { + insert_object = function(pos, node, stack, direction) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + return inv:add_item("main", stack) + end, + can_insert = function(pos, node, stack, direction) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + return inv:room_for_item("main", stack) + end, + input_inventory = "main", + connect_sides = { left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1 } + }, + legacy_facedir_simple = true, + is_ground_content = false, + sounds = default.node_sound_wood_defaults(), - minetest.register_node("summer:chest_lock"..colour.."", { - description = lockchestdesc.."", - tiles = {"chest_top_"..colour..".png", "chest_top_"..colour..".png", "chest_side_"..colour..".png", - "chest_side_"..colour..".png", "chest_side_"..colour..".png", "chest_lock_"..colour..".png"}, ---inventory_image = "chest_lock_"..colour.."_inv.png", - ---wield_image = {"chest_lock_"..colour.."_inv.png", - -- }, - paramtype2 = "facedir", - groups = {choppy = 2, oddly_breakable_by_hand = 2,tubedevice = 1, tubedevice_receiver = 1}, - tube = { - insert_object = function(pos, node, stack, direction) + on_construct = function(pos) local meta = minetest.get_meta(pos) + meta:set_string("formspec", chest_formspec) + meta:set_string("infotext", "Chest") local inv = meta:get_inventory() - return inv:add_item("main", stack) + inv:set_size("main", 16 * 4) end, - can_insert = function(pos, node, stack, direction) - local meta = minetest.get_meta(pos) + can_dig = function(pos, player) + local meta = minetest.get_meta(pos); local inv = meta:get_inventory() - return inv:room_for_item("main", stack) + return inv:is_empty("main") end, - input_inventory = "main", - connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1} -}, - legacy_facedir_simple = true, - is_ground_content = false, - sounds = default.node_sound_wood_defaults(), + on_metadata_inventory_move = function(pos, from_list, from_index, + to_list, to_index, count, player) + minetest.log("action", player:get_player_name() .. + " moves stuff in chest at " .. minetest.pos_to_string(pos)) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " moves " .. stack:get_name() .. + " to chest at " .. minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " takes " .. stack:get_name() .. + " from chest at " .. minetest.pos_to_string(pos)) + end, + on_blast = function(pos) + local drops = {} + default.get_inventory_drops(pos, "main", drops) + drops[#drops + 1] = "summer:chest" .. colour .. "" + minetest.remove_node(pos) + return drops + end, + }) + local lockchest_list = { + { "Red lockchest", "red" }, + { "Orange lockchest", "orange" }, + { "Black lockchest", "black" }, + { "Yellow lockchest", "yellow" }, + { "Green lockchest", "green" }, + { "Blue lockchest", "blue" }, + { "Violet lockchest", "violet" }, + } - after_place_node = function(pos, placer) - local meta = minetest.get_meta(pos) - meta:set_string("owner", placer:get_player_name() or "") - meta:set_string("infotext", "Locked Chest (owned by " .. - meta:get_string("owner") .. ")") - end, - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("infotext", "Locked Chest") - meta:set_string("owner", "") - local inv = meta:get_inventory() - inv:set_size("main", 16 * 4) - end, - can_dig = function(pos,player) - local meta = minetest.get_meta(pos); - local inv = meta:get_inventory() - return inv:is_empty("main") and has_locked_chest_privilege(meta, player) - end, - allow_metadata_inventory_move = function(pos, from_list, from_index, - to_list, to_index, count, player) - local meta = minetest.get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - return 0 - end - return count - end, - allow_metadata_inventory_put = function(pos, listname, index, stack, player) - local meta = minetest.get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - return 0 - end - return stack:get_count() - end, - allow_metadata_inventory_take = function(pos, listname, index, stack, player) - local meta = minetest.get_meta(pos) - if not has_locked_chest_privilege(meta, player) then - return 0 - end - return stack:get_count() - end, - on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name() .. - " moves " .. stack:get_name() .. - " to locked chest at " .. minetest.pos_to_string(pos)) - end, - on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name() .. - " takes " .. stack:get_name() .. - " from locked chest at " .. minetest.pos_to_string(pos)) - end, - on_rightclick = function(pos, node, clicker) - local meta = minetest.get_meta(pos) - if has_locked_chest_privilege(meta, clicker) then - minetest.show_formspec( - clicker:get_player_name(), - "summer:chest_lock"..colour.."", - get_locked_chest_formspec(pos) - ) - end - end, - on_blast = function() end, -}) -end + for i in ipairs(lockchest_list) do + local lockchestdesc = lockchest_list[i][1] + local colour = lockchest_list[i][2] + + minetest.register_node("summer:chest_lock" .. colour .. "", { + description = lockchestdesc .. "", + tiles = { "chest_top_" .. colour .. ".png", "chest_top_" .. colour .. ".png", "chest_side_" .. colour .. + ".png", + "chest_side_" .. colour .. ".png", "chest_side_" .. colour .. ".png", "chest_lock_" .. colour .. ".png" }, + --inventory_image = "chest_lock_"..colour.."_inv.png", + + --wield_image = {"chest_lock_"..colour.."_inv.png", + -- }, + paramtype2 = "facedir", + groups = { choppy = 2, oddly_breakable_by_hand = 2, tubedevice = 1, tubedevice_receiver = 1 }, + tube = { + insert_object = function(pos, node, stack, direction) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + return inv:add_item("main", stack) + end, + can_insert = function(pos, node, stack, direction) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + return inv:room_for_item("main", stack) + end, + input_inventory = "main", + connect_sides = { left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1 } + }, + legacy_facedir_simple = true, + is_ground_content = false, + sounds = default.node_sound_wood_defaults(), + + after_place_node = function(pos, placer) + local meta = minetest.get_meta(pos) + meta:set_string("owner", placer:get_player_name() or "") + meta:set_string("infotext", "Locked Chest (owned by " .. + meta:get_string("owner") .. ")") + end, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("infotext", "Locked Chest") + meta:set_string("owner", "") + local inv = meta:get_inventory() + inv:set_size("main", 16 * 4) + end, + can_dig = function(pos, player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") and has_locked_chest_privilege(meta, player) + end, + allow_metadata_inventory_move = function(pos, from_list, from_index, + to_list, to_index, count, player) + local meta = minetest.get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + return 0 + end + return count + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + return 0 + end + return stack:get_count() + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + return 0 + end + return stack:get_count() + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " moves " .. stack:get_name() .. + " to locked chest at " .. minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " takes " .. stack:get_name() .. + " from locked chest at " .. minetest.pos_to_string(pos)) + end, + on_rightclick = function(pos, node, clicker) + local meta = minetest.get_meta(pos) + if has_locked_chest_privilege(meta, clicker) then + minetest.show_formspec( + clicker:get_player_name(), + "summer:chest_lock" .. colour .. "", + get_locked_chest_formspec(pos) + ) + end + end, + on_blast = function() end, + }) + end end diff --git a/craft.lua b/craft.lua index a9e5cc1..47baca3 100644 --- a/craft.lua +++ b/craft.lua @@ -1,88 +1,141 @@ -if minetest.get_modpath("wool") and minetest.get_modpath("dye")then -local lchest_list = { - { "Red chest", "red"}, - { "Orange chest", "orange"}, - { "Black ", "black"}, - { "Yellow chest", "yellow"}, - { "Green chest", "green"}, - { "Blue chest", "blue"}, - { "Violet chest", "violet"}, - {"white chest", "white"} -} +if minetest.get_modpath("wool") and minetest.get_modpath("dye") then + local lchest_list = { + { "Red chest", "red" }, + { "Orange chest", "orange" }, + { "Black ", "black" }, + { "Yellow chest", "yellow" }, + { "Green chest", "green" }, + { "Blue chest", "blue" }, + { "Violet chest", "violet" }, + { "white chest", "white" } + } -for i in ipairs(lchest_list) do - local desc = lchest_list[i][1] - local colour = lchest_list[i][2] + for i in ipairs(lchest_list) do + local desc = lchest_list[i][1] + local colour = lchest_list[i][2] ---rake -minetest.register_craft({ + + --sdraia + minetest.register_craft({ + output = "summer:sdraia_" .. colour .. "", + recipe = { + { "default:stick", "wool:" .. colour, "", }, + { "default:paper", "default:paper", "default:paper", }, + { "default:stick", "", "default:stick", } + } + }) + + --portacenere + minetest.register_craft({ + output = "summer:Portacenere_" .. colour .. "", + recipe = { + { "group:wood", "", "group:wood" }, + { "default:stick", "default:paper", "default:stick" }, + { "default:paper", "wool:" .. colour, "default:paper" } + } + }) + + --porta + + minetest.register_craft({ + output = "summer:porta_" .. colour .. "_ch", + recipe = { + { "group:wood", "wool:" .. colour, "", }, + { "wool:" .. colour, "group:wood", "", }, + { "group:wood", "group:wood", "", } + } + }) + --occhiali + minetest.register_craft({ + output = "summer:occhiali_" .. colour .. "", + recipe = { + { "", "wool:" .. colour, "", }, + { "default:stick", "", "default:stick", }, + { "default:glass", "default:stick", "default:glass", } + } + }) + + + --________________________________________________________ + + --asciugamano + --________________________________________________________ + + minetest.register_craft({ + output = "summer:asciugamano_" .. colour .. "", + recipe = { + { "", "", "", }, + { "wool:" .. colour, "", "", }, + { "default:ladder_wood", "default:ladder_wood", "default:ladder_wood", } + } + }) + + --________________________________________________________ + --ombrellone + --________________________________________________________ + minetest.register_craft({ + output = "summer:ombrellone_" .. colour .. "", + recipe = { + { "default:paper", "wool:" .. colour, "default:paper", }, + { "", "default:stick", "", }, + { "", "default:stick", "", } + } + }) + + + + minetest.register_craft({ + output = "summer:ombrellone_n_" .. colour .. "", + recipe = { + { "", "wool:" .. colour, "" }, + { "default:paper", "default:stick", "default:paper" }, + { "", "default:stick", "" } + } + }) + + + + --________________________________________________________ + + --chest + --________________________________________________________ + minetest.register_craft({ + output = "summer:chest" .. colour .. "", + recipe = { + { "default:stone", "dye:" .. colour .. "", "default:stone" }, + { "group:wood", "", "group:wood" }, + { "group:wood", "group:wood", "group:wood" } + + } + }) + + + minetest.register_craft({ + output = "summer:chest_lock" .. colour .. "", + recipe = { + { "summer:chest" .. colour .. "", "default:diamond", "" } + --{"","",""}, + --{"","",""} + + } + }) + end + + --rake + minetest.register_craft({ output = "summer:rake", recipe = { - {"default:stick", "default:steel_ingot", "default:stick", }, - {"", "default:stick", "", }, - {"", "default:gold_ingot", "", } - } - }) ---sdraia -minetest.register_craft({ - output = "summer:sdraia_"..colour.."", - recipe = { - {"default:stick", "wool:"..colour, "", }, - {"default:paper", "default:paper", "default:paper", }, - {"default:stick", "", "default:stick", } + { "default:stick", "default:steel_ingot", "default:stick", }, + { "", "default:stick", "", }, + { "", "default:gold_ingot", "", } } }) - --portacenere - minetest.register_craft({ - output = "summer:Portacenere_"..colour.."", - recipe = { - {"group:wood", "", "group:wood" }, - {"default:stick", "default:paper", "default:stick" }, - {"default:paper", "wool:"..colour, "default:paper" } - } - }) + --________________________________________________________ + --breccia + --________________________________________________________ ---porta - - minetest.register_craft({ - output = "summer:porta_"..colour.."_ch", - recipe = { - {"group:wood", "wool:"..colour, "", }, - {"wool:"..colour, "group:wood", "", }, - {"group:wood", "group:wood", "", } - } - }) ---occhiali -minetest.register_craft({ - output = "summer:occhiali_"..colour.."", - recipe = { - {"", "wool:"..colour, "", }, - {"default:stick", "", "default:stick", }, - {"default:glass", "default:stick", "default:glass", } - } - }) - - ---________________________________________________________ - ---asciugamano ---________________________________________________________ - -minetest.register_craft({ - output = "summer:asciugamano_"..colour.."", - recipe = { - {"","","", }, - {"wool:"..colour, "", "", }, - {"default:ladder_wood", "default:ladder_wood", "default:ladder_wood", } - } - }) - ---________________________________________________________ ---breccia ---________________________________________________________ - - --craft BRECCIA BLOCK + --craft BRECCIA BLOCK minetest.register_craft({ output = '"summer:breccia" 4', recipe = { @@ -93,7 +146,7 @@ minetest.register_craft({ }) minetest.register_craft({ - output ='"summer:desert_breccia_2" 4', + output = '"summer:desert_breccia_2" 4', recipe = { { "summer:desert_pietra", "summer:desert_pietra", "summer:desert_pietra" }, { "summer:desert_pietra", "summer:desert_pietra", "summer:desert_pietra" }, @@ -117,25 +170,25 @@ minetest.register_craft({ { "summer:pietraP", "summer:pietraP", "summer:pietraP" }, { "summer:pietraP", "summer:pietraP", "summer:pietraP" }, }, - }) - + }) + --____________________________________________________ --granite --____________________________________________________ - + --craft GRANITE -minetest.register_craft({ + minetest.register_craft({ output = '"summer:graniteBC" 5', recipe = { - { "", "", "" }, - { "summer:pietraA", "", "" }, + { "", "", "" }, + { "summer:pietraA", "", "" }, { "summer:graniteB", "", "" }, }, }) minetest.register_craft({ output = '"summer:graniteB" 5', recipe = { - { "", "", "" }, + { "", "", "" }, { "summer:graniteP", "summer:graniteA", "" }, { "summer:graniteR", "summer:graniteG", "" }, }, @@ -148,7 +201,7 @@ minetest.register_craft({ { "summer:mattoneR", "summer:mattoneR", "summer:mattoneR" }, }, }) - minetest.register_craft({ + minetest.register_craft({ output = '"summer:graniteA" 5', recipe = { { "summer:mattoneA", "summer:mattoneA", "summer:mattoneA" }, @@ -164,7 +217,7 @@ minetest.register_craft({ { "summer:mattoneG", "summer:mattoneG", "summer:mattoneG" }, }, }) - minetest.register_craft({ + minetest.register_craft({ output = '"summer:graniteP" 5', recipe = { { "summer:mattoneP", "summer:mattoneP", "summer:mattoneP" }, @@ -172,61 +225,5 @@ minetest.register_craft({ { "summer:mattoneP", "summer:mattoneP", "summer:mattoneP" }, }, }) ---________________________________________________________ - - - - ---________________________________________________________ ---ombrellone ---________________________________________________________ - minetest.register_craft({ - output = "summer:ombrellone_"..colour.."", - recipe = { - {"default:paper", "wool:"..colour, "default:paper", }, - {"", "default:stick", "", }, - {"", "default:stick", "", } - } - }) - - - - minetest.register_craft({ - output = "summer:ombrellone_n_"..colour.."", - recipe = { - {"", "wool:"..colour, "" }, - {"default:paper", "default:stick", "default:paper" }, - {"", "default:stick", "" } - } - }) - - - ---________________________________________________________ - ---chest ---________________________________________________________ -minetest.register_craft({ - output = "summer:chest"..colour.."", - recipe = { - {"default:stone","dye:"..colour.."","default:stone"}, - {"group:wood","","group:wood"}, - {"group:wood","group:wood","group:wood"} - - } - }) - - - minetest.register_craft({ - output = "summer:chest_lock"..colour.."", - recipe = { - {"summer:chest"..colour.."","default:diamond",""} - --{"","",""}, - --{"","",""} - - } - }) - -end - + --________________________________________________________ end diff --git a/granite.lua b/granite.lua index 1558468..99d1a37 100644 --- a/granite.lua +++ b/granite.lua @@ -1,10 +1,10 @@ local granite = { - {"granite", "Granite grey"}, - {"graniteR", "Granite corten"}, - {"graniteA", "Granite avory"}, - {"graniteP", "Granite pink"}, - {"graniteB", "Granite black"}, - {"graniteBC", "Granite black center"}, + { "granite", "Granite grey" }, + { "graniteR", "Granite corten" }, + { "graniteA", "Granite avory" }, + { "graniteP", "Granite pink" }, + { "graniteB", "Granite black" }, + { "graniteBC", "Granite black center" }, } local stairs_mod = minetest.get_modpath("stairs") @@ -12,100 +12,100 @@ local stairsplus_mod = minetest.get_modpath("moreblocks") and minetest.global_exists("stairsplus") for _, granite in pairs(granite) do -if stairsplus_mod then - + if stairsplus_mod then stairsplus:register_all("summer", granite[1], "summer:" .. granite[1], { description = granite[2] .. " Summer", - tiles = {granite[1] .. ".png"}, - groups = {cracky = 3}, + tiles = { granite[1] .. ".png" }, + groups = { cracky = 3 }, sounds = default.node_sound_stone_defaults(), }) stairsplus:register_alias_all("summer", granite[1], "summer", granite[1]) - minetest.register_alias("stairs:slab_summer_".. granite[1], "summer:slab_baked_granite_" .. granite[1]) - minetest.register_alias("stairs:stair_summer_".. granite[1], "summer:stair_baked_granite_" .. granite[1]) + minetest.register_alias("stairs:slab_summer_" .. granite[1], "summer:slab_baked_granite_" .. granite[1]) + minetest.register_alias("stairs:stair_summer_" .. granite[1], "summer:stair_baked_granite_" .. granite[1]) - -- register all stair types for stairs redo + -- register all stair types for stairs redo elseif stairs_mod and stairs.mod then - stairs.register_all("summer_" .. granite[1], "summer:" .. granite[1], - {cracky = 3}, - {granite[1] .. ".png"}, + { cracky = 3 }, + { granite[1] .. ".png" }, granite[2] .. " Summer", default.node_sound_stone_defaults()) - -- register stair and slab using default stairs + -- register stair and slab using default stairs elseif stairs_mod then - - stairs.register_stair_and_slab("summer_".. granite[1], "summer:".. granite[1], - {cracky = 3}, - {granite[1] .. ".png"}, + stairs.register_stair_and_slab("summer_" .. granite[1], "summer:" .. granite[1], + { cracky = 3 }, + { granite[1] .. ".png" }, granite[2] .. " Summer Stair", granite[2] .. " Summer Slab", default.node_sound_stone_defaults()) end end - --GRANITE + +--GRANITE minetest.register_node("summer:granite", { description = "Granite", - tiles = {"granite.png"}, - --material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + tiles = { "granite.png" }, + --material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='"summer:mattoneG" 9', stack_max = 9999, --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), }) + minetest.register_node("summer:graniteA", { description = "GraniteA", - tiles = {"graniteA.png"}, - --material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + tiles = { "graniteA.png" }, + --material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='"summer:mattoneA" 9', stack_max = 9999, --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), }) + minetest.register_node("summer:graniteP", { description = "GraniteP", - tiles = {"graniteP.png"}, - --material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + tiles = { "graniteP.png" }, + --material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='"summer:mattoneP" 9', stack_max = 9999, --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), }) + minetest.register_node("summer:graniteR", { description = "GraniteR", - tiles = {"graniteR.png"}, - --material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + tiles = { "graniteR.png" }, + --material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='summer:mattoneR 9', stack_max = 9999, --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), }) - minetest.register_node("summer:graniteBC", { +minetest.register_node("summer:graniteBC", { description = "Granite", - tiles = {"graniteBC.png"}, - --material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, - --drop ='"summer:mattoneG" 9', - stack_max = 9999, - --legacy_mineral = true, - sounds = default.node_sound_stone_defaults(), -}) - minetest.register_node("summer:graniteB", { - description = "Granite", - tiles = {"graniteB.png"}, - --material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + tiles = { "graniteBC.png" }, + --material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='"summer:mattoneG" 9', stack_max = 9999, --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), }) - +minetest.register_node("summer:graniteB", { + description = "Granite", + tiles = { "graniteB.png" }, + --material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, + --drop ='"summer:mattoneG" 9', + stack_max = 9999, + --legacy_mineral = true, + sounds = default.node_sound_stone_defaults(), +}) diff --git a/init.lua b/init.lua index 1ff0588..1c144ac 100644 --- a/init.lua +++ b/init.lua @@ -1,29 +1,29 @@ local path = minetest.get_modpath("summer") -dofile(path.."/salvag.lua") -dofile(path.."/ombrellone.lua") -dofile(path.."/sdraia.lua") -dofile(path.."/porta.lua") -dofile(path.."/ombrellone_new.lua") -dofile(path.."/materassino.lua") -dofile(path.."/breccia.lua") -dofile(path.."/asciugamano.lua") +dofile(path .. "/salvag.lua") +dofile(path .. "/ombrellone.lua") +dofile(path .. "/sdraia.lua") +dofile(path .. "/porta.lua") +dofile(path .. "/ombrellone_new.lua") +dofile(path .. "/materassino.lua") +dofile(path .. "/breccia.lua") +dofile(path .. "/asciugamano.lua") if minetest.get_modpath("3d_armor") then -dofile(path.."/occhiali.lua") + dofile(path .. "/occhiali.lua") end -dofile(path.."/chest.lua") -dofile(path.."/portacenere.lua") -dofile(path.."/summerstair.lua") -dofile(path.."/barche.lua") -dofile(path.."/granite.lua") -dofile(path.."/canoa.lua") -dofile(path.."/craft.lua") -dofile(path.."/vetro.lua") -dofile(path.."/aliases.lua") -dofile(path.."/sabbia.lua") -dofile(path.."/mattone.lua") ---dofile(path.."/pietra.lua") -dofile(path.."/pallone.lua") -dofile(path.."/granite.lua") +dofile(path .. "/chest.lua") +dofile(path .. "/portacenere.lua") +dofile(path .. "/summerstair.lua") +dofile(path .. "/barche.lua") +dofile(path .. "/granite.lua") +dofile(path .. "/canoa.lua") +dofile(path .. "/craft.lua") +dofile(path .. "/vetro.lua") +dofile(path .. "/aliases.lua") +dofile(path .. "/sabbia.lua") +dofile(path .. "/mattone.lua") +dofile(path .. "/pietra.lua") +dofile(path .. "/pallone.lua") +dofile(path .. "/granite.lua") if minetest.get_modpath("cannabis") then -dofile(path.."/canapa.lua") + dofile(path .. "/canapa.lua") end diff --git a/materassino.lua b/materassino.lua index b05a91d..3a08fd5 100644 --- a/materassino.lua +++ b/materassino.lua @@ -15,8 +15,8 @@ end local function get_velocity(v, yaw, y) local x = -math.sin(yaw) * v - local z = math.cos(yaw) * v - return {x = x, y = y, z = z} + local z = math.cos(yaw) * v + return { x = x, y = y, z = z } end @@ -24,245 +24,236 @@ local function get_v(v) return math.sqrt(v.x ^ 2 + v.z ^ 2) end local function reg_materassino(color) + local materassino_item_name = "summer:materassino_" .. color .. "_item" + local materassino_ent_name = "summer:materassino_" .. color .. "_entity" - local materassino_item_name = "summer:materassino_"..color.."_item" - local materassino_ent_name = "summer:materassino_"..color.."_entity" + -- + -- Boat entity + -- --- --- Boat entity --- + local materassino = { + physical = true, + collisionbox = { -0.5, -0.35, -0.5, 0.5, 0.3, 0.5 }, + visual = "mesh", + mesh = "materassino.obj", + textures = { "materassino_" .. color .. ".png" }, -local materassino = { - physical = true, - collisionbox = {-0.5, -0.35, -0.5, 0.5, 0.3, 0.5}, - visual = "mesh", - mesh = "materassino.obj", - textures = { "materassino_"..color..".png" }, - - driver = nil, - v = 0, - last_v = 0, - removed = false -} + driver = nil, + v = 0, + last_v = 0, + removed = false + } -function materassino.on_rightclick(self, clicker) - if not clicker or not clicker:is_player() then - return - end - local name = clicker:get_player_name() - if self.driver and clicker == self.driver then - self.driver = nil - clicker:set_detach() - default.player_attached[name] = false - default.player_set_animation(clicker, "stand" , 30) - local pos = clicker:getpos() - pos = {x = pos.x, y = pos.y + 0.2, z = pos.z} - minetest.after(0.1, function() - clicker:setpos(pos) - end) - elseif not self.driver then - local attach = clicker:get_attach() - if attach and attach:get_luaentity() then - local luaentity = attach:get_luaentity() - if luaentity.driver then - luaentity.driver = nil - end + function materassino.on_rightclick(self, clicker) + if not clicker or not clicker:is_player() then + return + end + local name = clicker:get_player_name() + if self.driver and clicker == self.driver then + self.driver = nil clicker:set_detach() + default.player_attached[name] = false + default.player_set_animation(clicker, "stand", 30) + local pos = clicker:getpos() + pos = { x = pos.x, y = pos.y + 0.2, z = pos.z } + minetest.after(0.1, function() + clicker:setpos(pos) + end) + elseif not self.driver then + local attach = clicker:get_attach() + if attach and attach:get_luaentity() then + local luaentity = attach:get_luaentity() + if luaentity.driver then + luaentity.driver = nil + end + clicker:set_detach() + end + self.driver = clicker + clicker:set_attach(self.object, "", + { x = 0, y = 11, z = -3 }, { x = 0, y = 0, z = 0 }) + default.player_attached[name] = true + minetest.after(0.2, function() + default.player_set_animation(clicker, "lay", 30) + end) + self.object:setyaw(clicker:get_look_yaw() - math.pi / 2) end - self.driver = clicker - clicker:set_attach(self.object, "", - {x = 0, y = 11, z = -3}, {x = 0, y = 0, z = 0}) - default.player_attached[name] = true - minetest.after(0.2, function() - default.player_set_animation(clicker, "lay" , 30) - end) - self.object:setyaw(clicker:get_look_yaw() - math.pi / 2) end -end - -function materassino.on_activate(self, staticdata, dtime_s) - self.object:set_armor_groups({immortal = 1}) - if staticdata then - self.v = tonumber(staticdata) + function materassino.on_activate(self, staticdata, dtime_s) + self.object:set_armor_groups({ immortal = 1 }) + if staticdata then + self.v = tonumber(staticdata) + end + self.last_v = self.v end - self.last_v = self.v -end - -function materassino.get_staticdata(self) - return tostring(self.v) -end - - -function materassino.on_punch(self, puncher) - if not puncher or not puncher:is_player() or self.removed then - return + function materassino.get_staticdata(self) + return tostring(self.v) end - if self.driver and puncher == self.driver then - self.driver = nil - puncher:set_detach() - default.player_attached[puncher:get_player_name()] = false - end - if not self.driver then - self.removed = true - -- delay remove to ensure player is detached - minetest.after(0.1, function() - self.object:remove() - end) - if not minetest.setting_getbool("creative_mode") then - local inv = puncher:get_inventory() - if inv:room_for_item("main", "summer:materassino_"..color.."_item") then - inv:add_item("main", "summer:materassino_"..color.."_item") - else - minetest.add_item(self.object:getpos(), materassino_item_name) + + function materassino.on_punch(self, puncher) + if not puncher or not puncher:is_player() or self.removed then + return + end + if self.driver and puncher == self.driver then + self.driver = nil + puncher:set_detach() + default.player_attached[puncher:get_player_name()] = false + end + if not self.driver then + self.removed = true + -- delay remove to ensure player is detached + minetest.after(0.1, function() + self.object:remove() + end) + if not minetest.setting_getbool("creative_mode") then + local inv = puncher:get_inventory() + if inv:room_for_item("main", "summer:materassino_" .. color .. "_item") then + inv:add_item("main", "summer:materassino_" .. color .. "_item") + else + minetest.add_item(self.object:getpos(), materassino_item_name) + end end end end -end - -function materassino.on_step(self, dtime) - self.v = get_v(self.object:getvelocity()) * get_sign(self.v) - if self.driver then - local ctrl = self.driver:get_player_control() - local yaw = self.object:getyaw() - if ctrl.up then - self.v = self.v + 0.1 - elseif ctrl.down then - self.v = self.v - 0.1 - end - if ctrl.left then - if self.v < 0 then - self.object:setyaw(yaw - (1 + dtime) * 0.03) - else - self.object:setyaw(yaw + (1 + dtime) * 0.03) + function materassino.on_step(self, dtime) + self.v = get_v(self.object:getvelocity()) * get_sign(self.v) + if self.driver then + local ctrl = self.driver:get_player_control() + local yaw = self.object:getyaw() + if ctrl.up then + self.v = self.v + 0.1 + elseif ctrl.down then + self.v = self.v - 0.1 end - elseif ctrl.right then - if self.v < 0 then - self.object:setyaw(yaw + (1 + dtime) * 0.03) - else - self.object:setyaw(yaw - (1 + dtime) * 0.03) + if ctrl.left then + if self.v < 0 then + self.object:setyaw(yaw - (1 + dtime) * 0.03) + else + self.object:setyaw(yaw + (1 + dtime) * 0.03) + end + elseif ctrl.right then + if self.v < 0 then + self.object:setyaw(yaw + (1 + dtime) * 0.03) + else + self.object:setyaw(yaw - (1 + dtime) * 0.03) + end end end - end - local velo = self.object:getvelocity() - if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then - self.object:setpos(self.object:getpos()) - return - 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) > 5 then - self.v = 5 * get_sign(self.v) - end - - local p = self.object:getpos() - p.y = p.y - 0.5 - local new_velo = {x = 0, y = 0, z = 0} - local new_acce = {x = 0, y = 0, z = 0} - if not is_water(p) then - local nodedef = minetest.registered_nodes[minetest.get_node(p).name] - if (not nodedef) or nodedef.walkable then + local velo = self.object:getvelocity() + if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then + self.object:setpos(self.object:getpos()) + return + 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 - new_acce = {x = 0, y = 1, z = 0} - else - new_acce = {x = 0, y = -9.8, z = 0} + return end - new_velo = get_velocity(self.v, self.object:getyaw(), - self.object:getvelocity().y) - self.object:setpos(self.object:getpos()) - else - p.y = p.y + 1 - if is_water(p) then - local y = self.object:getvelocity().y - if y >= 5 then - y = 5 - elseif y < 0 then - new_acce = {x = 0, y = 20, z = 0} + if math.abs(self.v) > 5 then + self.v = 5 * get_sign(self.v) + end + + local p = self.object:getpos() + p.y = p.y - 0.5 + local new_velo = { x = 0, y = 0, z = 0 } + local new_acce = { x = 0, y = 0, z = 0 } + if not is_water(p) then + local nodedef = minetest.registered_nodes[minetest.get_node(p).name] + if (not nodedef) or nodedef.walkable then + self.v = 0 + new_acce = { x = 0, y = 1, z = 0 } else - new_acce = {x = 0, y = 5, z = 0} + new_acce = { x = 0, y = -9.8, z = 0 } end - new_velo = get_velocity(self.v, self.object:getyaw(), y) + new_velo = get_velocity(self.v, self.object:getyaw(), + self.object:getvelocity().y) self.object:setpos(self.object:getpos()) else - new_acce = {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) - new_velo = get_velocity(self.v, self.object:getyaw(), 0) - else - new_velo = get_velocity(self.v, self.object:getyaw(), - self.object:getvelocity().y) + p.y = p.y + 1 + if is_water(p) then + local y = self.object:getvelocity().y + if y >= 5 then + y = 5 + elseif y < 0 then + new_acce = { x = 0, y = 20, z = 0 } + else + new_acce = { x = 0, y = 5, z = 0 } + end + new_velo = get_velocity(self.v, self.object:getyaw(), y) self.object:setpos(self.object:getpos()) + else + new_acce = { 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) + new_velo = get_velocity(self.v, self.object:getyaw(), 0) + else + new_velo = get_velocity(self.v, self.object:getyaw(), + self.object:getvelocity().y) + self.object:setpos(self.object:getpos()) + end end end + self.object:setvelocity(new_velo) + self.object:setacceleration(new_acce) end - self.object:setvelocity(new_velo) - self.object:setacceleration(new_acce) -end + + minetest.register_entity("summer:materassino_" .. color .. "", materassino) -minetest.register_entity("summer:materassino_"..color.."", materassino) + minetest.register_craftitem(materassino_item_name, { + description = "materassino (" .. color .. ")", + inventory_image = "materassino_" .. color .. "_inv.png", + wield_image = "materassino_" .. color .. "_inv.png", + wield_scale = { x = 2, y = 2, z = 1 }, + liquids_pointable = true, + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" then + return + end + if not is_water(pointed_thing.under) then + return + end + pointed_thing.under.y = pointed_thing.under.y + 0.5 + minetest.add_entity(pointed_thing.under, "summer:materassino_" .. color .. "") + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + return itemstack + end, + }) -minetest.register_craftitem(materassino_item_name, { - description = "materassino ("..color..")", - inventory_image = "materassino_"..color.."_inv.png", - wield_image = "materassino_"..color.."_inv.png", - wield_scale = {x = 2, y = 2, z = 1}, - liquids_pointable = true, - - on_place = function(itemstack, placer, pointed_thing) - if pointed_thing.type ~= "node" then - return - end - if not is_water(pointed_thing.under) then - return - end - pointed_thing.under.y = pointed_thing.under.y + 0.5 - minetest.add_entity(pointed_thing.under, "summer:materassino_"..color.."") - if not minetest.setting_getbool("creative_mode") then - itemstack:take_item() - end - return itemstack - end, -}) - -if minetest.get_modpath("cannabis") then - - -minetest.register_craft({ - output = materassino_item_name, - recipe = { - {"", "" ,""}, - {"", "wool:"..color, ""}, - {"cannabis:canapa_plastic", "cannabis:canapa_plastic", "cannabis:canapa_plastic"}, - }, -}) -end -minetest.register_craft({ - output = materassino_item_name, - recipe = { - {"", "" ,""}, - {"", "wool:"..color, ""}, - {"wool:"..color, "wool:"..color, "wool:"..color}, - }, -}) + if minetest.get_modpath("cannabis") then + minetest.register_craft({ + output = materassino_item_name, + recipe = { + { "", "", "" }, + { "", "wool:" .. color, "" }, + { "cannabis:canapa_plastic", "cannabis:canapa_plastic", "cannabis:canapa_plastic" }, + }, + }) + end + minetest.register_craft({ + output = materassino_item_name, + recipe = { + { "", "", "" }, + { "", "wool:" .. color, "" }, + { "wool:" .. color, "wool:" .. color, "wool:" .. color }, + }, + }) end colors = { - "black", "red", "green", "blue", "yellow", "violet","orange", + "black", "red", "green", "blue", "yellow", "violet", "orange", } -for _,color in ipairs(colors) do +for _, color in ipairs(colors) do reg_materassino(color) end - diff --git a/mattone.lua b/mattone.lua index d41cd81..4bff2f9 100644 --- a/mattone.lua +++ b/mattone.lua @@ -1,43 +1,45 @@ minetest.register_craftitem("summer:mattoneG", { description = "Mattone", inventory_image = "mattone.png", - }) - minetest.register_craftitem("summer:mattoneR", { + +minetest.register_craftitem("summer:mattoneR", { description = "MattoneR", inventory_image = "mattoneR.png", - }) + minetest.register_craftitem("summer:mattoneA", { description = "MattoneA", inventory_image = "mattoneA.png", - -}) - minetest.register_craftitem("summer:mattoneP", { +}) + +minetest.register_craftitem("summer:mattoneP", { description = "MattoneP", inventory_image = "mattoneP.png", - -}) ---craftMATTONE +}) +--craftMATTONE minetest.register_craft({ type = 'cooking', recipe = "summer:pietraA", cooktime = 2, output = "summer:mattoneA", }) + minetest.register_craft({ type = 'cooking', recipe = "summer:pietra", cooktime = 2, output = "summer:mattoneG", }) + minetest.register_craft({ type = 'cooking', recipe = "summer:desert_pietra", cooktime = 2, output = "summer:mattoneR", }) + minetest.register_craft({ type = 'cooking', recipe = "summer:pietraP", diff --git a/occhiali.lua b/occhiali.lua index c2ab9d1..8502974 100644 --- a/occhiali.lua +++ b/occhiali.lua @@ -1,40 +1,37 @@ local Occhiali_list = { - { "Red Occhiali", "red"}, - { "Orange Occhiali", "orange"}, - { "Black Occhiali", "black"}, - { "Yellow Occhiali", "yellow"}, - { "Green Occhiali", "green"}, - { "Blue Occhiali", "blue"}, - { "Jam Occhiali", "jam"}, - { "Violet Occhiali", "violet"}, + { "Red Occhiali", "red" }, + { "Orange Occhiali", "orange" }, + { "Black Occhiali", "black" }, + { "Yellow Occhiali", "yellow" }, + { "Green Occhiali", "green" }, + { "Blue Occhiali", "blue" }, + { "Jam Occhiali", "jam" }, + { "Violet Occhiali", "violet" }, } for i in ipairs(Occhiali_list) do local Occhialidesc = Occhiali_list[i][1] local colour = Occhiali_list[i][2] -minetest.register_alias("occhiali"..colour.."","summer:occhiali"..colour.."") -if minetest.get_modpath("summer") then - local stats = { - Occhialidesc = { name=Occhialidesc, armor=1.8, heal=0, use=650 }, - - } - --[[local mats = { + minetest.register_alias("occhiali" .. colour .. "", "summer:occhiali" .. colour .. "") + if minetest.get_modpath("summer") then + local stats = { + Occhialidesc = { name = Occhialidesc, armor = 1.8, heal = 0, use = 650 }, + + } + --[[local mats = { fibra="cannabis:fibra_ingot", tessuto="cannabis:tessuto_ingot", foglie="cannabis:foglie_ingot", high="cannabis:high_performance_ingot", }]] - for k, v in pairs(stats) do - minetest.register_tool("summer:occhiali_"..colour.."", { - description = Occhialidesc, - tiles= "occhiali_"..colour..".png", - inventory_image = "occhiali_"..colour.."_inv.png", - groups = {armor_head=math.floor(5*v.armor), armor_heal=v.heal, armor_use=v.use}, - wear = 0, - }) - -end -end - - + for k, v in pairs(stats) do + minetest.register_tool("summer:occhiali_" .. colour .. "", { + description = Occhialidesc, + tiles = "occhiali_" .. colour .. ".png", + inventory_image = "occhiali_" .. colour .. "_inv.png", + groups = { armor_head = math.floor(5 * v.armor), armor_heal = v.heal, armor_use = v.use }, + wear = 0, + }) + end + end end diff --git a/ombrellone.lua b/ombrellone.lua index 2b1db47..c782f62 100644 --- a/ombrellone.lua +++ b/ombrellone.lua @@ -1,70 +1,68 @@ local Ombrellone_list = { - { "Red Ombrellone", "red"}, - { "White Ombrellone", "white"}, - { "Orange Ombrellone", "orange"}, - { "Black Ombrellone", "black"}, - { "Yellow Ombrellone", "yellow"}, - { "Green Ombrellone", "green"}, - { "Blue Ombrellone", "blue"}, - { "Violet Ombrellone", "violet"}, + { "Red Ombrellone", "red" }, + { "White Ombrellone", "white" }, + { "Orange Ombrellone", "orange" }, + { "Black Ombrellone", "black" }, + { "Yellow Ombrellone", "yellow" }, + { "Green Ombrellone", "green" }, + { "Blue Ombrellone", "blue" }, + { "Violet Ombrellone", "violet" }, } for i in ipairs(Ombrellone_list) do local ombrellonedesc = Ombrellone_list[i][1] local colour = Ombrellone_list[i][2] - - minetest.register_node("summer:ombrellone_"..colour.."", { - description = ombrellonedesc.."", - drawtype = "mesh", - mesh = "omb_o.obj", - tiles = {"ball_"..colour..".png", - }, - inventory_image = "ombo_"..colour.."_q.png", - - wield_image = "ombo_"..colour.."_q.png", - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - walkable = false, - selection_box = { - type = "fixed", - fixed = { -0.25, -0.5, -0.25, 0.25,0.5, 0.25 }, - }, - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=0}, + + minetest.register_node("summer:ombrellone_" .. colour .. "", { + description = ombrellonedesc .. "", + drawtype = "mesh", + mesh = "omb_o.obj", + tiles = { "ball_" .. colour .. ".png", + }, + inventory_image = "ombo_" .. colour .. "_q.png", + + wield_image = "ombo_" .. colour .. "_q.png", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = { -0.25, -0.5, -0.25, 0.25, 0.5, 0.25 }, + }, + groups = { snappy = 2, cracky = 3, oddly_breakable_by_hand = 3, not_in_creative_inventory = 0 }, --sounds = default.node_sound_glass_defaults(), - drop = "summer:ombrellone_"..colour.."_ch", - on_rightclick = function(pos, node, clicker) - node.name = "summer:ombrellone_"..colour.."_ch" - minetest.set_node(pos, node) - end, + drop = "summer:ombrellone_" .. colour .. "_ch", + on_rightclick = function(pos, node, clicker) + node.name = "summer:ombrellone_" .. colour .. "_ch" + minetest.set_node(pos, node) + end, }) -minetest.register_node("summer:ombrellone_"..colour.."_ch", { - description = ombrellonedesc.." ch", - drawtype = "mesh", - mesh = "omb_c.obj", - tiles = {"ball_"..colour..".png", - }, - inventory_image = "ombc_"..colour.."_q.png", - - wield_image = "ombc_"..colour.."_q.png", - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - walkable = false, - selection_box = { - type = "fixed", - fixed = { -0.25, -0.5, -0.25, 0.25,0.5, 0.25 }, - }, - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=0}, + minetest.register_node("summer:ombrellone_" .. colour .. "_ch", { + description = ombrellonedesc .. " ch", + drawtype = "mesh", + mesh = "omb_c.obj", + tiles = { "ball_" .. colour .. ".png", + }, + inventory_image = "ombc_" .. colour .. "_q.png", + + wield_image = "ombc_" .. colour .. "_q.png", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = { -0.25, -0.5, -0.25, 0.25, 0.5, 0.25 }, + }, + groups = { snappy = 2, cracky = 3, oddly_breakable_by_hand = 3, not_in_creative_inventory = 0 }, --sounds = default.node_sound_glass_defaults(), - drop = "summer:ombrellone_"..colour, - on_rightclick = function(pos, node, clicker) - node.name = "summer:ombrellone_"..colour.."" - minetest.set_node(pos, node) - end, + drop = "summer:ombrellone_" .. colour, + on_rightclick = function(pos, node, clicker) + node.name = "summer:ombrellone_" .. colour .. "" + minetest.set_node(pos, node) + end, }) - - end diff --git a/ombrellone_new.lua b/ombrellone_new.lua index eb49e68..d062671 100644 --- a/ombrellone_new.lua +++ b/ombrellone_new.lua @@ -1,69 +1,68 @@ local Ombrellone_n_list = { - { "Red Ombrellone_n", "red"}, - { "Orange Ombrellone_n", "orange"}, - { "Black Ombrellone_n", "black"}, - { "Yellow Ombrellone_n", "yellow"}, - { "Green Ombrellone_n", "green"}, - { "Blue Ombrellone_n", "blue"}, - { "Violet Ombrellone_n", "violet"}, - { "White Ombrellone_n", "white"}, + { "Red Ombrellone_n", "red" }, + { "Orange Ombrellone_n", "orange" }, + { "Black Ombrellone_n", "black" }, + { "Yellow Ombrellone_n", "yellow" }, + { "Green Ombrellone_n", "green" }, + { "Blue Ombrellone_n", "blue" }, + { "Violet Ombrellone_n", "violet" }, + { "White Ombrellone_n", "white" }, } for i in ipairs(Ombrellone_n_list) do local Ombrellone_ndesc = Ombrellone_n_list[i][1] local colour = Ombrellone_n_list[i][2] - - minetest.register_node("summer:ombrellone_n_"..colour.."", { - description = Ombrellone_ndesc.."", - drawtype = "mesh", - mesh = "omb_n_o.obj", - tiles = {"Ombrellone_n_"..colour..".png", - }, - inventory_image = "ombo_"..colour.."_r.png", - - wield_image = "ombo_"..colour.."_r.png" , - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - walkable = false, - selection_box = { - type = "fixed", - fixed = { -0.25, -0.5, -0.25, 0.25,0.5, 0.25 }, - }, - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory = 0}, + + minetest.register_node("summer:ombrellone_n_" .. colour .. "", { + description = Ombrellone_ndesc .. "", + drawtype = "mesh", + mesh = "omb_n_o.obj", + tiles = { "Ombrellone_n_" .. colour .. ".png", + }, + inventory_image = "ombo_" .. colour .. "_r.png", + + wield_image = "ombo_" .. colour .. "_r.png", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = { -0.25, -0.5, -0.25, 0.25, 0.5, 0.25 }, + }, + groups = { snappy = 2, cracky = 3, oddly_breakable_by_hand = 3, not_in_creative_inventory = 0 }, --sounds = default.node_sound_glass_defaults(), - drop = "summer:ombrellone_n_"..colour.."_ch", - on_rightclick = function(pos, node, clicker) - node.name = "summer:Ombrellone_n_"..colour.."_ch" - minetest.set_node(pos, node) - end, + drop = "summer:ombrellone_n_" .. colour .. "_ch", + on_rightclick = function(pos, node, clicker) + node.name = "summer:Ombrellone_n_" .. colour .. "_ch" + minetest.set_node(pos, node) + end, }) -minetest.register_node("summer:ombrellone_n_"..colour.."_ch", { - description = Ombrellone_ndesc.." ch", - drawtype = "mesh", - mesh = "omb_n_c.obj", - tiles = {"Ombrellone_n_"..colour..".png", - }, - inventory_image = "ombc_"..colour.."_r.png", - - wield_image = "ombc_"..colour.."_r.png", - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - walkable = false, - selection_box = { - type = "fixed", - fixed = { -0.25, -0.5, -0.25, 0.25,0.5, 0.25 }, - }, - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=0}, + minetest.register_node("summer:ombrellone_n_" .. colour .. "_ch", { + description = Ombrellone_ndesc .. " ch", + drawtype = "mesh", + mesh = "omb_n_c.obj", + tiles = { "Ombrellone_n_" .. colour .. ".png", + }, + inventory_image = "ombc_" .. colour .. "_r.png", + + wield_image = "ombc_" .. colour .. "_r.png", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = { -0.25, -0.5, -0.25, 0.25, 0.5, 0.25 }, + }, + groups = { snappy = 2, cracky = 3, oddly_breakable_by_hand = 3, not_in_creative_inventory = 0 }, --sounds = default.node_sound_glass_defaults(), - drop = "summer:ombrellone_n_"..colour, - on_rightclick = function(pos, node, clicker) - node.name = "summer:Ombrellone_n_"..colour.."" - minetest.set_node(pos, node) - end, + drop = "summer:ombrellone_n_" .. colour, + on_rightclick = function(pos, node, clicker) + node.name = "summer:Ombrellone_n_" .. colour .. "" + minetest.set_node(pos, node) + end, }) end - diff --git a/pallone.lua b/pallone.lua index d909621..9f238d2 100644 --- a/pallone.lua +++ b/pallone.lua @@ -2,18 +2,17 @@ local CALCIO = 0.1 local function reg_ball(color) - - local ball_item_name = "summer:ball_"..color.."_item" - local ball_ent_name = "summer:ball_"..color.."_entity" + local ball_item_name = "summer:ball_" .. color .. "_item" + local ball_ent_name = "summer:ball_" .. color .. "_entity" minetest.register_entity(ball_ent_name, { physical = true, visual = "mesh", mesh = "ball.obj", hp_max = 1000, - liquids_pointable = true, + liquids_pointable = true, groups = { immortal = true }, - textures = { "ball_"..color..".png" }, + textures = { "ball_" .. color .. ".png" }, collisionbox = { -0.2, -0.2, -0.2, 0.2, 0.2, 0.2 }, --{ -1, -1, -1, 1, 1, 1 }, timer = 0, @@ -21,7 +20,7 @@ local function reg_ball(color) on_step = function(self, dtime) self.timer = self.timer + dtime if self.timer >= CALCIO then - self.object:setacceleration({x=0, y=-10, z=0}) + self.object:setacceleration({ x = 0, y = -10, z = 0 }) self.timer = 0 local vel = self.object:getvelocity() local p = self.object:getpos(); @@ -31,8 +30,8 @@ local function reg_ball(color) if vel.y < 0 then vel.y = vel.y * -0.65 end vel.z = vel.z * 0.90 end - if (math.abs(vel.x) < 0.1) - and (math.abs(vel.z) < 0.1) then + if (math.abs(vel.x) < 0.1) + and (math.abs(vel.z) < 0.1) then vel.x = 0 vel.z = 0 end @@ -40,8 +39,8 @@ local function reg_ball(color) local pos = self.object:getpos() local objs = minetest.env:get_objects_inside_radius(pos, 1) local player_count = 0 - local final_dir = { x=0, y=0, z=0 } - for _,obj in ipairs(objs) do + local final_dir = { x = 0, y = 0, z = 0 } + for _, obj in ipairs(objs) do if obj:is_player() then local objdir = obj:get_look_dir() local mul = 1 @@ -73,8 +72,8 @@ local function reg_ball(color) is_moving = function(self) local v = self.object:getvelocity() - if (math.abs(v.x) <= 0.1) - and (math.abs(v.z) <= 0.1) then + if (math.abs(v.x) <= 0.1) + and (math.abs(v.z) <= 0.1) then v.x = 0 v.z = 0 self.object:setvelocity(v) @@ -84,48 +83,47 @@ local function reg_ball(color) end, }) - minetest.register_craftitem(ball_item_name,{ - description = "Summer Ball ("..color..")", - inventory_image = "summer_ball_"..color.."_inv.png", + minetest.register_craftitem(ball_item_name, { + description = "Summer Ball (" .. color .. ")", + inventory_image = "summer_ball_" .. color .. "_inv.png", on_place = function(itemstack, placer, pointed_thing) local pos = pointed_thing.above --pos = { x=pos.x+0.5, y=pos.y, z=pos.z+0.5 } local ent = minetest.env:add_entity(pos, ball_ent_name) - ent:setvelocity({x=0, y=-15, z=0}) + ent:setvelocity({ x = 0, y = -15, z = 0 }) itemstack:take_item() return itemstack end, }) - -minetest.register_craft({ - output = ball_item_name, - recipe = { - { "default:paper", "group:leaves", "default:paper" }, - { "group:leaves", "wool:"..color, "group:leaves" }, - { "default:paper", "group:leaves", "default:paper" }, - }, - }) - - -if minetest.get_modpath("cannabis") then minetest.register_craft({ output = ball_item_name, recipe = { - { "", "cannabis:canapa_plastic", "" }, - { "cannabis:canapa_plastic", "wool:"..color, "cannabis:canapa_plastic" }, - { "", "cannabis:canapa_plastic", "" }, + { "default:paper", "group:leaves", "default:paper" }, + { "group:leaves", "wool:" .. color, "group:leaves" }, + { "default:paper", "group:leaves", "default:paper" }, }, }) -end + + + if minetest.get_modpath("cannabis") then + minetest.register_craft({ + output = ball_item_name, + recipe = { + { "", "cannabis:canapa_plastic", "" }, + { "cannabis:canapa_plastic", "wool:" .. color, "cannabis:canapa_plastic" }, + { "", "cannabis:canapa_plastic", "" }, + }, + }) + end end colors = { - "black", "red", "green", "blue", "yellow", "violet","orange" + "black", "red", "green", "blue", "yellow", "violet", "orange" } -for _,color in ipairs(colors) do +for _, color in ipairs(colors) do reg_ball(color) end diff --git a/pietra.lua b/pietra.lua index c30bb4b..49791b7 100644 --- a/pietra.lua +++ b/pietra.lua @@ -1,94 +1,94 @@ --ROCCIA -minetest.register_alias("desert_roccia_1","desert_roccia") -minetest.register_alias("roccia_1","roccia") +minetest.register_alias("desert_roccia_1", "desert_roccia") +minetest.register_alias("roccia_1", "roccia") minetest.register_node("summer:roccia_1", { - description = "Roccia", - drawtype = "mesh", - mesh = "roccia.obj", - tiles = {"roccia.png"}, - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - walkable = true, - groups = {cracky = 3, stone = 1}, + description = "Roccia", + drawtype = "mesh", + mesh = "roccia.obj", + tiles = { "roccia.png" }, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = true, + groups = { cracky = 3, stone = 1 }, drop = '"summer:pietra" 5', - selection_box = { - type = "fixed", - fixed = { -0.5, -0.5,-0.5, 0.5,0.1, 0.5 }, - }, - on_place = function(itemstack, placer, pointed_thing) + selection_box = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 0.5, 0.1, 0.5 }, + }, + on_place = function(itemstack, placer, pointed_thing) -- place a random pebble node - local stack = ItemStack("summer:roccia_"..math.random(1,2)) + local stack = ItemStack("summer:roccia_" .. math.random(1, 2)) local ret = minetest.item_place(stack, placer, pointed_thing) - return ItemStack("summer:roccia_1 "..itemstack:get_count()-(1-ret:get_count())) - end,--legacy_mineral = true, + return ItemStack("summer:roccia_1 " .. itemstack:get_count() - (1 - ret:get_count())) + end, --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), - + }) minetest.register_node("summer:desert_roccia_1", { - description = "Desert Roccia", - drawtype = "mesh", - mesh = "desert_roccia.obj", - tiles = {"desert_roccia.png"}, - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - walkable = true, - groups = {cracky = 3, stone = 1}, + description = "Desert Roccia", + drawtype = "mesh", + mesh = "desert_roccia.obj", + tiles = { "desert_roccia.png" }, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = true, + groups = { cracky = 3, stone = 1 }, drop = '"summer:desert_pietra" 5', - selection_box = { - type = "fixed", - fixed = { -0.5, -0.5,-0.5, 0.5,0.1, 0.5 }, - }, - on_place = function(itemstack, placer, pointed_thing) + selection_box = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 0.5, 0.1, 0.5 }, + }, + on_place = function(itemstack, placer, pointed_thing) -- place a random pebble node - local stack = ItemStack("summer:desert_roccia_"..math.random(1,2)) + local stack = ItemStack("summer:desert_roccia_" .. math.random(1, 2)) local ret = minetest.item_place(stack, placer, pointed_thing) - return ItemStack("summer:desert_roccia_1 "..itemstack:get_count()-(1-ret:get_count())) + return ItemStack("summer:desert_roccia_1 " .. itemstack:get_count() - (1 - ret:get_count())) end, --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), - + }) minetest.register_node("summer:roccia_2", { - description = "Roccia", - drawtype = "mesh", - mesh = "roccia.obj", - tiles = {"roccia.png"}, - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - walkable = true, - groups = {cracky=3, stone=1, not_in_creative_inventory=1}, + description = "Roccia", + drawtype = "mesh", + mesh = "roccia.obj", + tiles = { "roccia.png" }, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = true, + groups = { cracky = 3, stone = 1, not_in_creative_inventory = 1 }, drop = '"summer:pietra" 5', - selection_box = { - type = "fixed", - fixed = { -0.5, -0.5,-0.5, 0.5,0.1, 0.5 }, - }, - --legacy_mineral = true, + selection_box = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 0.5, 0.1, 0.5 }, + }, + --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), - + }) minetest.register_node("summer:desert_roccia_2", { - description = "Desert Roccia", - drawtype = "mesh", - mesh = "desert_roccia.obj", - tiles = {"desert_roccia.png"}, - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - walkable = true, - groups = {cracky=3, stone=1, not_in_creative_inventory=1}, + description = "Desert Roccia", + drawtype = "mesh", + mesh = "desert_roccia.obj", + tiles = { "desert_roccia.png" }, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = true, + groups = { cracky = 3, stone = 1, not_in_creative_inventory = 1 }, drop = '"summer:desert_pietra" 5', - selection_box = { - type = "fixed", - fixed = { -0.5, -0.5,-0.5, 0.5,0.1, 0.5 }, - }, + selection_box = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 0.5, 0.1, 0.5 }, + }, --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), - + }) --MAPGEN minetest.register_on_generated(function(minp, maxp, seed) @@ -97,94 +97,98 @@ minetest.register_on_generated(function(minp, maxp, seed) local perlin1 = minetest.get_perlin(329, 3, 0.6, 100) -- Assume X and Z lengths are equal local divlen = 16 - local divs = (maxp.x-minp.x)/divlen+1; - for divx=0,divs-1 do - for divz=0,divs-1 do - local x0 = minp.x + math.floor((divx+0)*divlen) - local z0 = minp.z + math.floor((divz+0)*divlen) - local x1 = minp.x + math.floor((divx+1)*divlen) - local z1 = minp.z + math.floor((divz+1)*divlen) - -- Determine roccia amount from perlin noise - local roccia_amount = math.floor(perlin1:get2d({x=x0, y=z0}) ^ 2 * 2) - -- Find random positions for roccias based on this random - local pr = PseudoRandom(seed+1) - for i=0,roccia_amount do - local x = pr:next(x0, x1) - local z = pr:next(z0, z1) - -- Find ground level (0...15) - local ground_y = nil - for y=30,0,-1 do - if minetest.get_node({x=x,y=y,z=z}).name ~= "air" then - ground_y = y - break + local divs = (maxp.x - minp.x) / divlen + 1; + for divx = 0, divs - 1 do + for divz = 0, divs - 1 do + local x0 = minp.x + math.floor((divx + 0) * divlen) + local z0 = minp.z + math.floor((divz + 0) * divlen) + local x1 = minp.x + math.floor((divx + 1) * divlen) + local z1 = minp.z + math.floor((divz + 1) * divlen) + -- Determine roccia amount from perlin noise + local roccia_amount = math.floor(perlin1:get2d({ x = x0, y = z0 }) ^ 2 * 2) + -- Find random positions for roccias based on this random + local pr = PseudoRandom(seed + 1) + for i = 0, roccia_amount do + local x = pr:next(x0, x1) + local z = pr:next(z0, z1) + -- Find ground level (0...15) + local ground_y = nil + for y = 30, 0, -1 do + if minetest.get_node({ x = x, y = y, z = z }).name ~= "air" then + ground_y = y + break + end + end + + if ground_y then + local p = { x = x, y = ground_y + 1, z = z } + local nn = minetest.get_node(p).name + -- Check if the node can be replaced + if minetest.registered_nodes[nn] and + minetest.registered_nodes[nn].buildable_to then + nn = minetest.get_node({ x = x, y = ground_y, z = z }).name + -- If desert sand, add dry shrub + if nn == "default:dirt_with_grass" then + minetest.set_node(p, { + name = "summer:roccia_" .. pr:next(1, 2), + param2 = math.random(0, + 3) + }) + elseif nn == "default:desert_sand" then + minetest.set_node(p, + { name = "summer:desert_roccia_" .. pr:next(1, 2), param2 = math.random(0, 3) }) + end + end end end - - if ground_y then - local p = {x=x,y=ground_y+1,z=z} - local nn = minetest.get_node(p).name - -- Check if the node can be replaced - if minetest.registered_nodes[nn] and - minetest.registered_nodes[nn].buildable_to then - nn = minetest.get_node({x=x,y=ground_y,z=z}).name - -- If desert sand, add dry shrub - if nn == "default:dirt_with_grass" then - minetest.set_node(p,{name="summer:roccia_"..pr:next(1,2), param2=math.random(0,3)}) - elseif nn == "default:desert_sand" then - minetest.set_node(p,{name="summer:desert_roccia_"..pr:next(1,2), param2=math.random(0,3)}) - end - end - end - end end - end end end) - - - --craft PIETRA - minetest.register_craft({ - output = '"summer:pietraA" 2', - recipe = { - { "", "", "" }, - { "", "", "" }, - { "summer:pietra", "summer:desert_pietra", "" }, - }, - }) - minetest.register_craft({ - output = '"summer:pietraP" 2', - recipe = { - { "", "", "" }, - { "", "", "" }, - { "summer:pietraA", "summer:desert_pietra", "" }, - }, - }) - - - --craftitem PIETRA + + +--craft PIETRA +minetest.register_craft({ + output = '"summer:pietraA" 2', + recipe = { + { "", "", "" }, + { "", "", "" }, + { "summer:pietra", "summer:desert_pietra", "" }, + }, +}) +minetest.register_craft({ + output = '"summer:pietraP" 2', + recipe = { + { "", "", "" }, + { "", "", "" }, + { "summer:pietraA", "summer:desert_pietra", "" }, + }, +}) + + +--craftitem PIETRA minetest.register_craftitem("summer:desert_pietra", { description = "Desert Pietra", inventory_image = "desert_pietra.png", - + }) - minetest.register_craftitem("summer:pietraA", { +minetest.register_craftitem("summer:pietraA", { description = "pietraA", inventory_image = "pietraA.png", - + }) minetest.register_craftitem("summer:pietra", { description = "pietra", inventory_image = "pietra.png", - + }) - minetest.register_craftitem("summer:pietraP", { +minetest.register_craftitem("summer:pietraP", { description = "pietraP", inventory_image = "pietraP.png", - + }) - -- craftitem MATTONE +-- craftitem MATTONE diff --git a/porta.lua b/porta.lua index 742bc76..be0e728 100644 --- a/porta.lua +++ b/porta.lua @@ -1,12 +1,11 @@ - local Porta_list = { - { "Red Door", "red"}, - { "Orange Door", "orange"}, - { "Black Door", "black"}, - { "Yellow Door", "yellow"}, - { "Green Door", "green"}, - { "Blue Door", "blue"}, - { "Violet Door", "violet"}, + { "Red Door", "red" }, + { "Orange Door", "orange" }, + { "Black Door", "black" }, + { "Yellow Door", "yellow" }, + { "Green Door", "green" }, + { "Blue Door", "blue" }, + { "Violet Door", "violet" }, } --[[ { S("Red Door"), "red"}, { S("Orange Door"), "orange"}, @@ -19,84 +18,81 @@ local Porta_list = { for i in ipairs(Porta_list) do local portadesc = Porta_list[i][1] local colour = Porta_list[i][2] - - minetest.register_node("summer:porta_"..colour.."", { - description = portadesc.."", - drawtype = "mesh", - mesh = "porta_2.obj", - tiles = {"porta_"..colour..".png", - }, - inventory_image = "summer_p_"..colour..".png", - - wield_image = "summer_p_"..colour..".png", - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - walkable = true, - selection_box = { - type = "fixed", - fixed = { -0.40, -0.5,-0.5,- 0.5,1.5, 0.5 }, - }, - collision_box = { - type = "fixed", - fixed = { -0.40, -0.5,-0.5,- 0.5,1.5, 0.5 }, - }, - - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=1}, - sounds = default.node_sound_wood_defaults(), - --sound_close="summer_porta_ch", - drop = "summer:porta_"..colour.."_ch", - on_rightclick = function(pos, node, clicker) - node.name = "summer:porta_"..colour.."_ch" - minetest.set_node(pos, node) - - minetest.sound_play("summer_porta_ch", { + + minetest.register_node("summer:porta_" .. colour .. "", { + description = portadesc .. "", + drawtype = "mesh", + mesh = "porta_2.obj", + tiles = { "porta_" .. colour .. ".png", + }, + inventory_image = "summer_p_" .. colour .. ".png", + + wield_image = "summer_p_" .. colour .. ".png", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = true, + selection_box = { + type = "fixed", + fixed = { -0.40, -0.5, -0.5, -0.5, 1.5, 0.5 }, + }, + collision_box = { + type = "fixed", + fixed = { -0.40, -0.5, -0.5, -0.5, 1.5, 0.5 }, + }, + + groups = { snappy = 2, cracky = 3, oddly_breakable_by_hand = 3, not_in_creative_inventory = 1 }, + sounds = default.node_sound_wood_defaults(), + --sound_close="summer_porta_ch", + drop = "summer:porta_" .. colour .. "_ch", + on_rightclick = function(pos, node, clicker) + node.name = "summer:porta_" .. colour .. "_ch" + minetest.set_node(pos, node) + + minetest.sound_play("summer_porta_ch", { to_player = "", gain = 0.1, pos = pos, max_hear_distance = 16, - }) - end, - }) - - -minetest.register_node("summer:porta_"..colour.."_ch", { - description = portadesc.." ch", - drawtype = "mesh", - mesh = "porta.obj", - tiles = {"porta_"..colour..".png", - }, - inventory_image = "summer_p_"..colour..".png", - - wield_image = "summer_p_"..colour..".png", - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - walkable = true, - selection_box = { - type = "fixed", - fixed = { -0.5, -0.5, 0.40, 0.5,1.5, 0.5}, - }, - collision_box = { - type = "fixed", - fixed = { -0.5, -0.5, 0.40, 0.5,1.5, 0.5}, - }, - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=0}, - sounds = default.node_sound_wood_defaults(), - - drop = "summer:porta_"..colour.."_ch", - on_rightclick = function(pos, node, clicker) - node.name = "summer:porta_"..colour.."" - minetest.set_node(pos, node) - minetest.sound_play("summer_porta_op", { - to_player = "", - gain = 0.1, - pos = pos, - max_hear_distance = 16, }) - end, + end, }) - + minetest.register_node("summer:porta_" .. colour .. "_ch", { + description = portadesc .. " ch", + drawtype = "mesh", + mesh = "porta.obj", + tiles = { "porta_" .. colour .. ".png", + }, + inventory_image = "summer_p_" .. colour .. ".png", + + wield_image = "summer_p_" .. colour .. ".png", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = true, + selection_box = { + type = "fixed", + fixed = { -0.5, -0.5, 0.40, 0.5, 1.5, 0.5 }, + }, + collision_box = { + type = "fixed", + fixed = { -0.5, -0.5, 0.40, 0.5, 1.5, 0.5 }, + }, + groups = { snappy = 2, cracky = 3, oddly_breakable_by_hand = 3, not_in_creative_inventory = 0 }, + sounds = default.node_sound_wood_defaults(), + + drop = "summer:porta_" .. colour .. "_ch", + on_rightclick = function(pos, node, clicker) + node.name = "summer:porta_" .. colour .. "" + minetest.set_node(pos, node) + minetest.sound_play("summer_porta_op", { + to_player = "", + gain = 0.1, + pos = pos, + max_hear_distance = 16, + }) + end, + }) end diff --git a/portacenere.lua b/portacenere.lua index 5e1c4f5..f9bbd60 100644 --- a/portacenere.lua +++ b/portacenere.lua @@ -1,72 +1,70 @@ local Portacenere_list = { - { "Red Portacenere", "red"}, - { "Orange Portacenere", "orange"}, - { "Black Portacenere", "black"}, - { "Yellow Portacenere", "yellow"}, - { "Green Portacenere", "green"}, - { "Blue Portacenere", "blue"}, - { "Violet Portacenere", "violet"}, - { "White Portacenere", "white"}, + { "Red Portacenere", "red" }, + { "Orange Portacenere", "orange" }, + { "Black Portacenere", "black" }, + { "Yellow Portacenere", "yellow" }, + { "Green Portacenere", "green" }, + { "Blue Portacenere", "blue" }, + { "Violet Portacenere", "violet" }, + { "White Portacenere", "white" }, } for i in ipairs(Portacenere_list) do local Portaceneredesc = Portacenere_list[i][1] local colour = Portacenere_list[i][2] - - minetest.register_node("summer:Portacenere_"..colour.."", { - description = Portaceneredesc.."", - drawtype = "mesh", + + minetest.register_node("summer:Portacenere_" .. colour .. "", { + description = Portaceneredesc .. "", + drawtype = "mesh", mesh = "portacenere_o.obj", - tiles = {"portacenere_"..colour..".png", - }, - -- inventory_image = "summer_ombo_n_"..colour..".png", - - -- wield_image = {"summer_ombo_n_"..colour..".png", - --}, - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - walkable = false, - selection_box = { - type = "fixed", - fixed = { -0.130, -0.5, -0.130, 0.25,-0.25, 0}, - }, - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory = 0}, + tiles = { "portacenere_" .. colour .. ".png", + }, + -- inventory_image = "summer_ombo_n_"..colour..".png", + + -- wield_image = {"summer_ombo_n_"..colour..".png", + --}, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = { -0.130, -0.5, -0.130, 0.25, -0.25, 0 }, + }, + groups = { snappy = 2, cracky = 3, oddly_breakable_by_hand = 3, not_in_creative_inventory = 0 }, --sounds = default.node_sound_glass_defaults(), - drop = "summer:Portacenere_"..colour.."_ch", + drop = "summer:Portacenere_" .. colour .. "_ch", on_rightclick = function(pos, node, clicker) - node.name = "summer:Portacenere_"..colour.."_ch" - minetest.set_node(pos, node) - end, + node.name = "summer:Portacenere_" .. colour .. "_ch" + minetest.set_node(pos, node) + end, }) -minetest.register_node("summer:Portacenere_"..colour.."_ch", { - description = Portaceneredesc.." ch", - drawtype = "mesh", + minetest.register_node("summer:Portacenere_" .. colour .. "_ch", { + description = Portaceneredesc .. " ch", + drawtype = "mesh", mesh = "portacenere_c.obj", - tiles = {"portacenere_"..colour..".png", - }, - -- inventory_image = "summer_ombc_n_"..colour..".png", - - --wield_image = {"summer_ombc_n_"..colour..".png", - --}, - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - walkable = false, - selection_box = { - type = "fixed", - fixed = { -0.130, -0.5, -0.130, 0.25,-0.25, 0 }, - }, - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3, not_in_creative_inventory=1}, - --sounds = default.node_sound_glass_defaults(), - drop = "summer:Portacenere_"..colour.."ch", - on_rightclick = function(pos, node, clicker) - node.name = "summer:Portacenere_"..colour.."" - minetest.set_node(pos, node) - end, - }) + tiles = { "portacenere_" .. colour .. ".png", + }, + -- inventory_image = "summer_ombc_n_"..colour..".png", - + --wield_image = {"summer_ombc_n_"..colour..".png", + --}, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = { -0.130, -0.5, -0.130, 0.25, -0.25, 0 }, + }, + groups = { snappy = 2, cracky = 3, oddly_breakable_by_hand = 3, not_in_creative_inventory = 1 }, + --sounds = default.node_sound_glass_defaults(), + drop = "summer:Portacenere_" .. colour .. "ch", + on_rightclick = function(pos, node, clicker) + node.name = "summer:Portacenere_" .. colour .. "" + minetest.set_node(pos, node) + end, + }) end diff --git a/sabbia.lua b/sabbia.lua index ae9be2d..12a66e5 100644 --- a/sabbia.lua +++ b/sabbia.lua @@ -1,49 +1,49 @@ --_swap tool____________ minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing) - pos.y = pos.y - local name = minetest.get_node(pos).name - if name ~= "default:sand" - and name ~= "default:silver_sand" - and name ~= "default:desert_sand" then + pos.y = pos.y + local name = minetest.get_node(pos).name + if name ~= "default:sand" + and name ~= "default:silver_sand" + and name ~= "default:desert_sand" then return - end - pos.y = pos.y - if puncher:get_wielded_item():get_name() == "summer:rake" - then - minetest.remove_node(pos) - node.name = "summer:sabbia_mare" - minetest.set_node(pos, node) - - minetest.sound_play("summer_n_swap", { - to_player = "", - gain = 2.0,}) - -end - end ) + end + pos.y = pos.y + if puncher:get_wielded_item():get_name() == "summer:rake" + then + minetest.remove_node(pos) + node.name = "summer:sabbia_mare" + minetest.set_node(pos, node) + + minetest.sound_play("summer_n_swap", { + to_player = "", + gain = 2.0, + }) + end +end) --SABBIA minetest.register_node("summer:sabbia_mare", { description = "Sabbiamare", - tiles = {"sabbia_mare_2.png"}, + tiles = { "sabbia_mare_2.png" }, --groups = {crumbly = 2, falling_node = 1}, - --groups = {cracky = 3, stone = 1}, + --groups = {cracky = 3, stone = 1}, drop = 'summer:sabbia_mare', --legacy_mineral = true, -groups = {crumbly = 3, falling_node = 1, sand = 1}, + groups = { crumbly = 3, falling_node = 1, sand = 1 }, sounds = default.node_sound_sand_defaults(), --sounds = default.node_sound_stone_defaults(), }) minetest.register_tool("summer:rake", { - description = "rake", - inventory_image = "rake.png", - [[on_place = function(itemstack, user, pointed_thing) - minetest.sound_play("summer_n_swap_2", { + description = "rake", + inventory_image = "rake.png", + [[on_place = function(itemstack, user, pointed_thing) + minetest.sound_play("summer_n_swap_2", { to_player = user:get_player_name() , gain = 2.0 })]] - - + + }) diff --git a/salvag.lua b/salvag.lua index 2ca82c3..f3d8ae7 100644 --- a/salvag.lua +++ b/salvag.lua @@ -15,8 +15,8 @@ end local function get_velocity(v, yaw, y) local x = -math.sin(yaw) * v - local z = math.cos(yaw) * v - return {x = x, y = y, z = z} + local z = math.cos(yaw) * v + return { x = x, y = y, z = z } end @@ -24,247 +24,238 @@ local function get_v(v) return math.sqrt(v.x ^ 2 + v.z ^ 2) end local function reg_salvag(color) + local salvag_item_name = "summer:salvag_" .. color .. "_item" + local salvag_ent_name = "summer:salvag_" .. color .. "_entity" - local salvag_item_name = "summer:salvag_"..color.."_item" - local salvag_ent_name = "summer:salvag_"..color.."_entity" + -- + -- Boat entity + -- --- --- Boat entity --- + local salvag = { + physical = true, + collisionbox = { -0.5, -0.35, -0.5, 0.5, 0.3, 0.5 }, + visual = "mesh", + mesh = "salvagl.obj", + textures = { "summer_salvag_" .. color .. ".png" }, -local salvag = { - physical = true, - collisionbox = {-0.5, -0.35, -0.5, 0.5, 0.3, 0.5}, - visual = "mesh", - mesh = "salvagl.obj", - textures = {"summer_salvag_"..color..".png" }, - - driver = nil, - v = 0, - last_v = 0, - removed = false -} + driver = nil, + v = 0, + last_v = 0, + removed = false + } -function salvag.on_rightclick(self, clicker) - if not clicker or not clicker:is_player() then - return - end - local name = clicker:get_player_name() - if self.driver and clicker == self.driver then - self.driver = nil - clicker:set_detach() - default.player_attached[name] = false - default.player_set_animation(clicker, "stand" , 30) - local pos = clicker:getpos() - pos = {x = pos.x, y = pos.y + 0.2, z = pos.z} - minetest.after(0.1, function() - clicker:setpos(pos) - end) - elseif not self.driver then - local attach = clicker:get_attach() - if attach and attach:get_luaentity() then - local luaentity = attach:get_luaentity() - if luaentity.driver then - luaentity.driver = nil - end + function salvag.on_rightclick(self, clicker) + if not clicker or not clicker:is_player() then + return + end + local name = clicker:get_player_name() + if self.driver and clicker == self.driver then + self.driver = nil clicker:set_detach() + default.player_attached[name] = false + default.player_set_animation(clicker, "stand", 30) + local pos = clicker:getpos() + pos = { x = pos.x, y = pos.y + 0.2, z = pos.z } + minetest.after(0.1, function() + clicker:setpos(pos) + end) + elseif not self.driver then + local attach = clicker:get_attach() + if attach and attach:get_luaentity() then + local luaentity = attach:get_luaentity() + if luaentity.driver then + luaentity.driver = nil + end + clicker:set_detach() + end + self.driver = clicker + clicker:set_attach(self.object, "", + { x = 0, y = 11, z = -3 }, { x = 0, y = 0, z = 0 }) + default.player_attached[name] = true + minetest.after(0.2, function() + default.player_set_animation(clicker, "sit", 30) + end) + self.object:setyaw(clicker:get_look_yaw() - math.pi / 2) end - self.driver = clicker - clicker:set_attach(self.object, "", - {x = 0, y = 11, z = -3}, {x = 0, y = 0, z = 0}) - default.player_attached[name] = true - minetest.after(0.2, function() - default.player_set_animation(clicker, "sit" , 30) - end) - self.object:setyaw(clicker:get_look_yaw() - math.pi / 2) end -end - -function salvag.on_activate(self, staticdata, dtime_s) - self.object:set_armor_groups({immortal = 1}) - if staticdata then - self.v = tonumber(staticdata) + function salvag.on_activate(self, staticdata, dtime_s) + self.object:set_armor_groups({ immortal = 1 }) + if staticdata then + self.v = tonumber(staticdata) + end + self.last_v = self.v end - self.last_v = self.v -end - -function salvag.get_staticdata(self) - return tostring(self.v) -end - - -function salvag.on_punch(self, puncher) - if not puncher or not puncher:is_player() or self.removed then - return + function salvag.get_staticdata(self) + return tostring(self.v) end - if self.driver and puncher == self.driver then - self.driver = nil - puncher:set_detach() - default.player_attached[puncher:get_player_name()] = false - end - if not self.driver then - self.removed = true - -- delay remove to ensure player is detached - minetest.after(0.1, function() - self.object:remove() - end) - if not minetest.setting_getbool("creative_mode") then - local inv = puncher:get_inventory() - if inv:room_for_item("main", "summer:salvag_"..color.."_item") then - inv:add_item("main", "summer:salvag_"..color.."_item") - else - minetest.add_item(self.object:getpos(), salvag_item_name) + + function salvag.on_punch(self, puncher) + if not puncher or not puncher:is_player() or self.removed then + return + end + if self.driver and puncher == self.driver then + self.driver = nil + puncher:set_detach() + default.player_attached[puncher:get_player_name()] = false + end + if not self.driver then + self.removed = true + -- delay remove to ensure player is detached + minetest.after(0.1, function() + self.object:remove() + end) + if not minetest.setting_getbool("creative_mode") then + local inv = puncher:get_inventory() + if inv:room_for_item("main", "summer:salvag_" .. color .. "_item") then + inv:add_item("main", "summer:salvag_" .. color .. "_item") + else + minetest.add_item(self.object:getpos(), salvag_item_name) + end end end end -end - -function salvag.on_step(self, dtime) - self.v = get_v(self.object:getvelocity()) * get_sign(self.v) - if self.driver then - local ctrl = self.driver:get_player_control() - local yaw = self.object:getyaw() - if ctrl.up then - self.v = self.v + 0.1 - elseif ctrl.down then - self.v = self.v - 0.1 - end - if ctrl.left then - if self.v < 0 then - self.object:setyaw(yaw - (1 + dtime) * 0.03) - else - self.object:setyaw(yaw + (1 + dtime) * 0.03) + function salvag.on_step(self, dtime) + self.v = get_v(self.object:getvelocity()) * get_sign(self.v) + if self.driver then + local ctrl = self.driver:get_player_control() + local yaw = self.object:getyaw() + if ctrl.up then + self.v = self.v + 0.1 + elseif ctrl.down then + self.v = self.v - 0.1 end - elseif ctrl.right then - if self.v < 0 then - self.object:setyaw(yaw + (1 + dtime) * 0.03) - else - self.object:setyaw(yaw - (1 + dtime) * 0.03) + if ctrl.left then + if self.v < 0 then + self.object:setyaw(yaw - (1 + dtime) * 0.03) + else + self.object:setyaw(yaw + (1 + dtime) * 0.03) + end + elseif ctrl.right then + if self.v < 0 then + self.object:setyaw(yaw + (1 + dtime) * 0.03) + else + self.object:setyaw(yaw - (1 + dtime) * 0.03) + end end end - end - local velo = self.object:getvelocity() - if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then - self.object:setpos(self.object:getpos()) - return - 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) > 5 then - self.v = 5 * get_sign(self.v) - end - - local p = self.object:getpos() - p.y = p.y - 0.5 - local new_velo = {x = 0, y = 0, z = 0} - local new_acce = {x = 0, y = 0, z = 0} - if not is_water(p) then - local nodedef = minetest.registered_nodes[minetest.get_node(p).name] - if (not nodedef) or nodedef.walkable then + local velo = self.object:getvelocity() + if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then + self.object:setpos(self.object:getpos()) + return + 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 - new_acce = {x = 0, y = 1, z = 0} - else - new_acce = {x = 0, y = -9.8, z = 0} + return end - new_velo = get_velocity(self.v, self.object:getyaw(), - self.object:getvelocity().y) - self.object:setpos(self.object:getpos()) - else - p.y = p.y + 1 - if is_water(p) then - local y = self.object:getvelocity().y - if y >= 5 then - y = 5 - elseif y < 0 then - new_acce = {x = 0, y = 20, z = 0} + if math.abs(self.v) > 5 then + self.v = 5 * get_sign(self.v) + end + + local p = self.object:getpos() + p.y = p.y - 0.5 + local new_velo = { x = 0, y = 0, z = 0 } + local new_acce = { x = 0, y = 0, z = 0 } + if not is_water(p) then + local nodedef = minetest.registered_nodes[minetest.get_node(p).name] + if (not nodedef) or nodedef.walkable then + self.v = 0 + new_acce = { x = 0, y = 1, z = 0 } else - new_acce = {x = 0, y = 5, z = 0} + new_acce = { x = 0, y = -9.8, z = 0 } end - new_velo = get_velocity(self.v, self.object:getyaw(), y) + new_velo = get_velocity(self.v, self.object:getyaw(), + self.object:getvelocity().y) self.object:setpos(self.object:getpos()) else - new_acce = {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) - new_velo = get_velocity(self.v, self.object:getyaw(), 0) - else - new_velo = get_velocity(self.v, self.object:getyaw(), - self.object:getvelocity().y) + p.y = p.y + 1 + if is_water(p) then + local y = self.object:getvelocity().y + if y >= 5 then + y = 5 + elseif y < 0 then + new_acce = { x = 0, y = 20, z = 0 } + else + new_acce = { x = 0, y = 5, z = 0 } + end + new_velo = get_velocity(self.v, self.object:getyaw(), y) self.object:setpos(self.object:getpos()) + else + new_acce = { 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) + new_velo = get_velocity(self.v, self.object:getyaw(), 0) + else + new_velo = get_velocity(self.v, self.object:getyaw(), + self.object:getvelocity().y) + self.object:setpos(self.object:getpos()) + end end end + self.object:setvelocity(new_velo) + self.object:setacceleration(new_acce) end - self.object:setvelocity(new_velo) - self.object:setacceleration(new_acce) -end + + minetest.register_entity("summer:salvag_" .. color .. "", salvag) -minetest.register_entity("summer:salvag_"..color.."", salvag) + minetest.register_craftitem(salvag_item_name, { + description = "salvagente (" .. color .. ")", + inventory_image = "summer_salvag_" .. color .. "_inv.png", + wield_image = "summer_salvag_" .. color .. "_inv.png", + wield_scale = { x = 2, y = 2, z = 1 }, + liquids_pointable = true, - -minetest.register_craftitem(salvag_item_name, { - description = "salvagente ("..color..")", - inventory_image = "summer_salvag_"..color.."_inv.png", - wield_image = "summer_salvag_"..color.."_inv.png", - wield_scale = {x = 2, y = 2, z = 1}, - liquids_pointable = true, - - on_place = function(itemstack, placer, pointed_thing) - if pointed_thing.type ~= "node" then - return - end - if not is_water(pointed_thing.under) then - return - end - pointed_thing.under.y = pointed_thing.under.y + 0.5 - minetest.add_entity(pointed_thing.under, "summer:salvag_"..color.."") - if not minetest.setting_getbool("creative_mode") then - itemstack:take_item() - end - return itemstack - end, -}) -minetest.register_craft({ - output = salvag_item_name, - recipe = { - {"" , "" , "" }, - {"group:leaves", "wool:"..color, "group:leaves"}, - {"default:paper", "group:leaves", "default:paper"}, - }, -}) + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" then + return + end + if not is_water(pointed_thing.under) then + return + end + pointed_thing.under.y = pointed_thing.under.y + 0.5 + minetest.add_entity(pointed_thing.under, "summer:salvag_" .. color .. "") + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + return itemstack + end, + }) + minetest.register_craft({ + output = salvag_item_name, + recipe = { + { "", "", "" }, + { "group:leaves", "wool:" .. color, "group:leaves" }, + { "default:paper", "group:leaves", "default:paper" }, + }, + }) -if minetest.get_modpath("cannabis") then -minetest.register_craft({ - output = salvag_item_name, - recipe = { - {"" , "" , "" }, - {"cannabis:canapa_plastic", "wool:"..color, "cannabis:canapa_plastic"}, - {"cannabis:canapa_plastic", "cannabis:canapa_plastic", "cannabis:canapa_plastic"}, - }, -}) - -end + if minetest.get_modpath("cannabis") then + minetest.register_craft({ + output = salvag_item_name, + recipe = { + { "", "", "" }, + { "cannabis:canapa_plastic", "wool:" .. color, "cannabis:canapa_plastic" }, + { "cannabis:canapa_plastic", "cannabis:canapa_plastic", "cannabis:canapa_plastic" }, + }, + }) + end end colors = { - "black", "red", "green", "blue", "yellow", "violet","orange", + "black", "red", "green", "blue", "yellow", "violet", "orange", } -for _,color in ipairs(colors) do +for _, color in ipairs(colors) do reg_salvag(color) end - - diff --git a/sdraia.lua b/sdraia.lua index 64bd24d..cf2bf3c 100644 --- a/sdraia.lua +++ b/sdraia.lua @@ -1,23 +1,22 @@ - - local sdraia_list = { - { "Red sdraia", "red"}, - { "Orange sdraia", "orange"}, - { "Black sdraia", "black"}, - { "Yellow sdraia", "yellow"}, - { "Green sdraia", "green"}, - { "Blue sdraia", "blue"}, - { "Violet sdraia", "violet"}, +local sdraia_list = { + { "Red sdraia", "red" }, + { "Orange sdraia", "orange" }, + { "Black sdraia", "black" }, + { "Yellow sdraia", "yellow" }, + { "Green sdraia", "green" }, + { "Blue sdraia", "blue" }, + { "Violet sdraia", "violet" }, } for i in ipairs(sdraia_list) do local sdraiadesc = sdraia_list[i][1] local colour = sdraia_list[i][2] - local sleep_in_sdraia = function( pos, node, clicker, itemstack, pointed_thing ) - if( not( clicker ) or not( node ) or not( node.name ) or not( pos ) or not( minetest.allow_sit( clicker))) then + local sleep_in_sdraia = function(pos, node, clicker, itemstack, pointed_thing) + if (not (clicker) or not (node) or not (node.name) or not (pos) or not (minetest.allow_sit(clicker))) then return; end - local animation = default.player_get_animation( clicker ); + local animation = default.player_get_animation(clicker); local pname = clicker:get_player_name(); local place_name = 'place'; @@ -27,176 +26,174 @@ for i in ipairs(sdraia_list) do local new_animation = 'lay'; -- let players get back up - if( animation and animation.animation=="lay" ) then + if (animation and animation.animation == "lay") then default.player_attached[pname] = false - clicker:setpos({x=pos.x,y=pos.y-0.5,z=pos.z}) - clicker:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0}) - clicker:set_physics_override({1, 1, 1}) + clicker:setpos({ x = pos.x, y = pos.y - 0.5, z = pos.z }) + clicker:set_eye_offset({ x = 0, y = 0, z = 0 }, { x = 0, y = 0, z = 0 }) + clicker:set_physics_override({ 1, 1, 1 }) default.player_set_animation(clicker, "stand", 30) - minetest.chat_send_player( pname, 'You stand up again.'); + minetest.chat_send_player(pname, 'You stand up again.'); return; end - local second_node_pos = {x=pos.x, y=pos.y, z=pos.z}; + local second_node_pos = { x = pos.x, y = pos.y, z = pos.z }; -- the node that will contain the head of the player - local p = {x=pos.x, y=pos.y, z=pos.z}; + local p = { x = pos.x, y = pos.y, z = pos.z }; -- the player's head is pointing in this direction local dir = node.param2; -- it would be odd to sleep in half a sdraia - if( node.name=="summer:sdraia_"..colour.."" ) then - if( node.param2==0 ) then - second_node_pos.z = pos.z-1; - elseif( node.param2==1) then - second_node_pos.x = pos.x-1; - elseif( node.param2==2) then - second_node_pos.z = pos.z+1; - elseif( node.param2==3) then - second_node_pos.x = pos.x+1; + if (node.name == "summer:sdraia_" .. colour .. "") then + if (node.param2 == 0) then + second_node_pos.z = pos.z - 1; + elseif (node.param2 == 1) then + second_node_pos.x = pos.x - 1; + elseif (node.param2 == 2) then + second_node_pos.z = pos.z + 1; + elseif (node.param2 == 3) then + second_node_pos.x = pos.x + 1; end - local node2 = minetest.get_node( second_node_pos ); - if( not( node2 ) or not( node2.param2 ) or not( node.param2 ) - or node2.name ~= "summer:sdraia_"..colour.."" - or node2.param2 ~= node.param2 ) then + local node2 = minetest.get_node(second_node_pos); + if (not (node2) or not (node2.param2) or not (node.param2) + or node2.name ~= "summer:sdraia_" .. colour .. "" + or node2.param2 ~= node.param2) then allow_sleep = false; else allow_sleep = true; end - place_name = "sdraia_"..colour..""; + place_name = "sdraia_" .. colour .. ""; -- if the player clicked on the foot of the sdraia, locate the head - elseif( node.name=='summer:sdraia' ) then - if( node.param2==2 ) then - second_node_pos.z = pos.z-1; - elseif( node.param2==3) then - second_node_pos.x = pos.x-1; - elseif( node.param2==0) then - second_node_pos.z = pos.z+1; - elseif( node.param2==1) then - second_node_pos.x = pos.x+1; + elseif (node.name == 'summer:sdraia') then + if (node.param2 == 2) then + second_node_pos.z = pos.z - 1; + elseif (node.param2 == 3) then + second_node_pos.x = pos.x - 1; + elseif (node.param2 == 0) then + second_node_pos.z = pos.z + 1; + elseif (node.param2 == 1) then + second_node_pos.x = pos.x + 1; end - local node2 = minetest.get_node( second_node_pos ); - if( not( node2 ) or not( node2.param2 ) or not( node.param2 ) - or node2.name ~= 'summer:sdraia' - or node2.param2 ~= node.param2 ) then + local node2 = minetest.get_node(second_node_pos); + if (not (node2) or not (node2.param2) or not (node.param2) + or node2.name ~= 'summer:sdraia' + or node2.param2 ~= node.param2) then allow_sleep = false; else allow_sleep = true; end - if( allow_sleep==true ) then - p = {x=second_node_pos.x, y=second_node_pos.y, z=second_node_pos.z}; + if (allow_sleep == true) then + p = { x = second_node_pos.x, y = second_node_pos.y, z = second_node_pos.z }; end place_name = 'sdraia'; - - elseif( node.name=='summer:sleeping_mat' or node.name=='summer:straw_mat') then + elseif (node.name == 'summer:sleeping_mat' or node.name == 'summer:straw_mat') then place_name = 'mat'; dir = node.param2; allow_sleep = false; -- search for a second mat right next to this one - local offset = {{x=0,z=-1}, {x=-1,z=0}, {x=0,z=1}, {x=1,z=0}}; - for i,off in ipairs( offset ) do - node2 = minetest.get_node( {x=pos.x+off.x, y=pos.y, z=pos.z+off.z} ); - if( node2.name == 'summer:sleeping_mat' or node2.name=='summer:straw_mat' ) then + local offset = { { x = 0, z = -1 }, { x = -1, z = 0 }, { x = 0, z = 1 }, { x = 1, z = 0 } }; + for i, off in ipairs(offset) do + node2 = minetest.get_node({ x = pos.x + off.x, y = pos.y, z = pos.z + off.z }); + if (node2.name == 'summer:sleeping_mat' or node2.name == 'summer:straw_mat') then -- if a second mat is found, sleeping is possible allow_sleep = true; - dir = i-1; + dir = i - 1; end end end -- set the right height for the sdraia - if( place_name=='sdraia' ) then - p.y = p.y-0.4; + if (place_name == 'sdraia') then + p.y = p.y - 0.4; end - if( allow_sleep==true ) then + if (allow_sleep == true) then -- set the right position (middle of the sdraia) - if( dir==0 ) then - p.z = p.z-0.5; - elseif( dir==1 ) then - p.x = p.x-0.5; - elseif( dir==2 ) then - p.z = p.z+0.5; - elseif( dir==3 ) then - p.x = p.x+0.5; + if (dir == 0) then + p.z = p.z - 0.5; + elseif (dir == 1) then + p.x = p.x - 0.5; + elseif (dir == 2) then + p.z = p.z + 0.5; + elseif (dir == 3) then + p.x = p.x + 0.5; end end - if( default.player_attached[pname] and animation.animation=="sit") then + if (default.player_attached[pname] and animation.animation == "sit") then -- just changing the animation... - if( allow_sleep==true ) then + if (allow_sleep == true) then default.player_set_animation(clicker, "lay", 30) - clicker:set_eye_offset({x=0,y=-14,z=2}, {x=0,y=0,z=0}) - minetest.chat_send_player( pname, 'you lay A right-click will wake you up.'); + clicker:set_eye_offset({ x = 0, y = -14, z = 2 }, { x = 0, y = 0, z = 0 }) + minetest.chat_send_player(pname, 'you lay A right-click will wake you up.'); return; -- no sleeping on this place else default.player_attached[pname] = false - clicker:setpos({x=pos.x,y=pos.y-0.5,z=pos.z}) - clicker:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0}) - clicker:set_physics_override({1, 1, 1}) + clicker:setpos({ x = pos.x, y = pos.y - 0.5, z = pos.z }) + clicker:set_eye_offset({ x = 0, y = 0, z = 0 }, { x = 0, y = 0, z = 0 }) + clicker:set_physics_override({ 1, 1, 1 }) default.player_set_animation(clicker, "stand", 30) - minetest.chat_send_player( pname, 'That was enough sitting around for now. You stand up again.'); + minetest.chat_send_player(pname, 'That was enough sitting around for now. You stand up again.'); return; end end - clicker:set_eye_offset({x=0,y=3,z=2}, {x=0,y=3,z=0}) - clicker:setpos( p ); + clicker:set_eye_offset({ x = 0, y = 3, z = 2 }, { x = 0, y = 3, z = 0 }) + clicker:setpos(p); default.player_set_animation(clicker, new_animation, 30) - clicker:set_physics_override({0,0,0}) + clicker:set_physics_override({ 0, 0, 0 }) default.player_attached[pname] = true return; - end - - minetest.register_node("summer:sdraia_"..colour.."", { - description = sdraiadesc.."", - drawtype = "mesh", - mesh = "sdraia.obj", - tiles = {"sdraia_"..colour..".png", - }, - inventory_image = "sdraia_"..colour.."_inv.png", - - wield_image = "sdraia_"..colour..".png" , - paramtype = "light", - paramtype2 = "facedir", - selection_box = { - type = "fixed", - fixed = { 0.4, 0.1,1.0, -0.4,-0.49, -1.0 }, - }, - collision_box = { + + minetest.register_node("summer:sdraia_" .. colour .. "", { + description = sdraiadesc .. "", + drawtype = "mesh", + mesh = "sdraia.obj", + tiles = { "sdraia_" .. colour .. ".png", + }, + inventory_image = "sdraia_" .. colour .. "_inv.png", + + wield_image = "sdraia_" .. colour .. ".png", + paramtype = "light", + paramtype2 = "facedir", + selection_box = { + type = "fixed", + fixed = { 0.4, 0.1, 1.0, -0.4, -0.49, -1.0 }, + }, + collision_box = { type = "fixed", fixed = { - {0.4, 0.1,1.0, -0.4,-0.49, -1.0}, + { 0.4, 0.1, 1.0, -0.4, -0.49, -1.0 }, }, }, is_ground_content = false, - groups = {cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=0}, + groups = { cracky = 3, oddly_breakable_by_hand = 3, not_in_creative_inventory = 0 }, --sounds = default.node_sound_wood_defaults(), - drop = "summer:sdraia_"..colour.."", - on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) - return sleep_in_sdraia( pos, node, clicker, itemstack, pointed_thing ); - end - - - }) - + drop = "summer:sdraia_" .. colour .. "", + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + return sleep_in_sdraia(pos, node, clicker, itemstack, pointed_thing); + end - minetest.allow_sit = function( player ) + + }) + + + minetest.allow_sit = function(player) -- no check possible - if( not( player.get_player_velocity )) then + if (not (player.get_player_velocity)) then return true; end local velo = player:get_player_velocity(); - if( not( velo )) then + if (not (velo)) then return false; end local max_velo = 0.0010; - if( math.abs(velo.x) < max_velo - and math.abs(velo.y) < max_velo - and math.abs(velo.z) < max_velo ) then + if (math.abs(velo.x) < max_velo + and math.abs(velo.y) < max_velo + and math.abs(velo.z) < max_velo) then return true; end return false; diff --git a/summerstair.lua b/summerstair.lua index 7420376..d935d3a 100644 --- a/summerstair.lua +++ b/summerstair.lua @@ -7,23 +7,23 @@ minetest.register_node("summer:angstairA", { "graniteA.png", "graniteA.png", "graniteA.png", - "graniteA.png" + "graniteA.png" }, ---inventory_image = "s_s_A.png", + --inventory_image = "s_s_A.png", --wield_image = "s_s_A.png", drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", - node_box = { + paramtype2 = "facedir", + node_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0, 0.5, 0.5}, -- NodeBox1 - {-0.5, -0.5, 0, 0.5, 0.5, 0.5}, -- NodeBox2 - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- NodeBox3 + { -0.5, -0.5, -0.5, 0, 0.5, 0.5 }, -- NodeBox1 + { -0.5, -0.5, 0, 0.5, 0.5, 0.5 }, -- NodeBox2 + { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, -- NodeBox3 } }, - --material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + --material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='"summer:mattoneA" 7', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), @@ -33,34 +33,34 @@ minetest.register_node("summer:angstairA", { minetest.register_craft({ output = 'summer:angstairA', recipe = { - {'summer:mattoneA','summer:mattoneA',' '}, - {'summer:mattoneA','summer:mattoneA',' '}, - {'summer:mattoneA','summer:mattoneA','summer:mattoneA'}, + { 'summer:mattoneA', 'summer:mattoneA', ' ' }, + { 'summer:mattoneA', 'summer:mattoneA', ' ' }, + { 'summer:mattoneA', 'summer:mattoneA', 'summer:mattoneA' }, } }) minetest.register_node("summer:angstairA2", { -description = "Spigolo_scala_granito_bianco", + description = "Spigolo_scala_granito_bianco", tiles = { "graniteA.png", "graniteA.png", "graniteA.png", "graniteA.png", "graniteA.png", - "graniteA.png" + "graniteA.png" }, drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", + paramtype2 = "facedir", node_box = { type = "fixed", fixed = { - {-0.5, -0.5, 0, 0, 0.5, 0.5}, -- NodeBox2 - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- NodeBox3 + { -0.5, -0.5, 0, 0, 0.5, 0.5 }, -- NodeBox2 + { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, -- NodeBox3 } }, - -- material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + -- material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='summer:mattoneA 5', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), @@ -69,9 +69,9 @@ description = "Spigolo_scala_granito_bianco", minetest.register_craft({ output = 'summer:angstairA2', recipe = { - {' ','summer:mattoneA',' '}, - {' ','summer:mattoneA',' '}, - {'summer:mattoneA','summer:mattoneA','summer:mattoneA'}, + { ' ', 'summer:mattoneA', ' ' }, + { ' ', 'summer:mattoneA', ' ' }, + { 'summer:mattoneA', 'summer:mattoneA', 'summer:mattoneA' }, } }) minetest.register_node("summer:stairA", { @@ -86,17 +86,17 @@ minetest.register_node("summer:stairA", { }, drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", + paramtype2 = "facedir", node_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- Node1 - {-0.5, -0.5, 0, 0.5, 0.5, 0.5}, -- Node2 + { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, -- Node1 + { -0.5, -0.5, 0, 0.5, 0.5, 0.5 }, -- Node2 } }, - -- material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, --- drop ='summer:mattoneA 6', + -- material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, + -- drop ='summer:mattoneA 6', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), }) @@ -104,13 +104,13 @@ minetest.register_node("summer:stairA", { minetest.register_craft({ output = 'summer:stairA', recipe = { - {'summer:mattoneA',' ',' '}, - {'summer:mattoneA','summer:mattoneA',' '}, - {'summer:mattoneA','summer:mattoneA','summer:mattoneA'}, + { 'summer:mattoneA', ' ', ' ' }, + { 'summer:mattoneA', 'summer:mattoneA', ' ' }, + { 'summer:mattoneA', 'summer:mattoneA', 'summer:mattoneA' }, } }) minetest.register_node("summer:battiscopaA", { -description = "Battiscopa_granito_bianco", + description = "Battiscopa_granito_bianco", tiles = { "graniteA.png", "graniteA.png", @@ -121,18 +121,18 @@ description = "Battiscopa_granito_bianco", }, drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", + paramtype2 = "facedir", node_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, -- NodeBox3 - {-0.5, -0.5, -0.375, 0.5, 0.25, 0.5}, -- NodeBox4 - {-0.5, 0, -0.5, 0.5, 0.5, 0.5}, -- NodeBox5 + { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }, -- NodeBox3 + { -0.5, -0.5, -0.375, 0.5, 0.25, 0.5 }, -- NodeBox4 + { -0.5, 0, -0.5, 0.5, 0.5, 0.5 }, -- NodeBox5 } }, - -- material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, --- drop ='summer:mattoneA 8', + -- material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, + -- drop ='summer:mattoneA 8', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), }) @@ -140,9 +140,9 @@ description = "Battiscopa_granito_bianco", minetest.register_craft({ output = 'summer:battiscopaA', recipe = { - {'summer:mattoneA','summer:mattoneA','summer:mattoneA'}, - {'summer:mattoneA','summer:mattoneA',' '}, - {'summer:mattoneA','summer:mattoneA','summer:mattoneA'}, + { 'summer:mattoneA', 'summer:mattoneA', 'summer:mattoneA' }, + { 'summer:mattoneA', 'summer:mattoneA', ' ' }, + { 'summer:mattoneA', 'summer:mattoneA', 'summer:mattoneA' }, } }) minetest.register_node("summer:slabA", { @@ -157,17 +157,17 @@ minetest.register_node("summer:slabA", { }, drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", + paramtype2 = "facedir", node_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- Node1 - -- {-0.5, -0.5, 0, 0.5, 0.5, 0.5}, -- Node2 + { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, -- Node1 + -- {-0.5, -0.5, 0, 0.5, 0.5, 0.5}, -- Node2 } }, - -- material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, --- drop ='summer:mattoneA 6', + -- material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, + -- drop ='summer:mattoneA 6', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), }) @@ -175,9 +175,9 @@ minetest.register_node("summer:slabA", { minetest.register_craft({ output = 'summer:slabA', recipe = { - {' ',' ',' '}, - {' ',' ',' '}, - {'summer:mattoneA','summer:mattoneA','summer:mattoneA'}, + { ' ', ' ', ' ' }, + { ' ', ' ', ' ' }, + { 'summer:mattoneA', 'summer:mattoneA', 'summer:mattoneA' }, } }) --P @@ -190,23 +190,23 @@ minetest.register_node("summer:angstairP", { "graniteP.png", "graniteP.png", "graniteP.png", - "graniteP.png" + "graniteP.png" }, ---inventory_image = "s_s_P.png", + --inventory_image = "s_s_P.png", --wield_image = "s_s_P.png", drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", - node_box = { + paramtype2 = "facedir", + node_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0, 0.5, 0.5}, -- NodeBox1 - {-0.5, -0.5, 0, 0.5, 0.5, 0.5}, -- NodeBox2 - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- NodeBox3 + { -0.5, -0.5, -0.5, 0, 0.5, 0.5 }, -- NodeBox1 + { -0.5, -0.5, 0, 0.5, 0.5, 0.5 }, -- NodeBox2 + { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, -- NodeBox3 } }, - -- material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + -- material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='"summer:mattoneP" 7', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), @@ -216,35 +216,35 @@ minetest.register_node("summer:angstairP", { minetest.register_craft({ output = 'summer:angstairP', recipe = { - {'summer:mattoneP','summer:mattoneP',' '}, - {'summer:mattoneP','summer:mattoneP',' '}, - {'summer:mattoneP','summer:mattoneP','summer:mattoneP'}, + { 'summer:mattoneP', 'summer:mattoneP', ' ' }, + { 'summer:mattoneP', 'summer:mattoneP', ' ' }, + { 'summer:mattoneP', 'summer:mattoneP', 'summer:mattoneP' }, } }) minetest.register_node("summer:angstairP2", { -description = "Spigolo_scala_granito_rosa", + description = "Spigolo_scala_granito_rosa", tiles = { "graniteP.png", "graniteP.png", "graniteP.png", "graniteP.png", "graniteP.png", - "graniteP.png" + "graniteP.png" }, drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", + paramtype2 = "facedir", node_box = { type = "fixed", fixed = { - {-0.5, -0.5, 0, 0, 0.5, 0.5}, -- NodeBox2 - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- NodeBox3 + { -0.5, -0.5, 0, 0, 0.5, 0.5 }, -- NodeBox2 + { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, -- NodeBox3 } }, - -- material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, - drop ='summer:mattoneP 5', + -- material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, + drop = 'summer:mattoneP 5', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), }) @@ -252,9 +252,9 @@ description = "Spigolo_scala_granito_rosa", minetest.register_craft({ output = 'summer:angstairP2', recipe = { - {' ','summer:mattoneP',' '}, - {' ','summer:mattoneP',' '}, - {'summer:mattoneP','summer:mattoneP','summer:mattoneP'}, + { ' ', 'summer:mattoneP', ' ' }, + { ' ', 'summer:mattoneP', ' ' }, + { 'summer:mattoneP', 'summer:mattoneP', 'summer:mattoneP' }, } }) minetest.register_node("summer:stairP", { @@ -269,16 +269,16 @@ minetest.register_node("summer:stairP", { }, drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", + paramtype2 = "facedir", node_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- Node1 - {-0.5, -0.5, 0, 0.5, 0.5, 0.5}, -- Node2 + { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, -- Node1 + { -0.5, -0.5, 0, 0.5, 0.5, 0.5 }, -- Node2 } }, - -- material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + -- material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='summer:mattoneP 6', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), @@ -287,13 +287,13 @@ minetest.register_node("summer:stairP", { minetest.register_craft({ output = 'summer:stairP', recipe = { - {'summer:mattoneP',' ',' '}, - {'summer:mattoneP','summer:mattoneP',' '}, - {'summer:mattoneP','summer:mattoneP','summer:mattoneP'}, + { 'summer:mattoneP', ' ', ' ' }, + { 'summer:mattoneP', 'summer:mattoneP', ' ' }, + { 'summer:mattoneP', 'summer:mattoneP', 'summer:mattoneP' }, } }) minetest.register_node("summer:battiscopaP", { -description = "Battiscopa_granito_rosa", + description = "Battiscopa_granito_rosa", tiles = { "graniteP.png", "graniteP.png", @@ -304,17 +304,17 @@ description = "Battiscopa_granito_rosa", }, drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", + paramtype2 = "facedir", node_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, -- NodeBox3 - {-0.5, -0.5, -0.375, 0.5, 0.25, 0.5}, -- NodeBox4 - {-0.5, 0, -0.5, 0.5, 0.5, 0.5}, -- NodeBox5 + { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }, -- NodeBox3 + { -0.5, -0.5, -0.375, 0.5, 0.25, 0.5 }, -- NodeBox4 + { -0.5, 0, -0.5, 0.5, 0.5, 0.5 }, -- NodeBox5 } }, - -- material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + -- material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='summer:mattoneP 8', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), @@ -323,9 +323,9 @@ description = "Battiscopa_granito_rosa", minetest.register_craft({ output = 'summer:battiscopaP', recipe = { - {'summer:mattoneP','summer:mattoneP','summer:mattoneP'}, - {'summer:mattoneP','summer:mattoneP',' '}, - {'summer:mattoneP','summer:mattoneP','summer:mattoneP'}, + { 'summer:mattoneP', 'summer:mattoneP', 'summer:mattoneP' }, + { 'summer:mattoneP', 'summer:mattoneP', ' ' }, + { 'summer:mattoneP', 'summer:mattoneP', 'summer:mattoneP' }, } }) minetest.register_node("summer:slabP", { @@ -340,16 +340,16 @@ minetest.register_node("summer:slabP", { }, drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", + paramtype2 = "facedir", node_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- Node1 - -- {-0.5, -0.5, 0, 0.5, 0.5, 0.5}, -- Node2 + { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, -- Node1 + -- {-0.5, -0.5, 0, 0.5, 0.5, 0.5}, -- Node2 } }, - -- material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + -- material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='summer:mattoneP 6', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), @@ -358,9 +358,9 @@ minetest.register_node("summer:slabP", { minetest.register_craft({ output = 'summer:slabP', recipe = { - {' ',' ',' '}, - {' ',' ',' '}, - {'summer:mattoneP','summer:mattoneP','summer:mattoneP'}, + { ' ', ' ', ' ' }, + { ' ', ' ', ' ' }, + { 'summer:mattoneP', 'summer:mattoneP', 'summer:mattoneP' }, } }) --R @@ -373,24 +373,24 @@ minetest.register_node("summer:angstairR", { "graniteR.png", "graniteR.png", "graniteR.png", - "graniteR.png" + "graniteR.png" }, ---inventory_image = "s_s_R.png", + --inventory_image = "s_s_R.png", --wield_image = "s_s_R.png", drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", - node_box = { + paramtype2 = "facedir", + node_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0, 0.5, 0.5}, -- NodeBox1 - {-0.5, -0.5, 0, 0.5, 0.5, 0.5}, -- NodeBox2 - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- NodeBox3 + { -0.5, -0.5, -0.5, 0, 0.5, 0.5 }, -- NodeBox1 + { -0.5, -0.5, 0, 0.5, 0.5, 0.5 }, -- NodeBox2 + { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, -- NodeBox3 } }, - -- material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, - drop ='"summer:mattoneR" 7', + -- material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, + drop = '"summer:mattoneR" 7', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), @@ -399,34 +399,34 @@ minetest.register_node("summer:angstairR", { minetest.register_craft({ output = 'summer:angstairR', recipe = { - {'summer:mattoneR','summer:mattoneR',' '}, - {'summer:mattoneR','summer:mattoneR',' '}, - {'summer:mattoneR','summer:mattoneR','summer:mattoneR'}, + { 'summer:mattoneR', 'summer:mattoneR', ' ' }, + { 'summer:mattoneR', 'summer:mattoneR', ' ' }, + { 'summer:mattoneR', 'summer:mattoneR', 'summer:mattoneR' }, } }) minetest.register_node("summer:angstairR2", { -description = "Spigolo_scala_granito_rosso", + description = "Spigolo_scala_granito_rosso", tiles = { "graniteR.png", "graniteR.png", "graniteR.png", "graniteR.png", "graniteR.png", - "graniteR.png" + "graniteR.png" }, drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", + paramtype2 = "facedir", node_box = { type = "fixed", fixed = { - {-0.5, -0.5, 0, 0, 0.5, 0.5}, -- NodeBox2 - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- NodeBox3 + { -0.5, -0.5, 0, 0, 0.5, 0.5 }, -- NodeBox2 + { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, -- NodeBox3 } }, - -- material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + -- material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='summer:mattoneR 5', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), @@ -435,9 +435,9 @@ description = "Spigolo_scala_granito_rosso", minetest.register_craft({ output = 'summer:angstairR2', recipe = { - {' ','summer:mattoneR',' '}, - {' ','summer:mattoneR',' '}, - {'summer:mattoneR','summer:mattoneR','summer:mattoneR'}, + { ' ', 'summer:mattoneR', ' ' }, + { ' ', 'summer:mattoneR', ' ' }, + { 'summer:mattoneR', 'summer:mattoneR', 'summer:mattoneR' }, } }) minetest.register_node("summer:stairR", { @@ -452,16 +452,16 @@ minetest.register_node("summer:stairR", { }, drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", + paramtype2 = "facedir", node_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- Node1 - {-0.5, -0.5, 0, 0.5, 0.5, 0.5}, -- Node2 + { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, -- Node1 + { -0.5, -0.5, 0, 0.5, 0.5, 0.5 }, -- Node2 } }, - -- material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + -- material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='summer:mattoneR 6', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), @@ -470,13 +470,13 @@ minetest.register_node("summer:stairR", { minetest.register_craft({ output = 'summer:stairR', recipe = { - {'summer:mattoneR',' ',' '}, - {'summer:mattoneR','summer:mattoneR',' '}, - {'summer:mattoneR','summer:mattoneR','summer:mattoneR'}, + { 'summer:mattoneR', ' ', ' ' }, + { 'summer:mattoneR', 'summer:mattoneR', ' ' }, + { 'summer:mattoneR', 'summer:mattoneR', 'summer:mattoneR' }, } }) minetest.register_node("summer:battiscopaR", { -description = "Battiscopa_granito_rosso", + description = "Battiscopa_granito_rosso", tiles = { "graniteR.png", "graniteR.png", @@ -487,17 +487,17 @@ description = "Battiscopa_granito_rosso", }, drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", + paramtype2 = "facedir", node_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, -- NodeBox3 - {-0.5, -0.5, -0.375, 0.5, 0.25, 0.5}, -- NodeBox4 - {-0.5, 0, -0.5, 0.5, 0.5, 0.5}, -- NodeBox5 + { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }, -- NodeBox3 + { -0.5, -0.5, -0.375, 0.5, 0.25, 0.5 }, -- NodeBox4 + { -0.5, 0, -0.5, 0.5, 0.5, 0.5 }, -- NodeBox5 } }, - -- material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + -- material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='summer:mattoneR 8', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), @@ -506,9 +506,9 @@ description = "Battiscopa_granito_rosso", minetest.register_craft({ output = 'summer:battiscopaR', recipe = { - {'summer:mattoneR','summer:mattoneR','summer:mattoneR'}, - {'summer:mattoneR','summer:mattoneR',' '}, - {'summer:mattoneR','summer:mattoneR','summer:mattoneR'}, + { 'summer:mattoneR', 'summer:mattoneR', 'summer:mattoneR' }, + { 'summer:mattoneR', 'summer:mattoneR', ' ' }, + { 'summer:mattoneR', 'summer:mattoneR', 'summer:mattoneR' }, } }) minetest.register_node("summer:slabR", { @@ -523,16 +523,16 @@ minetest.register_node("summer:slabR", { }, drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", + paramtype2 = "facedir", node_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- Node1 - -- {-0.5, -0.5, 0, 0.5, 0.5, 0.5}, -- Node2 + { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, -- Node1 + -- {-0.5, -0.5, 0, 0.5, 0.5, 0.5}, -- Node2 } }, - -- material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + -- material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='summer:mattoneR 6', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), @@ -541,9 +541,9 @@ minetest.register_node("summer:slabR", { minetest.register_craft({ output = 'summer:slabR', recipe = { - {' ',' ',' '}, - {' ',' ',' '}, - {'summer:mattoneR','summer:mattoneR','summer:mattoneR'}, + { ' ', ' ', ' ' }, + { ' ', ' ', ' ' }, + { 'summer:mattoneR', 'summer:mattoneR', 'summer:mattoneR' }, } }) --G @@ -556,23 +556,23 @@ minetest.register_node("summer:angstair", { "granite.png", "granite.png", "granite.png", - "granite.png" + "granite.png" }, ---inventory_image = "s_s_.png", + --inventory_image = "s_s_.png", --wield_image = "s_s_.png", drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", - node_box = { + paramtype2 = "facedir", + node_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0, 0.5, 0.5}, -- NodeBox1 - {-0.5, -0.5, 0, 0.5, 0.5, 0.5}, -- NodeBox2 - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- NodeBox3 + { -0.5, -0.5, -0.5, 0, 0.5, 0.5 }, -- NodeBox1 + { -0.5, -0.5, 0, 0.5, 0.5, 0.5 }, -- NodeBox2 + { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, -- NodeBox3 } }, - -- material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + -- material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='"summer:mattone" 7', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), @@ -582,34 +582,34 @@ minetest.register_node("summer:angstair", { minetest.register_craft({ output = 'summer:angstair', recipe = { - {'summer:mattone','summer:mattone',' '}, - {'summer:mattone','summer:mattone',' '}, - {'summer:mattone','summer:mattone','summer:mattone'}, + { 'summer:mattone', 'summer:mattone', ' ' }, + { 'summer:mattone', 'summer:mattone', ' ' }, + { 'summer:mattone', 'summer:mattone', 'summer:mattone' }, } }) minetest.register_node("summer:angstair2", { -description = "Spigolo_scala_granito_grigio", + description = "Spigolo_scala_granito_grigio", tiles = { "granite.png", "granite.png", "granite.png", "granite.png", "granite.png", - "granite.png" + "granite.png" }, drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", + paramtype2 = "facedir", node_box = { type = "fixed", fixed = { - {-0.5, -0.5, 0, 0, 0.5, 0.5}, -- NodeBox2 - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- NodeBox3 + { -0.5, -0.5, 0, 0, 0.5, 0.5 }, -- NodeBox2 + { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, -- NodeBox3 } }, - -- material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + -- material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='summer:mattone 5', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), @@ -618,9 +618,9 @@ description = "Spigolo_scala_granito_grigio", minetest.register_craft({ output = 'summer:angstair2', recipe = { - {' ','summer:mattone',' '}, - {' ','summer:mattone',' '}, - {'summer:mattone','summer:mattone','summer:mattone'}, + { ' ', 'summer:mattone', ' ' }, + { ' ', 'summer:mattone', ' ' }, + { 'summer:mattone', 'summer:mattone', 'summer:mattone' }, } }) minetest.register_node("summer:stair", { @@ -635,16 +635,16 @@ minetest.register_node("summer:stair", { }, drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", + paramtype2 = "facedir", node_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- Node1 - {-0.5, -0.5, 0, 0.5, 0.5, 0.5}, -- Node2 + { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, -- Node1 + { -0.5, -0.5, 0, 0.5, 0.5, 0.5 }, -- Node2 } }, - -- material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + -- material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='summer:mattone 6', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), @@ -653,13 +653,13 @@ minetest.register_node("summer:stair", { minetest.register_craft({ output = 'summer:stair', recipe = { - {'summer:mattone',' ',' '}, - {'summer:mattone','summer:mattone',' '}, - {'summer:mattone','summer:mattone','summer:mattone'}, + { 'summer:mattone', ' ', ' ' }, + { 'summer:mattone', 'summer:mattone', ' ' }, + { 'summer:mattone', 'summer:mattone', 'summer:mattone' }, } }) minetest.register_node("summer:battiscopa", { -description = "Battiscopa_granito_grigio", + description = "Battiscopa_granito_grigio", tiles = { "granite.png", "granite.png", @@ -670,17 +670,17 @@ description = "Battiscopa_granito_grigio", }, drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", + paramtype2 = "facedir", node_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, -- NodeBox3 - {-0.5, -0.5, -0.375, 0.5, 0.25, 0.5}, -- NodeBox4 - {-0.5, 0, -0.5, 0.5, 0.5, 0.5}, -- NodeBox5 + { -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 }, -- NodeBox3 + { -0.5, -0.5, -0.375, 0.5, 0.25, 0.5 }, -- NodeBox4 + { -0.5, 0, -0.5, 0.5, 0.5, 0.5 }, -- NodeBox5 } }, - -- material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + -- material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='summer:mattone 8', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), @@ -689,9 +689,9 @@ description = "Battiscopa_granito_grigio", minetest.register_craft({ output = 'summer:battiscopa', recipe = { - {'summer:mattone','summer:mattone','summer:mattone'}, - {'summer:mattone','summer:mattone',' '}, - {'summer:mattone','summer:mattone','summer:mattone'}, + { 'summer:mattone', 'summer:mattone', 'summer:mattone' }, + { 'summer:mattone', 'summer:mattone', ' ' }, + { 'summer:mattone', 'summer:mattone', 'summer:mattone' }, } }) minetest.register_node("summer:slab", { @@ -706,16 +706,16 @@ minetest.register_node("summer:slab", { }, drawtype = "nodebox", paramtype = "light", - paramtype2 = "facedir", + paramtype2 = "facedir", node_box = { type = "fixed", fixed = { - {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- Node1 + { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }, -- Node1 --{-0.5, -0.5, 0, 0.5, 0.5, 0.5}, -- Node2 } }, - -- material = minetest.digprop_constanttime(1), - groups = {cracky = 3, stone = 1}, + -- material = minetest.digprop_constanttime(1), + groups = { cracky = 3, stone = 1 }, --drop ='summer:mattone 6', --legacy_mineral = true, sounds = default.node_sound_stone_defaults(), @@ -724,8 +724,8 @@ minetest.register_node("summer:slab", { minetest.register_craft({ output = 'summer:slab', recipe = { - {' ',' ',' '}, - {' ',' ',' '}, - {'summer:mattone','summer:mattone','summer:mattone'}, + { ' ', ' ', ' ' }, + { ' ', ' ', ' ' }, + { 'summer:mattone', 'summer:mattone', 'summer:mattone' }, } }) diff --git a/vetro.lua b/vetro.lua index c189136..b6feaa5 100644 --- a/vetro.lua +++ b/vetro.lua @@ -1,113 +1,160 @@ - local vetro_list = { - { "Red vetro", "red"}, - { "Orange vetro", "orange"}, - { "Black vetro", "black"}, - { "Yellow vetro", "yellow"}, - { "Green vetro", "green"}, - { "Dark vetro", "dark_green"}, - { "Cyan vetro", "cyan"}, - { "Grey vetro", "grey"}, - { "Withe vetro", "white"}, - { "Fuxia vetro", "magenta"}, - { "Trasparent vetro", "trasp"}, - { "Blue vetro", "blue"}, - { "Violet vetro", "violet"}, +local vetro_list = { + { "Red vetro", "red" }, + { "Orange vetro", "orange" }, + { "Black vetro", "black" }, + { "Yellow vetro", "yellow" }, + { "Green vetro", "green" }, + { "Dark vetro", "dark_green" }, + { "Cyan vetro", "cyan" }, + { "Grey vetro", "grey" }, + { "Withe vetro", "white" }, + { "Fuxia vetro", "magenta" }, + { "Trasparent vetro", "trasp" }, + { "Blue vetro", "blue" }, + { "Violet vetro", "violet" }, } for i in ipairs(vetro_list) do local vetrodesc = vetro_list[i][1] local colour = vetro_list[i][2] - ---trasparente con cornice colorata - - minetest.register_node("summer:vetro_"..colour.."", { - description = vetrodesc.."trasparente incorniciata", - tiles = {"vetro_"..colour..".png"}, - sunlight_propagates = true, - drawtype = "glasslike", - -- use_texture_alpha = true, - paramtype = "light", - paramtype2 = "glasslikeliquidlevel", - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=0}, - drop = "summer:vetro_"..colour.."", + + --trasparente con cornice colorata + + minetest.register_node("summer:vetro_" .. colour .. "", { + description = vetrodesc .. "trasparente incorniciata", + tiles = { "vetro_" .. colour .. ".png" }, + sunlight_propagates = true, + drawtype = "glasslike", + -- use_texture_alpha = true, + paramtype = "light", + paramtype2 = "glasslikeliquidlevel", + groups = { snappy = 2, cracky = 3, oddly_breakable_by_hand = 3, not_in_creative_inventory = 0 }, + drop = "summer:vetro_" .. colour .. "", sounds = default.node_sound_glass_defaults(), - - - }) - --trasparente cornice colorata vetro unito - - minetest.register_node("summer:vetro_unito_"..colour.."", { - description = vetrodesc.."trasparente incorniciata unito", - tiles = {"vetro_"..colour..".png","vetro_trasp.png"}, - sunlight_propagates = true, - drawtype = "glasslike_framed", - use_texture_alpha = true, - paramtype = "light", - paramtype2 = "glasslikeliquidlevel", - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=0}, - drop = "summer:vetro_unito_"..colour.."", + + + }) + --trasparente cornice colorata vetro unito + + minetest.register_node("summer:vetro_unito_" .. colour .. "", { + description = vetrodesc .. "trasparente incorniciata unito", + tiles = { "vetro_" .. colour .. ".png", "vetro_trasp.png" }, + sunlight_propagates = true, + drawtype = "glasslike_framed", + use_texture_alpha = true, + paramtype = "light", + paramtype2 = "glasslikeliquidlevel", + groups = { snappy = 2, cracky = 3, oddly_breakable_by_hand = 3, not_in_creative_inventory = 0 }, + drop = "summer:vetro_unito_" .. colour .. "", sounds = default.node_sound_glass_defaults(), - - - }) - --colorato con cornice colorato - - minetest.register_node("summer:vetro_colorato_"..colour.."", { - description = vetrodesc.."cornice colorato", - tiles = {"vetro_traspc_"..colour..".png"}, - sunlight_propagates = true, - drawtype = "glasslike", - use_texture_alpha = true, - paramtype = "light", - paramtype2 = "glasslikeliquidlevel", - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=0}, - drop = "summer:vetro_colorato_"..colour.."", + + + }) + --colorato con cornice colorato + + minetest.register_node("summer:vetro_colorato_" .. colour .. "", { + description = vetrodesc .. "cornice colorato", + tiles = { "vetro_traspc_" .. colour .. ".png" }, + sunlight_propagates = true, + drawtype = "glasslike", + use_texture_alpha = true, + paramtype = "light", + paramtype2 = "glasslikeliquidlevel", + groups = { snappy = 2, cracky = 3, oddly_breakable_by_hand = 3, not_in_creative_inventory = 0 }, + drop = "summer:vetro_colorato_" .. colour .. "", sounds = default.node_sound_glass_defaults(), - - --colorato con cornice colorato unito - }) - minetest.register_node("summer:vetro_colorato_unito_"..colour.."", { - description = vetrodesc.."unito colorato", - tiles = {"vetro_traspc_"..colour..".png","vetro_trasp_"..colour..".png"}, - sunlight_propagates = true, - drawtype = "glasslike_framed", - use_texture_alpha = true, - paramtype = "light", - paramtype2 = "glasslikeliquidlevel", - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=0}, - drop = "summer:vetro_colorato_unito_"..colour.."", + + --colorato con cornice colorato unito + }) + minetest.register_node("summer:vetro_colorato_unito_" .. colour .. "", { + description = vetrodesc .. "unito colorato", + tiles = { "vetro_traspc_" .. colour .. ".png", "vetro_trasp_" .. colour .. ".png" }, + sunlight_propagates = true, + drawtype = "glasslike_framed", + use_texture_alpha = true, + paramtype = "light", + paramtype2 = "glasslikeliquidlevel", + groups = { snappy = 2, cracky = 3, oddly_breakable_by_hand = 3, not_in_creative_inventory = 0 }, + drop = "summer:vetro_colorato_unito_" .. colour .. "", sounds = default.node_sound_glass_defaults(), - - - }) - --senza cornice - minetest.register_node("summer:vetro_colorato_uni_"..colour.."", { - description = vetrodesc.." uniforme colorato", - tiles = {"vetro_trasp_"..colour..".png",}, - sunlight_propagates = true, - drawtype = "glasslike", - use_texture_alpha = true, - paramtype = "light", - paramtype2 = "glasslikeliquidlevel", - groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3,not_in_creative_inventory=0}, - drop = "summer:vetro_colorato_uni_"..colour.."", + + + }) + --senza cornice + minetest.register_node("summer:vetro_colorato_uni_" .. colour .. "", { + description = vetrodesc .. " uniforme colorato", + tiles = { "vetro_trasp_" .. colour .. ".png", }, + sunlight_propagates = true, + drawtype = "glasslike", + use_texture_alpha = true, + paramtype = "light", + paramtype2 = "glasslikeliquidlevel", + groups = { snappy = 2, cracky = 3, oddly_breakable_by_hand = 3, not_in_creative_inventory = 0 }, + drop = "summer:vetro_colorato_uni_" .. colour .. "", sounds = default.node_sound_glass_defaults(), - - - }) - minetest.register_craftitem("summer:vetro_traspp", { + + + }) + --vetro senza cornce + minetest.register_craft({ + output = "summer:vetro_colorato_uni_" .. colour .. "", + recipe = { + { "", "dye:" .. colour, "", }, + { "", "summer:vetro_traspp", "", }, + { "", "", "", } + } + }) + --vetro cornice trasp + minetest.register_craft({ + output = "summer:vetro_" .. colour .. "", + recipe = { + { "default:stick", "dye:" .. colour, "default:stick", }, + { "default:stick", "summer:vetro_traspp", "default:stick", }, + { "default:stick", "default:stick", "default:stick", } + } + }) + --vetro cornice trasp unito + minetest.register_craft({ + output = "summer:vetro_unito_" .. colour .. "", + recipe = { + { "", "dye:" .. colour, "", }, + { "", "summer:vetro_traspp", "", }, + { "default:stick", "default:stick", "default:stick", } + } + }) + --vetro cornice colorato + minetest.register_craft({ + output = "summer:vetro_colorato_" .. colour .. "", + recipe = { + { "default:stick", "dye:" .. colour, "default:stick" }, + { "default:stick", "summer:vetro_" .. colour, "default:stick" }, + { "default:stick", "default:stick", "default:stick" } + } + }) + --vetro cornice colorato unito + minetest.register_craft({ + output = "summer:vetro_colorato_unito_" .. colour .. "", + recipe = { + { "", "dye:" .. colour, "" }, + { "", "summer:vetro_" .. colour, "" }, + { "default:stick", "default:stick", "default:stick" } + } + }) +end + +minetest.register_craftitem("summer:vetro_traspp", { description = "vetrino", inventory_image = "vetro_traspp.png", --groups = {stick = 1, flammable = 2}, }) - minetest.register_craft({ +minetest.register_craft({ type = "cooking", cooktime = 10, output = "summer:vetro_traspp", recipe = "summer:mattoneG" }) - minetest.register_craft({ +minetest.register_craft({ type = "cooking", cooktime = 10, output = "summer:vetro_traspp", @@ -125,90 +172,45 @@ minetest.register_craft({ output = "summer:vetro_traspp", recipe = "summer:mattoneP" }) ---vetro senza cornce - minetest.register_craft({ - output = "summer:vetro_colorato_uni_"..colour.."", - recipe = { - {"", "dye:"..colour, "", }, - {"", "summer:vetro_traspp","", }, - {"", "", "", } - } - }) - --vetro cornice trasp - minetest.register_craft({ - output = "summer:vetro_"..colour.."", - recipe = { - {"default:stick", "dye:"..colour, "default:stick", }, - {"default:stick", "summer:vetro_traspp","default:stick", }, - {"default:stick", "default:stick", "default:stick", } - } - }) - --vetro cornice trasp unito - minetest.register_craft({ - output = "summer:vetro_unito_"..colour.."", - recipe = { - {"", "dye:"..colour, "", }, - {"", "summer:vetro_traspp","", }, - {"default:stick", "default:stick", "default:stick", } - } - }) - --vetro cornice colorato - minetest.register_craft({ - output = "summer:vetro_colorato_"..colour.."", - recipe = { - {"default:stick", "dye:"..colour, "default:stick" }, - {"default:stick", "summer:vetro_"..colour,"default:stick" }, - {"default:stick", "default:stick", "default:stick" } - } - }) - --vetro cornice colorato unito - minetest.register_craft({ - output = "summer:vetro_colorato_unito_"..colour.."", - recipe = { - {"", "dye:"..colour, "" }, - {"", "summer:vetro_"..colour,"" }, - {"default:stick", "default:stick", "default:stick" } - } - }) - --trasp - minetest.register_craft({ - output = "summer:vetro_colorato_trasp", - recipe = { - {"default:stick", "default:stick", "default:stick" }, - {"default:stick", "summer:vetro_traspp","default:stick" }, - {"default:stick", "default:stick", "default:stick" } - } - }) - minetest.register_craft({ - output = "summer:vetro_colorato_unito_trasp", - recipe = { - {"", "", "" }, - {"", "summer:vetro_traspp","" }, - {"default:stick", "default:stick", "default:stick" } - } - }) - minetest.register_craft({ - output = "summer:vetro_unito_trasp", - recipe = { - {"default:stick", "", "", }, - {"default:stick", "summer:vetro_traspp","", }, - {"default:stick", "", "", } - } - }) - minetest.register_craft({ - output = "summer:vetro_colorato_uni_trasp", - recipe = { - {"", "", "", }, - {"summer:vetro_traspp", "summer:vetro_traspp","", }, - {"summer:vetro_traspp", "summer:vetro_traspp", "", } - } - }) - minetest.register_craft({ - output = "summer:vetro_trasp", - recipe = { - {"default:stick", "default:stick", "default:stick", }, - {"default:stick", "summer:vetro_traspp","default:stick", }, - {"default:stick", "", "default:stick", } - } - }) -end + +--trasp +minetest.register_craft({ + output = "summer:vetro_colorato_trasp", + recipe = { + { "default:stick", "default:stick", "default:stick" }, + { "default:stick", "summer:vetro_traspp", "default:stick" }, + { "default:stick", "default:stick", "default:stick" } + } +}) +minetest.register_craft({ + output = "summer:vetro_colorato_unito_trasp", + recipe = { + { "", "", "" }, + { "", "summer:vetro_traspp", "" }, + { "default:stick", "default:stick", "default:stick" } + } +}) +minetest.register_craft({ + output = "summer:vetro_unito_trasp", + recipe = { + { "default:stick", "", "", }, + { "default:stick", "summer:vetro_traspp", "", }, + { "default:stick", "", "", } + } +}) +minetest.register_craft({ + output = "summer:vetro_colorato_uni_trasp", + recipe = { + { "", "", "", }, + { "summer:vetro_traspp", "summer:vetro_traspp", "", }, + { "summer:vetro_traspp", "summer:vetro_traspp", "", } + } +}) +minetest.register_craft({ + output = "summer:vetro_trasp", + recipe = { + { "default:stick", "default:stick", "default:stick", }, + { "default:stick", "summer:vetro_traspp", "default:stick", }, + { "default:stick", "", "default:stick", } + } +})