-- File: codersea/util.lua -- Purpose: CoderSea initial definitions and support routines -- Licenses: See "LICENSE" -- ------------------------------------------------------------------- function has_bool (flagname) return minetest.setting_getbool (flagname) end -- ------------------------------------------------------------------- has_ethereal = ocutil.mod_exists ("ethereal") -- ------------------------------------------------------------------- function StartsWith (String, Start) return string.sub (String, 1, string.len (Start)) == Start end -- ------------------------------------------------------------------- function EndsWith (String, End) return End == '' or string.sub (String, -string.len (End)) == End end -- ------------------------------------------------------------------- function numset (name) return tonumber (minetest.setting_get (name)) end -- ------------------------------------------------------------------- function pos_to_str (pos) return pos.x .. "," .. pos.y .. "," .. pos.z end -- ------------------------------------------------------------------- function is_water (uppos) local upname = minetest.get_node (uppos).name if (upname == "default:water_flowing" or upname == "default:water_source" or upname == "default:water_gel" or upname == "codersea:water_flowing" or upname == "codersea:water_source") then return true end return false end -- ------------------------------------------------------------------- codersea_delete_mobs = false function mob_custom (self, pos) if codersea_delete_mobs then self.object:remove() return false end return true end -- ------------------------------------------------------------------- live_water = { "codersea:water_source" , "default:water_source" , "default:water_gel" , } fly_water = { "codersea:water_source" , "default:water_source" , "default:water_gel" , "codersea:kelpgreen" , "codersea:kelpgreenmiddle" , "codersea:kelpbrown" , "codersea:kelpbrownmiddle" , "codersea:seagrassgreen" , "codersea:seagrassred" , "codersea:ethereal_seaweed" , "ethereal:seaweed" , "ethereal:coral2" , "ethereal:coral3" , "ethereal:coral4" , "ethereal:coral5" , "ethereal:sandy" , } -- ------------------------------------------------------------------- -- The first entry in this list should be an empty string: "" -- The other entries should be the names of colors supported for sea- -- glass. -- seaglass_colors = { "" , "black" , "blue" , "red" , "white" , "yellow" , } -- ------------------------------------------------------------------- -- The first entry in this list should be an empty string: "" -- The other entries should be the names of colors supported for sea- -- stone and related nodes. -- seastone_colors = { "" , "aqua" , "cyan" , "lime" , "magenta" , "redviolet" , "skyblue" , } sounds_dirt = default.node_sound_dirt_defaults() sounds_glass = default.node_sound_glass_defaults() sounds_leaves = default.node_sound_leaves_defaults() sounds_sand = default.node_sound_sand_defaults() sounds_stone = default.node_sound_stone_defaults() function CloneTable (original) local copy = {} for k, v in pairs (original) do if type (v) == 'table' then v = CloneTable (v) end copy [k] = v end return copy end seastone_list = {} seaglass_list = {}