1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2025-06-28 06:11:47 +02:00

initial commit

subgame + mods
This commit is contained in:
Ombridride
2014-10-28 18:01:32 +01:00
parent baab1b3f7c
commit 232b274c55
6451 changed files with 226156 additions and 0 deletions

47
mods/throwing/README.txt Executable file
View File

@ -0,0 +1,47 @@
=== THROWING-MOD for MINETEST ===
by PilzAdam
Inroduction:
This mod adds bows and arrows to Minetest.
How to install:
Unzip the archive an place it in minetest-base-directory/mods/minetest/
if you have a windows client or a linux run-in-place client. If you have
a linux system-wide instalation place it in ~/.minetest/mods/minetest/.
If you want to install this mod only in one world create the folder
worldmods/ in your worlddirectory.
For further information or help see:
http://wiki.minetest.com/wiki/Installing_Mods
How to use the mod:
Craft a bow with the strings from the farming mod:
string wood
string wood
string wood
Craft arrows with:
stick stick steel
Select the bow and shoot with left mouse click. Every shoot will take 1
arrow from your inventory and wears out the bow (you have around 50
shoots).
License:
This mod was originally published by Jeija.
Sourcecode: WTFPL (see below)
Grahpics: WTFPL (see below)
See also:
http://minetest.net/
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

98
mods/throwing/arrow.lua Executable file
View File

@ -0,0 +1,98 @@
minetest.register_craftitem("throwing:arrow", {
description = "Arrow",
inventory_image = "throwing_arrow.png",
})
minetest.register_node("throwing:arrow_box", {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
-- Shaft
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
-- Spitze
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
-- Federn
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
}
},
tiles = {"throwing_arrow.png", "throwing_arrow.png", "throwing_arrow_back.png", "throwing_arrow_front.png", "throwing_arrow_2.png", "throwing_arrow.png"},
groups = {not_in_creative_inventory = 1},
})
local THROWING_ARROW_ENTITY = {
physical = false,
timer = 0,
visual = "wielditem",
visual_size = {x = 0.125, y = 0.125},
textures = {"throwing:arrow_box"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
}
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
self.timer = self.timer + dtime
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer > 0.2 then
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "throwing:arrow_entity" and obj:get_luaentity().name ~= "__builtin:item" then
local damage = 3
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage},
}, nil)
minetest.sound_play("throwing_arrow", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
else
local damage = 3
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage},
}, nil)
minetest.sound_play("throwing_arrow", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
end
end
if self.lastpos.x ~= nil then
if minetest.registered_nodes[node.name].walkable then
if not minetest.setting_getbool("creative_mode") then
minetest.add_item(self.lastpos, "throwing:arrow")
end
minetest.sound_play("throwing_arrow", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
minetest.register_entity("throwing:arrow_entity", THROWING_ARROW_ENTITY)
minetest.register_craft({
output = "throwing:arrow 16",
recipe = {
{"default:stick", "default:stick", "group:ingot"},
}
})
minetest.register_craft({
output = "throwing:arrow 16",
recipe = {
{"group:ingot", "default:stick", "default:stick"},
}
})

95
mods/throwing/build_arrow.lua Executable file
View File

@ -0,0 +1,95 @@
minetest.register_craftitem("throwing:arrow_build", {
description = "Build Arrow",
inventory_image = "throwing_arrow_build.png",
})
minetest.register_node("throwing:arrow_build_box", {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
-- Shaft
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
-- Spitze
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
-- Federn
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
}
},
tiles = {"throwing_arrow_build.png", "throwing_arrow_build.png", "throwing_arrow_build_back.png", "throwing_arrow_build_front.png", "throwing_arrow_build_2.png", "throwing_arrow_build.png"},
groups = {not_in_creative_inventory = 1},
})
local THROWING_ARROW_ENTITY = {
physical = false,
timer = 0,
visual = "wielditem",
visual_size = {x = 0.125, y = 0.125},
textures = {"throwing:arrow_build_box"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
node = "",
}
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
self.timer = self.timer + dtime
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer > 0.2 then
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "throwing:arrow_build_entity" and obj:get_luaentity().name ~= "__builtin:item" then
if self.node ~= "" then
minetest.set_node(self.lastpos, {name="default:obsidian_glass"})
minetest.sound_play("throwing_build_arrow", {pos = self.lastpos})
end
self.object:remove()
end
else
if self.node ~= "" then
minetest.set_node(self.lastpos, {name="default:obsidian_glass"})
minetest.sound_play("throwing_build_arrow", {pos = self.lastpos})
end
self.object:remove()
end
end
end
if self.lastpos.x ~= nil then
if minetest.registered_nodes[node.name].walkable then
if self.node ~= "" then
minetest.set_node(self.lastpos, {name="default:obsidian_glass"})
minetest.sound_play("throwing_build_arrow", {pos = self.lastpos})
end
self.object:remove()
end
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
minetest.register_entity("throwing:arrow_build_entity", THROWING_ARROW_ENTITY)
minetest.register_craft({
output = "throwing:arrow_build",
recipe = {
{"default:stick", "default:stick", "default:obsidian_glass"},
}
})
minetest.register_craft({
output = "throwing:arrow_build",
recipe = {
{"default:obsidian_glass", "default:stick", "default:stick"},
}
})

4
mods/throwing/depends.txt Executable file
View File

@ -0,0 +1,4 @@
default
bucket
fire
farming

106
mods/throwing/dig_arrow.lua Executable file
View File

@ -0,0 +1,106 @@
minetest.register_craftitem("throwing:arrow_dig", {
description = "Dig Arrow",
inventory_image = "throwing_arrow_dig.png",
})
minetest.register_node("throwing:arrow_dig_box", {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
-- Shaft
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
-- Spitze
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
-- Federn
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
}
},
tiles = {"throwing_arrow_dig.png", "throwing_arrow_dig.png", "throwing_arrow_dig_back.png", "throwing_arrow_dig_front.png", "throwing_arrow_dig_2.png", "throwing_arrow_dig.png"},
groups = {not_in_creative_inventory = 1},
})
local THROWING_ARROW_ENTITY = {
physical = false,
timer = 0,
visual = "wielditem",
visual_size = {x = 0.125, y = 0.125},
textures = {"throwing:arrow_dig_box"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
}
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
self.timer = self.timer + dtime
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer > 0.2 then
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "throwing:arrow_dig_entity" and obj:get_luaentity().name ~= "__builtin:item" then
if not minetest.setting_getbool("creative_mode") then
minetest.add_item(pos, "throwing:arrow_dig")
end
local n = minetest.get_node(pos).name
if n ~= "bedrock:bedrock" and n ~= "default:chest_locked" and n ~= "bones:bones" and n ~= "default:chest" and n ~= "default:furnace" then
minetest.dig_node(pos)
end
minetest.sound_play("throwing_dig_arrow", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
else
if not minetest.setting_getbool("creative_mode") then
minetest.add_item(pos, "throwing:arrow_dig")
end
local n = minetest.get_node(pos).name
if n ~= "bedrock:bedrock" and n ~= "default:chest_locked" and n ~= "bones:bones" and n ~= "default:chest" and n ~= "default:furnace" then
minetest.dig_node(pos)
end
minetest.sound_play("throwing_dig_arrow", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
end
end
if self.lastpos.x ~= nil then
if minetest.registered_nodes[node.name].walkable then
if not minetest.setting_getbool("creative_mode") then
minetest.add_item(self.lastpos, "throwing:arrow_dig")
end
local n = minetest.get_node(pos).name
if n ~= "bedrock:bedrock" and n ~= "default:chest_locked" and n ~= "bones:bones" and n ~= "default:chest" and n ~= "default:furnace" then
minetest.dig_node(pos)
end
minetest.sound_play("throwing_dig_arrow", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
minetest.register_entity("throwing:arrow_dig_entity", THROWING_ARROW_ENTITY)
minetest.register_craft({
output = "throwing:arrow_dig",
recipe = {
{"default:stick", "default:stick", "default:pick_wood"},
}
})
minetest.register_craft({
output = "throwing:arrow_dig",
recipe = {
{"default:pick_wood", "default:stick", "default:stick"},
}
})

View File

@ -0,0 +1,78 @@
minetest.register_craftitem("throwing:arrow_dig_admin", {
description = "Admin Dig Arrow",
inventory_image = "throwing_arrow_dig_admin.png",
groups = {not_in_creative_inventory = 1},
})
minetest.register_node("throwing:arrow_dig_admin_box", {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
-- Shaft
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
-- Spitze
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
-- Federn
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
}
},
tiles = {"throwing_arrow_dig_admin.png", "throwing_arrow_dig_admin.png", "throwing_arrow_dig_admin_back.png", "throwing_arrow_dig_admin_front.png", "throwing_arrow_dig_admin_2.png", "throwing_arrow_dig_admin.png"},
groups = {not_in_creative_inventory = 1},
})
local THROWING_ARROW_ENTITY = {
physical = false,
timer = 0,
visual = "wielditem",
visual_size = {x = 0.125, y = 0.125},
textures = {"throwing:arrow_dig_admin_box"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
}
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
self.timer = self.timer + dtime
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer > 0.2 then
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "throwing:arrow_dig_admin_entity" and obj:get_luaentity().name ~= "__builtin:item" then
local n = minetest.get_node(pos).name
minetest.log("action", n .. " was removed using throwing:arrow_dig_admin at " .. pos_to_string(vector.round(pos)) .. ".")
minetest.remove_node(pos)
self.object:remove()
end
else
local n = minetest.get_node(pos).name
minetest.log("action", n .. " was removed using throwing:arrow_dig_admin at " .. pos_to_string(vector.round(pos)) .. ".")
minetest.remove_node(pos)
self.object:remove()
end
end
end
if self.lastpos.x ~= nil then
if minetest.registered_nodes[node.name].walkable then
local n = minetest.get_node(pos).name
minetest.log("action", n .. " was removed using throwing:arrow_dig_admin at " .. pos_to_string(vector.round(pos)) .. ".")
minetest.remove_node(pos)
self.object:remove()
end
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
minetest.register_entity("throwing:arrow_dig_admin_entity", THROWING_ARROW_ENTITY)

94
mods/throwing/fire_arrow.lua Executable file
View File

@ -0,0 +1,94 @@
minetest.register_craftitem("throwing:arrow_fire", {
description = "Torch Arrow",
inventory_image = "throwing_arrow_fire.png",
})
minetest.register_node("throwing:arrow_fire_box", {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
-- Shaft
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
-- Spitze
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
-- Federn
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
}
},
tiles = {"throwing_arrow_fire.png", "throwing_arrow_fire.png", "throwing_arrow_fire_back.png", "throwing_arrow_fire_front.png", "throwing_arrow_fire_2.png", "throwing_arrow_fire.png"},
groups = {not_in_creative_inventory = 1},
})
local THROWING_ARROW_ENTITY = {
physical = false,
timer = 0,
visual = "wielditem",
visual_size = {x = 0.125, y = 0.125},
textures = {"throwing:arrow_fire_box"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
}
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
self.timer = self.timer + dtime
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer > 0.2 then
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "throwing:arrow_fire_entity" and obj:get_luaentity().name ~= "__builtin:item" then
if self.node ~= "" then
minetest.set_node(self.lastpos, {name="default:torch"})
minetest.sound_play("default_place_node", {pos = self.lastpos})
end
self.object:remove()
end
else
if self.node ~= "" then
minetest.set_node(self.lastpos, {name="default:torch"})
minetest.sound_play("default_place_node", {pos = self.lastpos})
end
self.object:remove()
end
end
end
if self.lastpos.x ~= nil then
if minetest.registered_nodes[node.name].walkable then
if self.node ~= "" then
minetest.set_node(self.lastpos, {name="default:torch"})
minetest.sound_play("default_place_node", {pos = self.lastpos})
end
self.object:remove()
end
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
minetest.register_entity("throwing:arrow_fire_entity", THROWING_ARROW_ENTITY)
minetest.register_craft({
output = "throwing:arrow_fire 1",
recipe = {
{"default:stick", "default:stick", "default:torch"},
},
})
minetest.register_craft({
output = "throwing:arrow_fire 1",
recipe = {
{"default:torch", "default:stick", "default:stick"},
},
})

98
mods/throwing/golden_arrow.lua Executable file
View File

@ -0,0 +1,98 @@
minetest.register_craftitem("throwing:arrow_gold", {
description = "Golden Arrow",
inventory_image = "throwing_arrow_gold.png",
})
minetest.register_node("throwing:arrow_gold_box", {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
-- Shaft
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
-- Spitze
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
-- Federn
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
}
},
tiles = {"throwing_arrow_gold.png", "throwing_arrow_gold.png", "throwing_arrow_gold_back.png", "throwing_arrow_gold_front.png", "throwing_arrow_gold_2.png", "throwing_arrow_gold.png"},
groups = {not_in_creative_inventory = 1},
})
local THROWING_arrow_gold_ENTITY = {
physical = false,
timer = 0,
visual = "wielditem",
visual_size = {x = 0.125, y = 0.125},
textures = {"throwing:arrow_gold_box"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
}
THROWING_arrow_gold_ENTITY.on_step = function(self, dtime)
self.timer = self.timer + dtime
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer > 0.2 then
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "throwing:arrow_gold_entity" and obj:get_luaentity().name ~= "__builtin:item" then
local damage = 5
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage},
}, nil)
minetest.sound_play("throwing_arrow", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
else
local damage = 5
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage},
}, nil)
minetest.sound_play("throwing_arrow", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
end
end
if self.lastpos.x ~= nil then
if minetest.registered_nodes[node.name].walkable then
if not minetest.setting_getbool("creative_mode") then
minetest.add_item(self.lastpos, "throwing:arrow_gold")
end
minetest.sound_play("throwing_arrow", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
minetest.register_entity("throwing:arrow_gold_entity", THROWING_arrow_gold_ENTITY)
minetest.register_craft({
output = "throwing:arrow_gold 16",
recipe = {
{"default:stick", "default:stick", "default:gold_ingot"},
}
})
minetest.register_craft({
output = "throwing:arrow_gold 16",
recipe = {
{"default:gold_ingot", "default:stick", "default:stick"},
}
})

188
mods/throwing/init.lua Executable file
View File

@ -0,0 +1,188 @@
arrows = {
{"throwing:arrow", "throwing:arrow_entity"},
{"throwing:arrow_gold", "throwing:arrow_gold_entity"},
{"throwing:arrow_fire", "throwing:arrow_fire_entity"},
{"throwing:arrow_teleport", "throwing:arrow_teleport_entity"},
{"throwing:arrow_dig", "throwing:arrow_dig_entity"},
{"throwing:arrow_dig_admin", "throwing:arrow_dig_admin_entity"},
{"throwing:arrow_build", "throwing:arrow_build_entity"}
}
local throwing_shoot_arrow = function(itemstack, player)
for _,arrow in ipairs(arrows) do
if player:get_inventory():get_stack("main", player:get_wield_index()+1):get_name() == arrow[1] then
if not minetest.setting_getbool("creative_mode") then
player:get_inventory():remove_item("main", arrow[1])
end
local playerpos = player:getpos()
local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, arrow[2])
local dir = player:get_look_dir()
obj:setvelocity({x=dir.x*19, y=dir.y*19, z=dir.z*19})
obj:setacceleration({x=dir.x*-3, y=-10, z=dir.z*-3})
obj:setyaw(player:get_look_yaw()+math.pi)
minetest.sound_play("throwing_sound", {pos=playerpos, gain = 0.5})
if obj:get_luaentity().player == "" then
obj:get_luaentity().player = player
end
obj:get_luaentity().node = player:get_inventory():get_stack("main", 1):get_name()
return true
end
end
return false
end
minetest.register_tool("throwing:bow_wood", {
description = "Wooden Bow",
inventory_image = "throwing_bow_wood.png",
on_use = function(itemstack, user, pointed_thing)
if throwing_shoot_arrow(itemstack, user, pointed_thing) then
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/30)
end
end
return itemstack
end,
})
minetest.register_craft({
output = "throwing:bow_wood",
recipe = {
{"farming:cotton", "default:wood", ""},
{"farming:cotton", "", "default:wood"},
{"farming:cotton", "default:wood", ""},
}
})
minetest.register_tool("throwing:bow_stone", {
description = "Stone Bow",
inventory_image = "throwing_bow_stone.png",
on_use = function(itemstack, user, pointed_thing)
if throwing_shoot_arrow(item, user, pointed_thing) then
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/90)
end
end
return itemstack
end,
})
minetest.register_craft({
output = "throwing:bow_stone",
recipe = {
{"farming:cotton", "default:cobble", ""},
{"farming:cotton", "", "default:cobble"},
{"farming:cotton", "default:cobble", ""},
}
})
minetest.register_tool("throwing:bow_steel", {
description = "Steel Bow",
inventory_image = "throwing_bow_steel.png",
on_use = function(itemstack, user, pointed_thing)
if throwing_shoot_arrow(item, user, pointed_thing) then
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/200)
end
end
return itemstack
end,
})
minetest.register_craft({
output = "throwing:bow_steel",
recipe = {
{"farming:cotton", "default:steel_ingot", ""},
{"farming:cotton", "", "default:steel_ingot"},
{"farming:cotton", "default:steel_ingot", ""},
}
})
minetest.register_tool("throwing:bow_bronze", {
description = "Bronze Bow",
inventory_image = "throwing_bow_bronze.png",
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
if throwing_shoot_arrow(item, user, pointed_thing) then
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/220)
end
end
return itemstack
end,
})
minetest.register_craft({
output = "throwing:bow_bronze",
recipe = {
{"farming:cotton", "default:bronze_ingot", ""},
{"farming:cotton", "", "default:bronze_ingot"},
{"farming:cotton", "default:bronze_ingot", ""},
}
})
minetest.register_tool("throwing:bow_mese", {
description = "Mese Bow",
inventory_image = "throwing_bow_mese.png",
on_use = function(itemstack, user, pointed_thing)
if throwing_shoot_arrow(item, user, pointed_thing) then
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/350)
end
end
return itemstack
end,
})
minetest.register_craft({
output = "throwing:bow_mese",
recipe = {
{"farming:cotton", "default:mese_crystal", ""},
{"farming:cotton", "", "default:mese_crystal"},
{"farming:cotton", "default:mese_crystal", ""},
}
})
minetest.register_tool("throwing:bow_diamond", {
description = "Diamond Bow",
inventory_image = "throwing_bow_diamond.png",
on_use = function(itemstack, user, pointed_thing)
if throwing_shoot_arrow(item, user, pointed_thing) then
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/500)
end
end
return itemstack
end,
})
minetest.register_craft({
output = "throwing:bow_diamond",
recipe = {
{"farming:cotton", "default:diamond", ""},
{"farming:cotton", "", "default:diamond"},
{"farming:cotton", "default:diamond", ""},
}
})
dofile(minetest.get_modpath("throwing") .. "/arrow.lua")
dofile(minetest.get_modpath("throwing") .. "/golden_arrow.lua")
dofile(minetest.get_modpath("throwing") .. "/fire_arrow.lua")
dofile(minetest.get_modpath("throwing") .. "/teleport_arrow.lua")
dofile(minetest.get_modpath("throwing") .. "/dig_arrow.lua")
dofile(minetest.get_modpath("throwing") .. "/dig_arrow_admin.lua")
dofile(minetest.get_modpath("throwing") .. "/build_arrow.lua")
if minetest.setting_getbool("log_mods") then
minetest.log("action", "Carbone: [throwing] loaded.")
end

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,98 @@
minetest.register_craftitem("throwing:arrow_teleport", {
description = "Teleport Arrow",
inventory_image = "throwing_arrow_teleport.png",
})
minetest.register_node("throwing:arrow_teleport_box", {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
-- Shaft
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
-- Spitze
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
-- Federn
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
}
},
tiles = {"throwing_arrow_teleport.png", "throwing_arrow_teleport.png", "throwing_arrow_teleport_back.png", "throwing_arrow_teleport_front.png", "throwing_arrow_teleport_2.png", "throwing_arrow_teleport.png"},
groups = {not_in_creative_inventory = 1},
})
local THROWING_ARROW_ENTITY = {
physical = false,
timer = 0,
visual = "wielditem",
visual_size = {x = 0.125, y = 0.125},
textures = {"throwing:arrow_teleport_box"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
player = "",
}
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
self.timer = self.timer + dtime
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer > 0.2 then
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 2)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "throwing:arrow_teleport_entity" and obj:get_luaentity().name ~= "__builtin:item" then
if self.player ~= "" then
self.player:setpos(pos)
self.player:get_inventory():add_item("main", ItemStack("throwing:arrow_teleport"))
minetest.sound_play("throwing_teleport_arrow", {pos = self.lastpos})
end
self.object:remove()
end
else
if self.player ~= "" then
self.player:setpos(pos)
self.player:get_inventory():add_item("main", ItemStack("throwing:arrow_teleport"))
minetest.sound_play("throwing_teleport_arrow", {pos = self.lastpos})
end
self.object:remove()
end
end
end
if self.lastpos.x ~= nil then
if minetest.registered_nodes[node.name].walkable then
if self.player ~= "" then
self.player:setpos(self.lastpos)
self.player:get_inventory():add_item("main", ItemStack("throwing:arrow_teleport"))
minetest.sound_play("throwing_teleport_arrow", {pos = self.lastpos})
end
self.object:remove()
end
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
minetest.register_entity("throwing:arrow_teleport_entity", THROWING_ARROW_ENTITY)
minetest.register_craft({
output = "throwing:arrow_teleport",
recipe = {
{"default:stick", "default:stick", "default:diamond"},
}
})
minetest.register_craft({
output = "throwing:arrow_teleport",
recipe = {
{"default:diamond", "default:stick", "default:stick"},
}
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 425 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B