From b5c7aeb15d772196f08850900a13e100d7b2bad4 Mon Sep 17 00:00:00 2001 From: AntumDeluge Date: Sat, 27 May 2017 19:54:26 -0700 Subject: [PATCH] Re-label to 'sneeker' --- README.md | 2 +- functions.lua | 14 +++--- init.lua | 42 +++++++++--------- mod.conf | 2 +- settings.lua | 6 +-- settingtypes.txt | 8 ++-- ...neaker_explode.ogg => sneeker_explode.ogg} | Bin sounds/{sneaker_hiss.ogg => sneeker_hiss.ogg} | Bin spawn.lua | 10 ++--- textures/{sneaker.png => sneeker.png} | Bin ...neaker_powered.png => sneeker_powered.png} | Bin .../{sneaker_smoke.png => sneeker_smoke.png} | Bin ...aker_spawnegg.png => sneeker_spawnegg.png} | Bin tnt_function.lua | 6 +-- 14 files changed, 45 insertions(+), 45 deletions(-) rename sounds/{sneaker_explode.ogg => sneeker_explode.ogg} (100%) rename sounds/{sneaker_hiss.ogg => sneeker_hiss.ogg} (100%) rename textures/{sneaker.png => sneeker.png} (100%) rename textures/{sneaker_powered.png => sneeker_powered.png} (100%) rename textures/{sneaker_smoke.png => sneeker_smoke.png} (100%) rename textures/{sneaker_spawnegg.png => sneeker_spawnegg.png} (100%) 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 9dd9edd..cf7dfe4 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 @@ -160,7 +160,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({ @@ -251,8 +251,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 @@ -342,18 +342,18 @@ def.get_staticdata = function(self) }) end -minetest.register_entity('sneaker:sneaker',def) +minetest.register_entity('sneeker:sneeker',def) if minetest.get_modpath('spawneggs') and minetest.get_modpath('tnt') 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.setting_getbool('creative_mode') then itemstack:take_item() end @@ -363,12 +363,12 @@ if minetest.get_modpath('spawneggs') and minetest.get_modpath('tnt') 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 414972f..356c2c3 100644 --- a/mod.conf +++ b/mod.conf @@ -1 +1 @@ -name = sneaker +name = sneeker diff --git a/settings.lua b/settings.lua index 1f536ef..b5265f9 100644 --- a/settings.lua +++ b/settings.lua @@ -1,5 +1,5 @@ --- Settings for sneaker mod +-- Settings for sneeker mod -sneaker.debug = minetest.setting_get('sneaker_debug') or false -sneaker.spawn_cap = minetest.setting_get('sneaker_spawn_cap') or 50 +sneeker.debug = minetest.setting_get('sneeker_debug') or false +sneeker.spawn_cap = minetest.setting_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 f410122..8eb34b2 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 = minetest.setting_get('sneaker_spawn_chance') or 18000 -local spawn_interval = minetest.setting_get('sneaker_spawn_interval') or time_min * 40 -- Default interval is 40 minutes +local spawn_chance = minetest.setting_get('sneeker_spawn_chance') or 18000 +local spawn_interval = minetest.setting_get('sneeker_spawn_interval') or time_min * 40 -- Default interval is 40 minutes if minetest.setting_getbool('log_mods') 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 659ee59..7a48215 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 @@ -183,12 +183,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)