remove inhibitor blocks, adjust rainbow staff to allow alternative blocks if nyancat not available

master
Tai Kedzierski 2019-01-02 21:37:38 +00:00
parent 5cdf33449b
commit 5d1876067d
12 changed files with 88 additions and 151 deletions

View File

@ -6,4 +6,3 @@ License for all the models, textures and sounds, except otherwise specified, are
* License for individual artistic contributions:
* Tai Kedzierski, CC-BY-SA 4.0
* `sounds/nssm_energy_powerup.ogg`
* `sounds/nssm_inhibit.*.ogg`

View File

@ -19,6 +19,17 @@ This mod relies heavily on the features in TenPlus1's [`mobs_redo`](https://nota
This version of NSSM was adjusted to run against commit `487e037cc9` (from 2018-12-20). If you are having problems with mod compatibility, please ensure you are using a version of `mobs_redo` close to that commit.
## Settings
This mod provides some extra settings for fine tuning the experience:
* `nssm.server_rainbow_staff` - Rainbow Staff is a powerful tool instead of a block placer
* `nssm.energy_boosts` - allows player to eat energy for a stats bost
* `nssm.energy_lights` - allows placing energy as temporary light sources
## Some notes from NPX Team !
We suggest that you play nssm with:

View File

@ -112,27 +112,11 @@ minetest.register_abm({
end
})
-- Inhibition block - place in spawn buildings on servers
minetest.register_abm({
label = "Monster Inhibition Block",
nodenames = {"nssm:mob_inhibitor"},
interval = 1,
chance = 1,
catch_up = false,
action = function(pos, node, active_object_count, active_object_count_wider)
local obj, istring, lua_entity
for _,obj in pairs(minetest.get_objects_inside_radius(pos , nssm.inhibition_radius)) do
if not obj:is_player() and obj:get_luaentity() then
lua_entity = obj:get_luaentity()
istring = lua_entity["name"]
-- We got a name, it's nssm and it is a mob
if istring and istring:sub(1,5) == "nssm:" and lua_entity.health then
nssm:inhibit_effect(obj:get_pos())
obj:remove()
end
end
end
end,
nodenames = {"nssm:life_energy", "nssm:energy_globe", "nssm:great_energy_globe", "nssm:superior_energy_globe"},
interval = 10,
chance = 10,
action = function(pos, node)
minetest.set_node({x = pos.x, y = pos.y , z = pos.z}, {name = "air"})
end
})

View File

@ -1,11 +1,10 @@
nssm.mymapgenis = tonumber(minetest.settings:get('nssm.mymapgenis')) or 7
nssm.multimobs = tonumber(minetest.settings:get('nssm.multimobs')) or 1000
-- Server safe setting - allow a non-griefing rainbow tool
nssm.server_rainbow_staff = minetest.settings:get_bool('nssm.server_rainbow_staff', false)
nssm.inhibition_radius = tonumber(minetest.settings:get('nssm.inhibition_radius')) or 8
nssm.energy_boosts = minetest.settings:get_bool('nssm.energy_boosts')
--minetest.debug( dump(nssm) )
nssm.energy_lights = minetest.settings:get_bool('nssm.energy_lights')

View File

@ -30,6 +30,3 @@ nssm:load("tools/bomb_materials.lua")
nssm:load("tools/bomb_evocation.lua")
nssm:load("tools/rainbow_staff.lua")
nssm:load("tools/armor.lua")
-- Server
nssm:load("tools/mob_inhibitor.lua")

View File

@ -116,61 +116,48 @@ local function register_energy(name, descr, nodesize, nutrition, duration)
local ns = nodesize
local div = 64
--[[
minetest.register_craftitem("nssm:"..name, {
description = descr,
image = name..".png",
on_use = eat_energy,
})
--]]
minetest.register_node("nssm:"..name, {
description = descr,
tiles = {
{
name="venomous_gas_animated2.png",
animation={
type="vertical_frames",
aspect_w=64,
aspect_h=64,
length=3.0
if nssm.energy_lights then
minetest.register_node("nssm:"..name, {
description = descr,
tiles = {
{
name="venomous_gas_animated2.png",
animation={
type="vertical_frames",
aspect_w=64,
aspect_h=64,
length=3.0
}
}
}
},
--[[
tiles = {
{
name = "default_water_source_animated.png^[colorize:yellow:100",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
wield_image = name..".png",
inventory_image = name..".png",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-ns / div, -ns / div, -ns / div, ns / div, ns / div, ns / div},
},
},
}, --]]
wield_image = name..".png",
inventory_image = name..".png",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-ns / div, -ns / div, -ns / div, ns / div, ns / div, ns / div},
},
},
paramtype = "light",
light_source = nodesize,
sunlight_propagates = true,
is_ground_content = false,
groups = {dig_immediate = 3},
pointable = false,
drop = "",
buildable_to = true,
on_use = eat_energy,
walkable = false,
-- TODO add node timer so it disappears after N seconds ...
})
paramtype = "light",
light_source = nodesize,
sunlight_propagates = true,
is_ground_content = false,
groups = {dig_immediate = 3},
pointable = false,
drop = "",
buildable_to = true,
on_use = eat_energy,
walkable = false,
})
else
minetest.register_craftitem("nssm:"..name, {
description = descr,
image = name..".png",
on_use = eat_energy,
})
end
end
local function register_energy_craft(smaller,bigger)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,62 +0,0 @@
--[[
Server node tool to protect from mobs.
Not in creative inventory, intended for admin use only.
--]]
minetest.register_privilege("mob_inhibitor", {description="Allows placing mob inhibitor blocks"})
minetest.register_node("nssm:mob_inhibitor", {
description = "NSSM Monster Ward",
tiles = {
"default_obsidian.png^proud_soul_fragment.png", -- top
"default_obsidian.png^greedy_soul_fragment.png", --under
"default_obsidian.png^phoenix_fire_bomb.png", -- back
"default_obsidian.png^phoenix_fire_bomb.png", -- side
"default_obsidian.png^phoenix_fire_bomb.png", --side
"default_obsidian.png^phoenix_fire_bomb.png", --front
},
groups = {cracky = 1, level = 4, not_in_creative_inventory = 1},
sounds = default.node_sound_stone_defaults(),
drop = "",
on_place = function(itemstack, placer, pointed_thing)
local playername = placer:get_player_name()
local privs = minetest.get_player_privs(playername)
if privs.mob_inhibitor then
return minetest.item_place(itemstack, placer, pointed_thing)
else
minetest.log("action", playername.." prevented from using nssm:mob_inhibitor")
return
end
end
})
function nssm:inhibit_effect(pos,radius)
radius = radius or 1
minetest.add_particlespawner({
amount = 80,
time = 1,
minpos = {x=pos.x-radius/2, y=pos.y-radius/2, z=pos.z-radius/2},
maxpos = {x=pos.x+radius/2, y=pos.y+radius/2, z=pos.z+radius/2},
minlevel = {x=-0, y=-0, z=-0},
maxlevel = {x=1, y=1, z=1},
minacc = {x=-0.5,y=5,z=-0.5},
maxacc = {x=0.5,y=5,z=0.5},
minexptime = 0.1,
maxexptime = 1,
minsieze = 3,
maxsieze = 4,
collisiondetection = false,
texture = "morparticle.png^[colorize:yellow:200^[colorize:white:100"
})
minetest.sound_play("nssm_inhibit", {
pos = pos,
max_hear_distance = nssm.inhibition_radius,
})
end

View File

@ -1,11 +1,35 @@
-- The Rainbow Staff is a reward for defeating the final boss
-- Classic implementation produces rainbow blocks in any direction it is pointed at and used
-- Classic implementation produces Nyancat rainbow blocks in any direction it is pointed at and used
-- This tends to be problematic on servers, so is replaced with a powerful tool instead
-- if classic_rainbow_staff is not enabled
-- if server_rainbow_staff is enabled
if not nssm.server_rainbow_staff and minetest.registered_nodes["nyancat:nyancat_rainbow"] then
-- The `nyancat` mod was removed in Minetest 0.4.16+
-- The alternative blocks are used when this mod is not/no longer present
local head_block = "nyancat:nyancat"
local tail_block = "nyancat:nyancat_rainbow"
local head_replacement = "nssm:great_energy_globe"
local tail_replacement = "nssm:superior_energy_globe"
if not nssm.energy_lights then
head_replacement = "nssm:modders_block"
tail_replacement = "nssm:invisible_light"
end
if not nssm.server_rainbow_staff then
local max_rainbow_time = 5
if not minetest.registered_nodes["nyancat:nyancat_rainbow"] then
minetest.register_alias(head_block, head_replacement)
minetest.register_alias(tail_block, tail_replacement)
head_block = head_replacement
tail_block = tail_replacement
print("NYARRWRW !!!")
else
print("NYAN !!!")
end
minetest.register_entity("nssm:rainbow", {
textures = {"transparent.png"},
velocity = 10,
@ -19,18 +43,17 @@ if not nssm.server_rainbow_staff and minetest.registered_nodes["nyancat:nyancat_
end
if os.time() - self.timer > max_rainbow_time then
minetest.set_node(pos, {name="nyancat:nyancat"})
minetest.set_node(pos, {name=head_block})
self.object:remove()
end
if minetest.get_node(pos) then
local n = minetest.get_node(pos).name
if n ~= "nyancat:nyancat_rainbow" then
if n ~= tail_block then
if n=="air" then
minetest.set_node(pos, {name="nyancat:nyancat_rainbow"})
minetest.set_node(pos, {name=tail_block})
else
-- minetest.chat_send_all("Nome:"..n)
minetest.set_node(pos, {name="nyancat:nyancat"})
minetest.set_node(pos, {name=head_block})
self.object:remove()
end
end
@ -52,7 +75,6 @@ if not nssm.server_rainbow_staff and minetest.registered_nodes["nyancat:nyancat_
groups = {not_in_creative_inventory=1,}
})
print("NYAN !!!")
else
minetest.register_tool("nssm:rainbow_staff", {