diff --git a/README.md b/README.md index 7626630..c2fac83 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Sneaker mobile mod for Minetest +# Sneeker mobile mod for Minetest Adds some explosive nuisance. diff --git a/functions.lua b/functions.lua index 33af534..a263c41 100644 --- a/functions.lua +++ b/functions.lua @@ -1,14 +1,14 @@ --- Functions for sneaker mod +-- Functions for sneeker mod -- Displays a message in log output -function sneaker.log(message) - minetest.log('action', '[' .. sneaker.modname .. '] ' .. message) +function sneeker.log(message) + minetest.log('action', '[' .. sneeker.modname .. '] ' .. message) end --- Displays a message in log output only if 'sneaker.debug' is set to 'true' -function sneaker.log_debug(message) - if sneaker.debug then - sneaker.log('[DEBUG] ' .. message) +-- Displays a message in log output only if 'sneeker.debug' is set to 'true' +function sneeker.log_debug(message) + if sneeker.debug then + sneeker.log('[DEBUG] ' .. message) end end diff --git a/init.lua b/init.lua index 4cd7960..98d83f5 100644 --- a/init.lua +++ b/init.lua @@ -1,21 +1,21 @@ -- Original code by Rui: WTFPL -sneaker = {} -sneaker.modname = minetest.get_current_modname() -sneaker.modpath = minetest.get_modpath(sneaker.modname) +sneeker = {} +sneeker.modname = minetest.get_current_modname() +sneeker.modpath = minetest.get_modpath(sneeker.modname) local log_mods = minetest.setting_getbool("log_mods") if log_mods then - minetest.log("action", "Loading mod \"" .. sneaker.modname .. "\" ...") + minetest.log("action", "Loading mod \"" .. sneeker.modname .. "\" ...") end -dofile(sneaker.modpath .. "/settings.lua") -dofile(sneaker.modpath .. "/functions.lua") +dofile(sneeker.modpath .. "/settings.lua") +dofile(sneeker.modpath .. "/functions.lua") if log_mods then - sneaker.log("Spawn cap: " .. tostring(sneaker.spawn_cap)) + sneeker.log("Spawn cap: " .. tostring(sneeker.spawn_cap)) end local scripts = { @@ -24,7 +24,7 @@ local scripts = { } for I in pairs(scripts) do - dofile(sneaker.modpath .. "/" .. scripts[I] .. ".lua") + dofile(sneeker.modpath .. "/" .. scripts[I] .. ".lua") end local function jump(self,pos,direction) @@ -77,7 +77,7 @@ local def = { collisionbox = {-0.25,-0.7,-0.25, 0.25,0.8,0.25}, visual = "mesh", mesh = "character.b3d", - textures = {"sneaker.png"}, + textures = {"sneeker.png"}, makes_footstep_sound = false, -- Original @@ -110,12 +110,12 @@ def.on_activate = function(self,staticdata) if data and type(data) == "table" then if data.powered == true then self.powered = true - self.object:set_properties({textures = {"sneaker_powered.png"}}) + self.object:set_properties({textures = {"sneeker_powered.png"}}) end else if math.random(0,20) == 20 then self.powered = true - self.object:set_properties({textures = {"sneaker_powered.png"}}) + self.object:set_properties({textures = {"sneeker_powered.png"}}) end end end @@ -165,7 +165,7 @@ def.on_step = function(self, dtime) if self.chase and self.visualx < 2 then if self.hiss == false then - minetest.sound_play("sneaker_hiss",{pos=pos,gain=1.5,max_hear_distance=2*64}) + minetest.sound_play("sneeker_hiss",{pos=pos,gain=1.5,max_hear_distance=2*64}) end self.visualx = self.visualx+0.05 self.object:set_properties({ @@ -256,8 +256,8 @@ def.on_step = function(self, dtime) self.chase = true if self.visualx >= 2 then self.object:remove() - sneaker.boom(pos,self.powered) - minetest.sound_play("sneaker_explode",{pos=pos,gain=1.5,max_hear_distance=2*64}) + sneeker.boom(pos,self.powered) + minetest.sound_play("sneeker_explode",{pos=pos,gain=1.5,max_hear_distance=2*64}) end end end @@ -359,18 +359,18 @@ def.get_staticdata = function(self) }) end -minetest.register_entity("sneaker:sneaker",def) +minetest.register_entity("sneeker:sneeker",def) if minetest.global_exists("spawneggs") then - minetest.register_craftitem("sneaker:spawnegg",{ - description = "Sneaker Spawn Egg", - inventory_image = "sneaker_spawnegg.png", + minetest.register_craftitem("sneeker:spawnegg",{ + description = "Sneeker Spawn Egg", + inventory_image = "sneeker_spawnegg.png", stack_max = 64, on_place = function(itemstack,placer,pointed_thing) if pointed_thing.type == "node" then local pos = pointed_thing.above pos.y = pos.y+1 - minetest.add_entity(pos,"sneaker:sneaker") + minetest.add_entity(pos,"sneeker:sneeker") if not minetest.settings:get_bool("creative_mode", false) then itemstack:take_item() end @@ -380,10 +380,10 @@ if minetest.global_exists("spawneggs") then }) minetest.register_craft({ - output = "sneaker:spawnegg", + output = "sneeker:spawnegg", type = "shapeless", recipe = {"spawneggs:egg", "tnt:tnt",}, }) - minetest.register_alias("spawneggs:sneaker", "sneaker:spawnegg") + minetest.register_alias("spawneggs:sneeker", "sneeker:spawnegg") end diff --git a/mod.conf b/mod.conf index 20856f2..f87ede8 100644 --- a/mod.conf +++ b/mod.conf @@ -1,5 +1,5 @@ -name = sneaker -title = Sneaker +name = sneeker +title = Sneeker description = Adds some explosive nuisance. author = Rui depends = default, tnt diff --git a/settings.lua b/settings.lua index f364dff..ec7c29f 100644 --- a/settings.lua +++ b/settings.lua @@ -1,5 +1,5 @@ --- Settings for sneaker mod +-- Settings for sneeker mod -sneaker.debug = minetest.settings:get_bool("sneaker_debug", false) -sneaker.spawn_cap = tonumber(minetest.settings:get("sneaker_spawn_cap")) or 50 +sneeker.debug = minetest.settings:get_bool("sneeker_debug", false) +sneeker.spawn_cap = tonumber(minetest.settings:get("sneeker_spawn_cap")) or 50 diff --git a/settingtypes.txt b/settingtypes.txt index 49142d3..a90038d 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -1,12 +1,12 @@ # Logs debug output. -sneaker_debug (Log debug output) bool false +sneeker_debug (Log debug output) bool false # Sets maximum number of spawns that can exist in world. -sneaker_spawn_cap (Maximum spawns) int 50 +sneeker_spawn_cap (Maximum spawns) int 50 # Sets possibility for spawn. -sneaker_spawn_chance (Spawn chance) int 18000 +sneeker_spawn_chance (Spawn chance) int 18000 # Sets frequency of spawn chance. # Default 1200 is equivalent to 20 minutes (60 * 40). -sneaker_spawn_interval (Spawn interval) int 2400 +sneeker_spawn_interval (Spawn interval) int 2400 diff --git a/sounds/sneaker_explode.ogg b/sounds/sneeker_explode.ogg similarity index 100% rename from sounds/sneaker_explode.ogg rename to sounds/sneeker_explode.ogg diff --git a/sounds/sneaker_hiss.ogg b/sounds/sneeker_hiss.ogg similarity index 100% rename from sounds/sneaker_hiss.ogg rename to sounds/sneeker_hiss.ogg diff --git a/spawn.lua b/spawn.lua index 74bfd03..bdf0bb1 100644 --- a/spawn.lua +++ b/spawn.lua @@ -5,12 +5,12 @@ local time_min = 60 local time_hr = time_min * 60 local time_day = time_hr * 24 -local spawn_chance = tonumber(minetest.settings:get("sneaker_spawn_chance")) or 18000 -local spawn_interval = tonumber(minetest.settings:get("sneaker_spawn_interval")) or time_min * 40 -- Default interval is 40 minutes +local spawn_chance = tonumber(minetest.settings:get("sneeker_spawn_chance")) or 18000 +local spawn_interval = tonumber(minetest.settings:get("sneeker_spawn_interval")) or time_min * 40 -- Default interval is 40 minutes if minetest.settings:get_bool("log_mods", false) then - sneaker.log("Spawn chance: " .. tostring(spawn_chance) .. " (1/" .. tostring(spawn_chance) .. ")") - sneaker.log("Spawn interval: " .. tostring(spawn_interval) .. " (" .. tostring(spawn_interval/60) .. " minutes)") + sneeker.log("Spawn chance: " .. tostring(spawn_chance) .. " (1/" .. tostring(spawn_chance) .. ")") + sneeker.log("Spawn interval: " .. tostring(spawn_interval) .. " (" .. tostring(spawn_interval/60) .. " minutes)") end minetest.register_abm({ @@ -42,6 +42,6 @@ minetest.register_abm({ if minetest.get_node(pos).name ~= "air" then return end - minetest.add_entity(pos,"sneaker:sneaker") + minetest.add_entity(pos,"sneeker:sneeker") end }) diff --git a/textures/sneaker.png b/textures/sneeker.png similarity index 100% rename from textures/sneaker.png rename to textures/sneeker.png diff --git a/textures/sneaker_powered.png b/textures/sneeker_powered.png similarity index 100% rename from textures/sneaker_powered.png rename to textures/sneeker_powered.png diff --git a/textures/sneaker_smoke.png b/textures/sneeker_smoke.png similarity index 100% rename from textures/sneaker_smoke.png rename to textures/sneeker_smoke.png diff --git a/textures/sneaker_spawnegg.png b/textures/sneeker_spawnegg.png similarity index 100% rename from textures/sneaker_spawnegg.png rename to textures/sneeker_spawnegg.png diff --git a/tnt_function.lua b/tnt_function.lua index d7e0b47..5af1f6f 100644 --- a/tnt_function.lua +++ b/tnt_function.lua @@ -131,7 +131,7 @@ local function add_effects(pos, radius) maxexptime = 3, minsize = 8, maxsize = 16, - texture = "sneaker_smoke.png", + texture = "sneeker_smoke.png", }) end @@ -187,12 +187,12 @@ local function explode(pos, radius) return drops end -function sneaker.boom(pos,large) +function sneeker.boom(pos,large) local radius = radius if large then radius = large_radius end - minetest.sound_play("sneaker_explode", {pos=pos, gain=1.5, max_hear_distance=2*64}) + minetest.sound_play("sneeker_explode", {pos=pos, gain=1.5, max_hear_distance=2*64}) minetest.set_node(pos, {name="tnt:boom"}) minetest.get_node_timer(pos):start(0.5) local drops = explode(pos, radius)