summaryrefslogtreecommitdiff
path: root/castle_weapons
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-03-17 16:53:18 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-03-17 16:53:18 -0400
commit907e8bf6a64215a516fdf16869dd81248aeaa2f6 (patch)
treed199282e5764c7ab5183fe0d78ed0412dbb0b89f /castle_weapons
parent06d9243586cecb1abed74550ce2544b436572a35 (diff)
downloaddreambuilder_modpack-907e8bf6a64215a516fdf16869dd81248aeaa2f6.tar
dreambuilder_modpack-907e8bf6a64215a516fdf16869dd81248aeaa2f6.tar.gz
dreambuilder_modpack-907e8bf6a64215a516fdf16869dd81248aeaa2f6.tar.bz2
dreambuilder_modpack-907e8bf6a64215a516fdf16869dd81248aeaa2f6.tar.xz
dreambuilder_modpack-907e8bf6a64215a516fdf16869dd81248aeaa2f6.zip
update digilines, technic, unified inventory,
and switched castles to the new modpack form
Diffstat (limited to 'castle_weapons')
-rw-r--r--castle_weapons/LICENSE21
-rw-r--r--castle_weapons/README.txt16
-rw-r--r--castle_weapons/battleaxe.lua28
-rw-r--r--castle_weapons/crossbow.lua451
-rw-r--r--castle_weapons/depends.txt2
-rw-r--r--castle_weapons/description.txt1
-rw-r--r--castle_weapons/init.lua7
-rw-r--r--castle_weapons/intllib.lua45
-rw-r--r--castle_weapons/locale/template.pot29
-rw-r--r--castle_weapons/mod.conf1
-rw-r--r--castle_weapons/models/LICENSE.txt10
-rw-r--r--castle_weapons/models/castle_crossbow_bolt.b3dbin0 -> 21158 bytes
-rw-r--r--castle_weapons/models/castle_crossbow_bolt.blendbin0 -> 493796 bytes
-rw-r--r--castle_weapons/models/castle_crossbow_bolt_uv.pngbin0 -> 157 bytes
-rw-r--r--castle_weapons/screenshot.pngbin0 -> 13769 bytes
-rw-r--r--castle_weapons/sounds/LICENSE.txt19
-rw-r--r--castle_weapons/sounds/castle_crossbow_bolt.oggbin0 -> 5967 bytes
-rw-r--r--castle_weapons/sounds/castle_crossbow_click.oggbin0 -> 7377 bytes
-rw-r--r--castle_weapons/sounds/castle_crossbow_reload.oggbin0 -> 12213 bytes
-rw-r--r--castle_weapons/sounds/castle_crossbow_shoot.oggbin0 -> 8112 bytes
-rw-r--r--castle_weapons/textures/LICENSE.txt25
-rw-r--r--castle_weapons/textures/castle_battleaxe.pngbin0 -> 358 bytes
-rw-r--r--castle_weapons/textures/castle_crossbow_bolt_inv.pngbin0 -> 146 bytes
-rw-r--r--castle_weapons/textures/castle_crossbow_hit.pngbin0 -> 516 bytes
-rw-r--r--castle_weapons/textures/castle_crossbow_inv.pngbin0 -> 280 bytes
-rw-r--r--castle_weapons/textures/castle_crossbow_loaded.pngbin0 -> 295 bytes
26 files changed, 655 insertions, 0 deletions
diff --git a/castle_weapons/LICENSE b/castle_weapons/LICENSE
new file mode 100644
index 0000000..456d091
--- /dev/null
+++ b/castle_weapons/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2016 Minetest Mods Team
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/castle_weapons/README.txt b/castle_weapons/README.txt
new file mode 100644
index 0000000..62ec203
--- /dev/null
+++ b/castle_weapons/README.txt
@@ -0,0 +1,16 @@
+=-=-=-=-=-=-=-=-=-=
+
+Castles Mod
+by: Philipbenr And DanDuncombe
+
+=-=-=-=-=-=-=-=-=-=
+
+Licence: MIT, LGPLv2.1 (Crossbow)
+
+see: LICENSE
+
+=-=-=-=-=-=-=-=-=-=
+
+This mod contains a crossbow with bolts, suitable for ranged combat. The crossbow is sourced from the "shooter" mod.
+
+It also contains a battleaxe for fighting up close and personal. \ No newline at end of file
diff --git a/castle_weapons/battleaxe.lua b/castle_weapons/battleaxe.lua
new file mode 100644
index 0000000..f882cf9
--- /dev/null
+++ b/castle_weapons/battleaxe.lua
@@ -0,0 +1,28 @@
+-- internationalization boilerplate
+local MP = minetest.get_modpath(minetest.get_current_modname())
+local S, NS = dofile(MP.."/intllib.lua")
+
+minetest.register_alias("castle:battleaxe", "castle_weapons:battleaxe")
+
+minetest.register_tool("castle_weapons:battleaxe", {
+ description = S("Battleaxe"),
+ inventory_image = "castle_battleaxe.png",
+ tool_capabilities = {
+ full_punch_interval = 2.0,
+ max_drop_level=1,
+ groupcaps={
+ choppy={times={[1]=2.10, [2]=0.90, [3]=0.50}, uses=20, maxlevel=3},
+ snappy={times={[1]=1.90, [2]=0.90, [3]=0.30}, uses=20, maxlevel=3},
+ },
+ damage_groups = {fleshy=7},
+ },
+})
+
+minetest.register_craft({
+ output = "castle_weapons:battleaxe",
+ recipe = {
+ {"default:steel_ingot", "default:steel_ingot","default:steel_ingot"},
+ {"default:steel_ingot", "default:stick","default:steel_ingot"},
+ {"", "default:stick",""}
+ }
+})
diff --git a/castle_weapons/crossbow.lua b/castle_weapons/crossbow.lua
new file mode 100644
index 0000000..f61b752
--- /dev/null
+++ b/castle_weapons/crossbow.lua
@@ -0,0 +1,451 @@
+--[[
+Minetest Mod - Simple Shooter [shooter] 0.5.3
+=======================================
+
+License Source Code: 2013 Stuart Jones - LGPL v2.1
+
+License Textures: Stuart Jones - WTFPL
+
+Licence Models: Stuart Jones - CC-BY-SA 3.0
+
+License Sounds: freesound.org
+
+--]]
+minetest.register_alias("crossbow", "castle_weapons:crossbow")
+minetest.register_alias("bolt", "castle_weapons:crossbow_bolt")
+minetest.register_alias("castle:crossbow", "castle_weapons:crossbow")
+minetest.register_alias("castle:bolt", "castle_weapons:crossbow_bolt")
+minetest.register_alias("castle:crossbow_bolt", "castle_weapons:crossbow_bolt")
+minetest.register_alias("castle:crossbow_loaded", "castle_weapons:crossbow_loaded")
+
+-- internationalization boilerplate
+local MP = minetest.get_modpath(minetest.get_current_modname())
+local S, NS = dofile(MP.."/intllib.lua")
+
+local crossbow={}
+
+CROSSBOW_USES = 300
+CROSSBOW_BOLT_TOOL_CAPS = {damage_groups={fleshy=4}}
+CROSSBOW_BOLT_LIFETIME = 60-- 1 minute
+CROSSBOW_ENABLE_PARTICLE_FX = false
+CROSSBOW_ENABLE_PROTECTION = true
+CROSSBOW_EXPLOSION_TEXTURE = "castle_crossbow_hit.png"
+CROSSBOW_ALLOW_NODES = true
+CROSSBOW_ALLOW_ENTITIES = true
+CROSSBOW_ALLOW_PLAYERS = true
+CROSSBOW_PLAYER_OFFSET = {x=0, y=1, z=0}
+CROSSBOW_ENTITY_OFFSET = {x=0, y=0, z=0}
+CROSSBOW_ENTITIES = {
+"mobs:chicken",
+"mobs:cow",
+"mobs:dirt_monster",
+"mobs:dungeon_master",
+"mobs:goat",
+"mobs:mese_monster",
+"mobs:npc",
+"mobs:oerkki",
+"mobs:pig",
+"mobs:pumba",
+"mobs:rat",
+"mobs:rhino",
+"mobs:sand_monster",
+"mobs:sheep",
+"mobs:spider",
+"mobs:stone_monster",
+"mobs:tree_monster",
+}
+
+if minetest.is_singleplayer() == true then
+ CROSSBOW_ALLOW_ENTITIES = true
+ CROSSBOW_ALLOW_PLAYERS = true
+end
+
+local allowed_entities = {}
+for _,v in ipairs(CROSSBOW_ENTITIES) do
+ allowed_entities[v] = 1
+end
+
+local function get_dot_product(v1, v2)
+ return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z
+end
+
+local function get_particle_pos(p, v, d)
+ return vector.add(p, vector.multiply(v, {x=d, y=d, z=d}))
+end
+
+function crossbow:spawn_particles(pos, texture)
+ if CROSSBOW_ENABLE_PARTICLE_FX == true then
+ if type(texture) ~= "string" then
+ texture = CROSSBOW_EXPLOSION_TEXTURE
+ end
+ local spread = {x=0.1, y=0.1, z=0.1}
+ minetest.add_particlespawner(15, 0.3,
+ vector.subtract(pos, spread), vector.add(pos, spread),
+ {x=-1, y=1, z=-1}, {x=1, y=2, z=1},
+ {x=-2, y=-2, z=-2}, {x=2, y=-2, z=2},
+ 0.1, 0.75, 1, 2, false, texture
+ )
+ end
+end
+
+function crossbow:punch_node(pos, def)
+ local node = minetest.get_node(pos)
+ if not node then
+ return
+ end
+ local item = minetest.registered_items[node.name]
+ if not item then
+ return
+ end
+ if CROSSBOW_ENABLE_PROTECTION then
+ if minetest.is_protected(pos, def.name) then
+ return
+ end
+ end
+ if item.groups then
+ for k, v in pairs(def.groups) do
+ local level = item.groups[k] or 0
+ if level >= v then
+ minetest.remove_node(pos)
+ if item.tiles then
+ if item.tiles[1] then
+ crossbow:spawn_particles(pos, item.tiles[1])
+ end
+ end
+ break
+ end
+ end
+ end
+end
+
+function crossbow:is_valid_object(object)
+ if object then
+ if object:is_player() == true then
+ return CROSSBOW_ALLOW_PLAYERS
+ end
+ if CROSSBOW_ALLOW_ENTITIES == true then
+ local luaentity = object:get_luaentity()
+ if luaentity then
+ if luaentity.name then
+ if allowed_entities[luaentity.name] then
+ return true
+ end
+ end
+ end
+ end
+ end
+end
+
+function crossbow:get_intersect_pos(ray, plane, collisionbox)
+ local v = vector.subtract(ray.pos, plane.pos)
+ local r1 = get_dot_product(v, plane.normal)
+ local r2 = get_dot_product(ray.dir, plane.normal)
+ if r2 ~= 0 then
+ local t = -(r1 / r2)
+ local td = vector.multiply(ray.dir, {x=t, y=t, z=t})
+ local pt = vector.add(ray.pos, td)
+ local pd = vector.subtract(pt, plane.pos)
+ if math.abs(pd.x) < collisionbox[4] and
+ math.abs(pd.y) < collisionbox[5] and
+ math.abs(pd.z) < collisionbox[6] then
+ return pt
+ end
+ end
+end
+
+function crossbow:process_round(round)
+ local target = {object=nil, distance=10000}
+ local p1 = round.pos
+ local v1 = round.ray
+ for _,ref in ipairs(castle.objects) do
+ local p2 = vector.add(ref.pos, ref.offset)
+ if p1 and p2 and ref.name ~= round.name then
+ local d = vector.distance(p1, p2)
+ if d < round.def.step and d < target.distance then
+ local ray = {pos=p1, dir=v1}
+ local plane = {pos=p2, normal={x=-1, y=0, z=-1}}
+ local pos = crossbow:get_intersect_pos(ray, plane, ref.collisionbox)
+ if pos then
+ target.object = ref.object
+ target.pos = pos
+ target.distance = d
+ end
+ end
+ end
+ end
+ if target.object and target.pos then
+ local success, pos = minetest.line_of_sight(p1, target.pos, 1)
+ if success then
+ local user = minetest.get_player_by_name(round.name)
+ if user then
+ target.object:punch(user, nil, round.def.tool_caps, v1)
+ crossbow:spawn_particles(target.pos, CROSSBOW_EXPLOSION_TEXTURE)
+ end
+ return 1
+ elseif pos and CROSSBOW_ALLOW_NODES == true then
+ crossbow:punch_node(pos, round.def)
+ return 1
+ end
+ elseif CROSSBOW_ALLOW_NODES == true then
+ local d = round.def.step
+ local p2 = vector.add(p1, vector.multiply(v1, {x=d, y=d, z=d}))
+ local success, pos = minetest.line_of_sight(p1, p2, 1)
+ if pos then
+ crossbow:punch_node(pos, round.def)
+ return 1
+ end
+ end
+end
+
+local function get_animation_frame(dir)
+ local angle = math.atan(dir.y)
+ local frame = 90 - math.floor(angle * 360 / math.pi)
+ if frame < 1 then
+ frame = 1
+ elseif frame > 180 then
+ frame = 180
+ end
+ return frame
+end
+
+local function get_target_pos(p1, p2, dir, offset)
+ local d = vector.distance(p1, p2) - offset
+ local td = vector.multiply(dir, {x=d, y=d, z=d})
+ return vector.add(p1, td)
+end
+
+local function punch_object(puncher, object)
+ if puncher and crossbow:is_valid_object(object) then
+ if puncher ~= object then
+ local dir = puncher:get_look_dir()
+ local p1 = puncher:getpos()
+ local p2 = object:getpos()
+ local tpos = get_target_pos(p1, p2, dir, 0)
+ crossbow:spawn_particles(tpos, CROSSBOW_EXPLOSION_TEXTURE)
+ object:punch(puncher, nil, CROSSBOW_BOLT_TOOL_CAPS, dir)
+ end
+ end
+end
+
+local function stop_crossbow_bolt(object, pos, stuck)
+ local acceleration = {x=0, y=-10, z=0}
+ if stuck == true then
+ pos = pos or object:getpos()
+ acceleration = {x=0, y=0, z=0}
+ object:moveto(pos)
+ end
+ object:set_properties({
+ physical = true,
+ collisionbox = {-1/8,-1/8,-1/8, 1/8,1/8,1/8},
+ })
+ object:setvelocity({x=0, y=0, z=0})
+ object:setacceleration(acceleration)
+end
+
+minetest.register_craftitem("castle_weapons:crossbow_bolt", {
+ description = S("Bolt"),
+ stack_max = 20,
+ inventory_image = "castle_crossbow_bolt_inv.png",
+})
+
+minetest.register_entity("castle_weapons:crossbow_bolt_entity", {
+ physical = false,
+ visual = "mesh",
+ mesh = "castle_crossbow_bolt.b3d",
+ visual_size = {x=1.0, y=1.0},
+ textures = {
+ "castle_crossbow_bolt_uv.png"
+ },
+ timer = 0,
+ lifetime = CROSSBOW_BOLT_LIFETIME,
+ player = nil,
+ state = "init",
+ node_pos = nil,
+ collisionbox = {0,0,0, 0,0,0},
+ on_activate = function(self, staticdata)
+ self.object:set_armor_groups({immortal=1})
+ if staticdata == "expired" then
+ self.object:remove()
+ end
+ end,
+ on_punch = function(self, puncher)
+ if puncher then
+ if puncher:is_player() then
+ local stack = "castle_weapons:crossbow_bolt"
+ local inv = puncher:get_inventory()
+ if inv:room_for_item("main", stack) then
+ inv:add_item("main", stack)
+ self.object:remove()
+ end
+ end
+ end
+ end,
+ on_step = function(self, dtime)
+ if self.state == "init" then
+ return
+ end
+ self.timer = self.timer + dtime
+ self.lifetime = self.lifetime - dtime
+ if self.lifetime < 0 then
+ self.object:remove()
+ return
+ elseif self.state == "dropped" then
+ return
+ elseif self.state == "stuck" then
+ if self.timer > 1 then
+ if self.node_pos then
+ local node = minetest.get_node(self.node_pos)
+ if node.name then
+ local item = minetest.registered_items[node.name]
+ if item then
+ if not item.walkable then
+ self.state = "dropped"
+ stop_crossbow_bolt(self.object)
+ return
+ end
+ end
+ end
+ end
+ self.timer = 0
+ end
+ return
+ end
+ if self.timer > 0.2 then
+ local pos = self.object:getpos()
+ local dir = vector.normalize(self.object:getvelocity())
+ local frame = get_animation_frame(dir)
+ self.object:set_animation({x=frame, y=frame}, 0)
+ local objects = minetest.get_objects_inside_radius(pos, 5)
+ for _,obj in ipairs(objects) do
+ if crossbow:is_valid_object(obj) then
+ local collisionbox = {-0.25,-1.0,-0.25, 0.25,0.8,0.25}
+ local offset = CROSSBOW_PLAYER_OFFSET
+ if not obj:is_player() then
+ offset = CROSSBOW_ENTITY_OFFSET
+ local ent = obj:get_luaentity()
+ if ent then
+ local def = minetest.registered_entities[ent.name]
+ collisionbox = def.collisionbox or collisionbox
+ end
+ end
+ local opos = vector.add(obj:getpos(), offset)
+ local ray = {pos=pos, dir=dir}
+ local plane = {pos=opos, normal={x=-1, y=0, z=-1}}
+ local ipos = crossbow:get_intersect_pos(ray, plane, collisionbox)
+ if ipos then
+ punch_object(self.player, obj)
+ end
+ end
+ end
+ local p = vector.add(pos, vector.multiply(dir, {x=5, y=5, z=5}))
+ local _, npos = minetest.line_of_sight(pos, p, 1)
+ if npos then
+ local node = minetest.get_node(npos)
+ local tpos = get_target_pos(pos, npos, dir, 0.66)
+ self.node_pos = npos
+ self.state = "stuck"
+ stop_crossbow_bolt(self.object, tpos, true)
+ minetest.sound_play("castle_crossbow_bolt", {gain = 0.08, max_hear_distance = 2})
+ end
+ self.timer = 0
+ end
+ end,
+ get_staticdata = function(self)
+ return "expired"
+ end,
+})
+
+ minetest.register_tool("castle_weapons:crossbow_loaded", {
+ description = S("Crossbow"),
+ inventory_image = "castle_crossbow_loaded.png",
+ groups = {not_in_creative_inventory=1},
+ on_use = function(itemstack, user, pointed_thing)
+ minetest.sound_play("castle_crossbow_click", {object=user})
+ if not minetest.setting_getbool("creative_mode") then
+ itemstack:add_wear(65535/CROSSBOW_USES)
+ end
+ itemstack = "castle_weapons:crossbow 1 "..itemstack:get_wear()
+ local pos = user:getpos()
+ local dir = user:get_look_dir()
+ local yaw = user:get_look_yaw()
+ if pos and dir and yaw then
+ pos.y = pos.y + 1.5
+ local obj = minetest.add_entity(pos, "castle_weapons:crossbow_bolt_entity")
+ local ent = nil
+ if obj then
+ ent = obj:get_luaentity()
+ end
+ if ent then
+ obj:set_properties({
+ textures = {"castle_crossbow_bolt_uv.png"}
+ })
+ minetest.sound_play("castle_crossbow_shoot", {object=obj})
+ local frame = get_animation_frame(dir)
+ obj:setyaw(yaw + math.pi)
+ obj:set_animation({x=frame, y=frame}, 0)
+ obj:setvelocity({x=dir.x * 14, y=dir.y * 14, z=dir.z * 14})
+ if pointed_thing.type ~= "nothing" then
+ local ppos = minetest.get_pointed_thing_position(pointed_thing, false)
+ local _, npos = minetest.line_of_sight(pos, ppos, 1)
+ if npos then
+ ppos = npos
+ pointed_thing.type = "node"
+ end
+ if pointed_thing.type == "object" then
+ punch_object(user, pointed_thing.ref)
+ elseif pointed_thing.type == "node" then
+ local node = minetest.get_node(ppos)
+ local tpos = get_target_pos(pos, ppos, dir, 0.66)
+ minetest.after(0.2, function(object, pos, npos)
+ ent.node_pos = npos
+ ent.state = "stuck"
+ stop_crossbow_bolt(object, pos, true)
+ minetest.sound_play("castle_crossbow_bolt", {gain = 0.08, max_hear_distance = 2})
+ end, obj, tpos, ppos)
+ return itemstack
+ end
+ end
+ obj:setacceleration({x=dir.x * -3, y=-5, z=dir.z * -3})
+ ent.player = ent.player or user
+ ent.state = "flight"
+ end
+ end
+ return itemstack
+ end,
+ })
+
+minetest.register_tool("castle_weapons:crossbow", {
+ description = S("Crossbow"),
+ inventory_image = "castle_crossbow_inv.png",
+ on_use = function(itemstack, user, pointed_thing)
+ local inv = user:get_inventory()
+if inv:contains_item("main", "castle_weapons:crossbow_bolt") then
+ minetest.sound_play("castle_crossbow_reload", {object=user})
+ if not minetest.setting_getbool("creative_mode") then
+ inv:remove_item("main", "castle_weapons:crossbow_bolt 1")
+ end
+ return "castle_weapons:crossbow_loaded 1 "..itemstack:get_wear()
+ end
+ minetest.sound_play("castle_crossbow_click", {object=user})
+ end,
+})
+
+-----------
+--Crafting
+-----------
+
+minetest.register_craft({
+ output = 'castle_weapons:crossbow',
+ recipe = {
+ {'default:steel_ingot', 'default:stick', 'default:steel_ingot'},
+ {'farming:string', 'farming:string', 'farming:string'},
+ {'', 'default:stick', ''},
+ }
+})
+
+minetest.register_craft({
+ output = "castle_weapons:crossbow_bolt 6",
+ recipe = {
+ {'default:stick', 'default:stick', 'default:steel_ingot'},
+ }
+}) \ No newline at end of file
diff --git a/castle_weapons/depends.txt b/castle_weapons/depends.txt
new file mode 100644
index 0000000..9207dab
--- /dev/null
+++ b/castle_weapons/depends.txt
@@ -0,0 +1,2 @@
+default
+intllib?
diff --git a/castle_weapons/description.txt b/castle_weapons/description.txt
new file mode 100644
index 0000000..e4dc9f1
--- /dev/null
+++ b/castle_weapons/description.txt
@@ -0,0 +1 @@
+Provides several medieval weapons for use around castles \ No newline at end of file
diff --git a/castle_weapons/init.lua b/castle_weapons/init.lua
new file mode 100644
index 0000000..20d3df3
--- /dev/null
+++ b/castle_weapons/init.lua
@@ -0,0 +1,7 @@
+local MP = minetest.get_modpath(minetest.get_current_modname())
+
+dofile(MP.."/crossbow.lua")
+dofile(MP.."/battleaxe.lua")
+
+
+
diff --git a/castle_weapons/intllib.lua b/castle_weapons/intllib.lua
new file mode 100644
index 0000000..6669d72
--- /dev/null
+++ b/castle_weapons/intllib.lua
@@ -0,0 +1,45 @@
+
+-- Fallback functions for when `intllib` is not installed.
+-- Code released under Unlicense <http://unlicense.org>.
+
+-- Get the latest version of this file at:
+-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
+
+local function format(str, ...)
+ local args = { ... }
+ local function repl(escape, open, num, close)
+ if escape == "" then
+ local replacement = tostring(args[tonumber(num)])
+ if open == "" then
+ replacement = replacement..close
+ end
+ return replacement
+ else
+ return "@"..open..num..close
+ end
+ end
+ return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
+end
+
+local gettext, ngettext
+if minetest.get_modpath("intllib") then
+ if intllib.make_gettext_pair then
+ -- New method using gettext.
+ gettext, ngettext = intllib.make_gettext_pair()
+ else
+ -- Old method using text files.
+ gettext = intllib.Getter()
+ end
+end
+
+-- Fill in missing functions.
+
+gettext = gettext or function(msgid, ...)
+ return format(msgid, ...)
+end
+
+ngettext = ngettext or function(msgid, msgid_plural, n, ...)
+ return format(n==1 and msgid or msgid_plural, ...)
+end
+
+return gettext, ngettext
diff --git a/castle_weapons/locale/template.pot b/castle_weapons/locale/template.pot
new file mode 100644
index 0000000..79f7a19
--- /dev/null
+++ b/castle_weapons/locale/template.pot
@@ -0,0 +1,29 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-02-25 19:35-0700\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: battleaxe.lua:8
+msgid "Battleaxe"
+msgstr ""
+
+#: crossbow.lua:244
+msgid "Bolt"
+msgstr ""
+
+#: crossbow.lua:357 crossbow.lua:416
+msgid "Crossbow"
+msgstr ""
diff --git a/castle_weapons/mod.conf b/castle_weapons/mod.conf
new file mode 100644
index 0000000..456a415
--- /dev/null
+++ b/castle_weapons/mod.conf
@@ -0,0 +1 @@
+name = castle_weapons
diff --git a/castle_weapons/models/LICENSE.txt b/castle_weapons/models/LICENSE.txt
new file mode 100644
index 0000000..7c019e6
--- /dev/null
+++ b/castle_weapons/models/LICENSE.txt
@@ -0,0 +1,10 @@
+License Textures: Stuart Jones - WTFPL
+
+-castle_crossbow_bolt_inv.png
+-castle_crossbow_bolt_uv.png
+-castle_crossbow_hit.png
+
+Licence Models: Stuart Jones - CC-BY-SA 3.0
+
+-castle_crossbow_bolt.b3d
+-castle_crossbow_bolt.blend \ No newline at end of file
diff --git a/castle_weapons/models/castle_crossbow_bolt.b3d b/castle_weapons/models/castle_crossbow_bolt.b3d
new file mode 100644
index 0000000..d24be3c
--- /dev/null
+++ b/castle_weapons/models/castle_crossbow_bolt.b3d
Binary files differ
diff --git a/castle_weapons/models/castle_crossbow_bolt.blend b/castle_weapons/models/castle_crossbow_bolt.blend
new file mode 100644
index 0000000..4cf5f43
--- /dev/null
+++ b/castle_weapons/models/castle_crossbow_bolt.blend
Binary files differ
diff --git a/castle_weapons/models/castle_crossbow_bolt_uv.png b/castle_weapons/models/castle_crossbow_bolt_uv.png
new file mode 100644
index 0000000..b7d29c5
--- /dev/null
+++ b/castle_weapons/models/castle_crossbow_bolt_uv.png
Binary files differ
diff --git a/castle_weapons/screenshot.png b/castle_weapons/screenshot.png
new file mode 100644
index 0000000..d23d181
--- /dev/null
+++ b/castle_weapons/screenshot.png
Binary files differ
diff --git a/castle_weapons/sounds/LICENSE.txt b/castle_weapons/sounds/LICENSE.txt
new file mode 100644
index 0000000..b127b0e
--- /dev/null
+++ b/castle_weapons/sounds/LICENSE.txt
@@ -0,0 +1,19 @@
+License Sounds
+------------------
+
+(From Simple Shooter mod by Stuart Jones)
+-castle_crossbow_click.ogg
+-castle_crossbow_shoot.ogg
+-castle_crossbow_reload.ogg
+
+Author : freesound.org
+License : Attribution 3.0 Unported (CC BY 3.0)
+CC0 1.0 Universal (CC0 1.0)
+
+------------------
+
+(From Minetest Game:default mod)
+-default_wood_footstep.1.ogg
+(renamed to : castle_crossbow_bolt.ogg)
+Author : Mito551
+License : (CC BY-SA)
diff --git a/castle_weapons/sounds/castle_crossbow_bolt.ogg b/castle_weapons/sounds/castle_crossbow_bolt.ogg
new file mode 100644
index 0000000..34f63a1
--- /dev/null
+++ b/castle_weapons/sounds/castle_crossbow_bolt.ogg
Binary files differ
diff --git a/castle_weapons/sounds/castle_crossbow_click.ogg b/castle_weapons/sounds/castle_crossbow_click.ogg
new file mode 100644
index 0000000..8e60db8
--- /dev/null
+++ b/castle_weapons/sounds/castle_crossbow_click.ogg
Binary files differ
diff --git a/castle_weapons/sounds/castle_crossbow_reload.ogg b/castle_weapons/sounds/castle_crossbow_reload.ogg
new file mode 100644
index 0000000..47f7245
--- /dev/null
+++ b/castle_weapons/sounds/castle_crossbow_reload.ogg
Binary files differ
diff --git a/castle_weapons/sounds/castle_crossbow_shoot.ogg b/castle_weapons/sounds/castle_crossbow_shoot.ogg
new file mode 100644
index 0000000..9ce9176
--- /dev/null
+++ b/castle_weapons/sounds/castle_crossbow_shoot.ogg
Binary files differ
diff --git a/castle_weapons/textures/LICENSE.txt b/castle_weapons/textures/LICENSE.txt
new file mode 100644
index 0000000..0ecff29
--- /dev/null
+++ b/castle_weapons/textures/LICENSE.txt
@@ -0,0 +1,25 @@
+--------------------------------------------
+
+License Textures: Stuart Jones - WTFPL
+-castle_crossbow_bolt_inv.png
+-castle_crossbow_bolt_uv.png
+-castle_crossbow_hit.png
+
+Licence Models: Stuart Jones - CC-BY-SA 3.0
+-castle_crossbow_bolt.b3d
+-castle_crossbow_bolt.blend
+
+
+--------------------------------------------
+
+16 px textures based on Castle mod
+original textures by Philipner
+
+License Textures: Napiophelios - CC-BY-SA 3.0
+
+-castle_battleaxe.png
+-castle_crossbow_bolt_inv.png
+-castle_crossbow_hit.png
+-castle_crossbow_loaded.png
+
+--------------------------------------------
diff --git a/castle_weapons/textures/castle_battleaxe.png b/castle_weapons/textures/castle_battleaxe.png
new file mode 100644
index 0000000..4f7f738
--- /dev/null
+++ b/castle_weapons/textures/castle_battleaxe.png
Binary files differ
diff --git a/castle_weapons/textures/castle_crossbow_bolt_inv.png b/castle_weapons/textures/castle_crossbow_bolt_inv.png
new file mode 100644
index 0000000..87cd847
--- /dev/null
+++ b/castle_weapons/textures/castle_crossbow_bolt_inv.png
Binary files differ
diff --git a/castle_weapons/textures/castle_crossbow_hit.png b/castle_weapons/textures/castle_crossbow_hit.png
new file mode 100644
index 0000000..0a2b2f3
--- /dev/null
+++ b/castle_weapons/textures/castle_crossbow_hit.png
Binary files differ
diff --git a/castle_weapons/textures/castle_crossbow_inv.png b/castle_weapons/textures/castle_crossbow_inv.png
new file mode 100644
index 0000000..39bcf07
--- /dev/null
+++ b/castle_weapons/textures/castle_crossbow_inv.png
Binary files differ
diff --git a/castle_weapons/textures/castle_crossbow_loaded.png b/castle_weapons/textures/castle_crossbow_loaded.png
new file mode 100644
index 0000000..ca2dca7
--- /dev/null
+++ b/castle_weapons/textures/castle_crossbow_loaded.png
Binary files differ