Re-label to 'sneeker'
@ -1,4 +1,4 @@
|
||||
# Sneaker mobile mod for Minetest
|
||||
# Sneeker mobile mod for Minetest
|
||||
|
||||
Adds some explosive nuisance.
|
||||
|
||||
|
@ -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
|
||||
|
42
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
|
||||
|
4
mod.conf
@ -1,5 +1,5 @@
|
||||
name = sneaker
|
||||
title = Sneaker
|
||||
name = sneeker
|
||||
title = Sneeker
|
||||
description = Adds some explosive nuisance.
|
||||
author = Rui
|
||||
depends = default, tnt
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
10
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
|
||||
})
|
||||
|
Before Width: | Height: | Size: 353 B After Width: | Height: | Size: 353 B |
Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 355 B |
Before Width: | Height: | Size: 139 B After Width: | Height: | Size: 139 B |
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 249 B |
@ -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)
|
||||
|