mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-11-18 00:08:25 +01:00
Merge branch 'eventobjects_add'
This commit is contained in:
commit
e64657f2e1
11
mods/eventobjects/README.md
Normal file
11
mods/eventobjects/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
Events' Objects mod by Ataron and Mg
|
||||
####################################
|
||||
|
||||
# Contributors
|
||||
- Mg (@LeMagnesium)
|
||||
- Ataron (@Ataron)
|
||||
|
||||
# Medias
|
||||
eventobjects_surprise_node.jpg by Mg (WTFPL)
|
||||
eventobjects_surprise_node_top.jpg by Mg (WTFPL)
|
||||
eventobjects_surprise_node_animated.jpg by Ataron (CC-BY-NC-SA)
|
1
mods/eventobjects/depends.txt
Normal file
1
mods/eventobjects/depends.txt
Normal file
@ -0,0 +1 @@
|
||||
default
|
85
mods/eventobjects/init.lua
Normal file
85
mods/eventobjects/init.lua
Normal file
@ -0,0 +1,85 @@
|
||||
minetest.register_tool("eventobjects:spleef_shovel", {
|
||||
description = "Golden Spleef Shovel",
|
||||
inventory_image = "eventobjects_spleef_shovel.png",
|
||||
wield_image = "eventobjects_spleef_shovel.png^[transformR90",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
unbreakable={times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=3},
|
||||
crumbly = {times={[1]=1.20, [2]=0.60, [3]=0.40}, uses=0, maxlevel=3},
|
||||
},
|
||||
damage_groups = {fleshy=4},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("eventobjects:surprise_node", {
|
||||
description = "'?' block",
|
||||
inventory_image = minetest.inventorycube("eventobjects_surprise_node.png"),
|
||||
tiles = {
|
||||
"eventobjects_surprise_node_top.png", "eventobjects_surprise_node_top.png", {name = "eventobjects_surprise_node_animated.png", animation={type = "vertical_frames", aspect_w= 16, aspect_h = 16, length = 1.5}}
|
||||
},
|
||||
special_tiles = {
|
||||
{
|
||||
image = "blocmario.png",
|
||||
backface_culling=false,
|
||||
animation={type = "vertical_frames", aspect_w= 16, aspect_h = 16, length = 0.6}
|
||||
},
|
||||
{
|
||||
image = "blocmario.png",
|
||||
backface_culling=true,
|
||||
animation={type = "vertical_frames", aspect_w= 16, aspect_h = 16, length = 0.6}
|
||||
}
|
||||
},
|
||||
groups = {oddly_breakable_by_hand = 2},
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
meta:set_string("infotext","?")
|
||||
meta:set_string("formspec",
|
||||
"size[11,12]" ..
|
||||
"list[current_name;main;0.45,0.45;10,7;]" ..
|
||||
"list[current_player;main;1.45,8;8,4;]"
|
||||
)
|
||||
inv:set_size("main",70)
|
||||
end,
|
||||
allow_metadata_inventory_put = function(pos, to_list, to_index, stack, player)
|
||||
if player and minetest.check_player_privs(player:get_player_name(),{server=true}) then
|
||||
return stack:get_count()
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
allow_metadata_inventory_take = function(pos, from_list, from_index, stack, player)
|
||||
print(from_list)
|
||||
print(from_index)
|
||||
if player and minetest.check_player_privs(player:get_player_name(),{server=true}) then
|
||||
return stack:get_count()
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
|
||||
end,
|
||||
on_punch = function(pos, node, puncher, pointed_things)
|
||||
-- Spawn betweek 5 and 20 random nodes
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if inv:is_empty("main") then
|
||||
minetest.chat_send_player(puncher:get_player_name(),"Cannot spread items, inventory empty")
|
||||
return
|
||||
end
|
||||
for cnt = 1,70 do
|
||||
local stack = inv:get_stack("main",cnt)
|
||||
if stack:get_name() ~= "" then
|
||||
local obj = minetest.spawn_item({x=pos.x, y = pos.y + 1,z=pos.z},stack)
|
||||
inv:remove_item("main",stack)
|
||||
if obj then
|
||||
obj:setvelocity({x = math.random(-0.4,0.4), y = math.random(2,9), z = math.random(-0.4,0.4)})
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.remove_node(pos)
|
||||
end,
|
||||
})
|
BIN
mods/eventobjects/textures/eventobjects_spleef_shovel.png
Normal file
BIN
mods/eventobjects/textures/eventobjects_spleef_shovel.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 558 B |
BIN
mods/eventobjects/textures/eventobjects_surprise_node.png
Normal file
BIN
mods/eventobjects/textures/eventobjects_surprise_node.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 256 B |
Binary file not shown.
After Width: | Height: | Size: 857 B |
BIN
mods/eventobjects/textures/eventobjects_surprise_node_top.png
Normal file
BIN
mods/eventobjects/textures/eventobjects_surprise_node_top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 194 B |
Loading…
Reference in New Issue
Block a user