diff --git a/init.lua b/init.lua index ef91f52..fe6dd5c 100644 --- a/init.lua +++ b/init.lua @@ -5,6 +5,31 @@ loud_walking.light_max = 8 -- light intensity for mushroom growth loud_walking.path = minetest.get_modpath(minetest.get_current_modname()) loud_walking.world = minetest.get_worldpath() +loud_walking.pod_size_x = minetest.setting_get('loud_walking_pod_size_x') +if loud_walking.pod_size_x == nil then + loud_walking.pod_size_x = 100 +end + +loud_walking.pod_size_y = minetest.setting_get('loud_walking_pod_size_y') +if loud_walking.pod_size_y == nil then + loud_walking.pod_size_y = 100 +end + +loud_walking.pod_size_z = minetest.setting_get('loud_walking_pod_size_z') +if loud_walking.pod_size_z == nil then + loud_walking.pod_size_z = 100 +end + +loud_walking.bridge_size = minetest.setting_get('loud_walking_bridge_size') +if loud_walking.bridge_size == nil then + loud_walking.bridge_size = 50 +end + +loud_walking.vertical_sep = minetest.setting_get('loud_walking_vertical_sep') +if loud_walking.vertical_sep == nil then + loud_walking.vertical_sep = 300 +end + loud_walking.breakable_wood = minetest.setting_getbool('loud_walking_breakable_wood') if loud_walking.breakable_wood == nil then loud_walking.breakable_wood = false diff --git a/mapgen.lua b/mapgen.lua index d55bfd3..8a88122 100644 --- a/mapgen.lua +++ b/mapgen.lua @@ -141,10 +141,10 @@ local function get_decoration(biome) end -local pod_size = {x=300, y=100, z=200} +local pod_size = {x=loud_walking.pod_size_x, y=loud_walking.pod_size_y, z=loud_walking.pod_size_z} local half_pod = {x=math_floor(pod_size.x / 2), y=math_floor(pod_size.y / 2), z=math_floor(pod_size.z / 2)} -local bridge_size = 50 -local vert_sep = 250 +local bridge_size = loud_walking.bridge_size +local vert_sep = loud_walking.vertical_sep local fcsize = {x=pod_size.x + bridge_size, y=pod_size.y + vert_sep, z=pod_size.z + bridge_size} local bevel = half_pod.y local room_size = 20 @@ -153,6 +153,9 @@ local biome_look = {} local cave_look = {} local tree_space = 3 +loud_walking.fcsize = table.copy(fcsize) +loud_walking.pod_size = table.copy(pod_size) + local function place_schematic(pos, schem, center) local rot = math.random(4) - 1 diff --git a/nodes.lua b/nodes.lua index c85bd74..02f7bd2 100644 --- a/nodes.lua +++ b/nodes.lua @@ -76,6 +76,61 @@ minetest.register_node("loud_walking:control_wall", { sounds = default.node_sound_stone_defaults(), }) +loud_walking.control_fun = function(pos, node, puncher, pointed_thing) + if not puncher:is_player() then + return + end + + local sr = math.random(20) + if sr < 3 then + puncher:set_hp(puncher:get_hp() - sr) + elseif sr < 6 then + minetest.chat_send_player(puncher:get_player_name(), "Prepare for transport...") + local pos = {x=50000, y=50000, z=50000} + while pos.x > 31000 or pos.x < -31000 do + pos.x = math.random(-100, 100) * loud_walking.fcsize.x + math.floor(loud_walking.pod_size.x / 2) + end + while pos.y > 31000 or pos.y < -31000 do + pos.y = math.random(-100, 100) * loud_walking.fcsize.y + math.floor(loud_walking.pod_size.y - 3) + end + while pos.z > 31000 or pos.z < -31000 do + pos.z = math.random(-100, 100) * loud_walking.fcsize.z + math.floor(loud_walking.pod_size.z / 2) + end + puncher:setpos(pos) + elseif sr == 6 then + minetest.chat_send_player(puncher:get_player_name(), "Infectious organism detected. Sterilizing area...") + for z1 = -4, 4 do + for y1 = -4, 4 do + for x1 = -4, 4 do + local p = {x = pos.x + x1, y = pos.y + y1, z = pos.z + z1} + local node = minetest.get_node(p) + if node and node.name == "air" then + minetest.set_node(p, {name="fire:basic_flame"}) + end + end + end + end + elseif sr == 7 then + minetest.chat_send_player(puncher:get_player_name(), "Repairing injured animal...") + puncher:set_hp(20) + elseif sr == 8 then + minetest.chat_send_player(puncher:get_player_name(), "Reseting chronometers...") + minetest.set_timeofday(math.random(100)/100) + elseif sr == 9 then + minetest.chat_send_player(puncher:get_player_name(), "Escaped animal detected. Ejecting...") + local pos = puncher:getpos() + for z1 = -1, 1 do + for x1 = -1, 1 do + minetest.set_node({x = pos.x + x1, y = pos.y - 1, z = pos.z + z1}, {name="air"}) + end + end + elseif sr == 10 then + minetest.set_node(pos, {name="air"}) + else + minetest.chat_send_player(puncher:get_player_name(), "Please do not press this button again.") + end +end + minetest.register_node("loud_walking:controls", { description = "Alien control system", paramtype = "light", @@ -84,51 +139,7 @@ minetest.register_node("loud_walking:controls", { is_ground_content = false, groups = {}, sounds = default.node_sound_stone_defaults(), - on_punch = function(pos, node, puncher, pointed_thing) - if not puncher:is_player() then - return - end - - local sr = math.random(20) - if sr < 3 then - puncher:set_hp(puncher:get_hp() - sr) - elseif sr < 6 then - local pos = {} - pos.x = math.random(-190, 190) * 160 - 32 + 40 - pos.y = math.random(-190, 190) * 160 - 32 + 77 - pos.z = math.random(-190, 190) * 160 - 32 + 40 - if pos.x > -31000 and pos.x < 31000 and pos.y > -31000 and pos.y < 31000 and pos.z > -31000 and pos.z < 31000 then - puncher:setpos(pos) - end - elseif sr == 6 then - for z1 = -4, 4 do - for y1 = -4, 4 do - for x1 = -4, 4 do - local p = {x = pos.x + x1, y = pos.y + y1, z = pos.z + z1} - local node = minetest.get_node(p) - if node and node.name == "air" then - minetest.set_node(p, {name="fire:basic_flame"}) - end - end - end - end - elseif sr == 7 then - puncher:set_hp(20) - elseif sr == 8 then - minetest.set_timeofday(math.random(100)/100) - elseif sr == 9 then - local pos = puncher:getpos() - for z1 = -1, 1 do - for x1 = -1, 1 do - minetest.set_node({x = pos.x + x1, y = pos.y - 1, z = pos.z + z1}, {name="air"}) - end - end - elseif sr == 10 then - minetest.set_node(pos, {name="air"}) - else - minetest.chat_send_player(puncher:get_player_name(), "Please do not press this button again.") - end - end + on_punch = loud_walking.control_fun, }) minetest.register_node("loud_walking:air_ladder", { diff --git a/settingtypes.txt b/settingtypes.txt new file mode 100644 index 0000000..aa24246 --- /dev/null +++ b/settingtypes.txt @@ -0,0 +1,29 @@ +# Size of pods in the x-axis. +loud_walking_pod_size_x (Pod Size - X) int 100 + +# Size of pods in the y-ayis. +loud_walking_pod_size_y (Pod Size - Y) int 100 + +# Size of pods in the z-azis. +loud_walking_pod_size_z (Pod Size - Z) int 100 + +# Length of bridges. +loud_walking_bridge_size (Bridge Size) int 50 + +# Vertical separation between pods. +loud_walking_vertical_sep (Vertical Separation) int 300 + +# Set to false if you're using an armor mod. +loud_walking_use_armor_elixirs (Use Armor Elixirs) bool true + +# If set, you will lose the effects of elixirs when you die. +loud_walking_expire_elixir_on_death (Elixirs Expire On Death) bool true + +# Unset this to make wood breakable by hand. +loud_walking_breakable_wood (Breakable Wood) bool false + +# Set to give wooden tools to starting players. +loud_walking_starting_equipment (Starting Equipment) bool false + +# Set to use experimental leaf decay. +loud_walking_quick_leaf_decay (Experimental Decay) bool false