Add files via upload

master
Steamed-Punk 2019-09-19 02:01:21 +02:00 committed by GitHub
parent 25940394de
commit 1bbc80c19f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 1001 additions and 0 deletions

299
bbcanoe.lua Normal file
View File

@ -0,0 +1,299 @@
--
-- Helper functions
--
local function is_water(pos)
local nn = minetest.get_node(pos).name
return minetest.get_item_group(nn, "water") ~= 0
end
local function get_sign(i)
if i == 0 then
return 0
else
return i / math.abs(i)
end
end
local function get_velocity(v, yaw, y)
local x = -math.sin(yaw) * v
local z = math.cos(yaw) * v
return {x = x, y = y, z = z}
end
local function get_v(v)
return math.sqrt(v.x ^ 2 + v.z ^ 2)
end
--
-- Boat entity
--
local boat = {
initial_properties = {
physical = true,
-- Warning: Do not change the position of the collisionbox top surface,
-- lowering it causes the boat to fall through the world if underwater
collisionbox = {-0.5, -0.35, -0.5, 0.5, 0.3, 0.5},
visual = "mesh",
mesh = "indianvillage_bbcanoe.obj",
textures = {"indianvillage__bbcanoe.png"},
},
driver = nil,
v = 0,
last_v = 0,
removed = false,
auto = false
}
function boat.on_rightclick(self, clicker)
if not clicker or not clicker:is_player() then
return
end
local name = clicker:get_player_name()
if self.driver and name == self.driver then
self.driver = nil
self.auto = false
clicker:set_detach()
player_api.player_attached[name] = false
player_api.set_animation(clicker, "stand" , 30)
local pos = clicker:get_pos()
pos = {x = pos.x, y = pos.y + 0.2, z = pos.z}
minetest.after(0.1, function()
clicker:set_pos(pos)
end)
elseif not self.driver then
local attach = clicker:get_attach()
if attach and attach:get_luaentity() then
local luaentity = attach:get_luaentity()
if luaentity.driver then
luaentity.driver = nil
end
clicker:set_detach()
end
self.driver = name
clicker:set_attach(self.object, "",
{x = 0.5, y = 1, z = -3}, {x = 0, y = 0, z = 0})
player_api.player_attached[name] = true
minetest.after(0.2, function()
player_api.set_animation(clicker, "sit" , 30)
end)
clicker:set_look_horizontal(self.object:get_yaw())
end
end
-- If driver leaves server while driving boat
function boat.on_detach_child(self, child)
self.driver = nil
self.auto = false
end
function boat.on_activate(self, staticdata, dtime_s)
self.object:set_armor_groups({immortal = 1})
if staticdata then
self.v = tonumber(staticdata)
end
self.last_v = self.v
end
function boat.get_staticdata(self)
return tostring(self.v)
end
function boat.on_punch(self, puncher)
if not puncher or not puncher:is_player() or self.removed then
return
end
local name = puncher:get_player_name()
if self.driver and name == self.driver then
self.driver = nil
puncher:set_detach()
player_api.player_attached[name] = false
end
if not self.driver then
self.removed = true
local inv = puncher:get_inventory()
if not (creative and creative.is_enabled_for
and creative.is_enabled_for(name))
or not inv:contains_item("main", "nativeamericanvillage:bbcanoe") then
local leftover = inv:add_item("main", "nativeamericanvillage:bbcanoe")
-- if no room in inventory add a replacement canoe to the world
if not leftover:is_empty() then
minetest.add_item(self.object:get_pos(), leftover)
end
end
-- delay remove to ensure player is detached
minetest.after(0.1, function()
self.object:remove()
end)
end
end
function boat.on_step(self, dtime)
self.v = get_v(self.object:get_velocity()) * get_sign(self.v)
if self.driver then
local driver_objref = minetest.get_player_by_name(self.driver)
if driver_objref then
local ctrl = driver_objref:get_player_control()
if ctrl.up and ctrl.down then
if not self.auto then
self.auto = true
minetest.chat_send_player(self.driver, "[boats] Cruise on")
end
elseif ctrl.down then
self.v = self.v - dtime * 1.8
if self.auto then
self.auto = false
minetest.chat_send_player(self.driver, "[boats] Cruise off")
end
elseif ctrl.up or self.auto then
self.v = self.v + dtime * 1.8
end
if ctrl.left then
if self.v < -0.001 then
self.object:set_yaw(self.object:get_yaw() - dtime * 0.9)
else
self.object:set_yaw(self.object:get_yaw() + dtime * 0.9)
end
elseif ctrl.right then
if self.v < -0.001 then
self.object:set_yaw(self.object:get_yaw() + dtime * 0.9)
else
self.object:set_yaw(self.object:get_yaw() - dtime * 0.9)
end
end
end
end
local velo = self.object:get_velocity()
if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then
self.object:set_pos(self.object:get_pos())
return
end
local s = get_sign(self.v)
self.v = self.v - dtime * 0.6 * s
if s ~= get_sign(self.v) then
self.object:set_velocity({x = 0, y = 0, z = 0})
self.v = 0
return
end
if math.abs(self.v) > 5 then
self.v = 5 * get_sign(self.v)
end
local p = self.object:get_pos()
p.y = p.y - 0.5
local new_velo
local new_acce = {x = 0, y = 0, z = 0}
if not is_water(p) then
local nodedef = minetest.registered_nodes[minetest.get_node(p).name]
if (not nodedef) or nodedef.walkable then
self.v = 0
new_acce = {x = 0, y = 1, z = 0}
else
new_acce = {x = 0, y = -9.8, z = 0}
end
new_velo = get_velocity(self.v, self.object:get_yaw(),
self.object:get_velocity().y)
self.object:set_pos(self.object:get_pos())
else
p.y = p.y + 1
if is_water(p) then
local y = self.object:get_velocity().y
if y >= 5 then
y = 5
elseif y < 0 then
new_acce = {x = 0, y = 20, z = 0}
else
new_acce = {x = 0, y = 5, z = 0}
end
new_velo = get_velocity(self.v, self.object:get_yaw(), y)
self.object:set_pos(self.object:get_pos())
else
new_acce = {x = 0, y = 0, z = 0}
if math.abs(self.object:get_velocity().y) < 1 then
local pos = self.object:get_pos()
pos.y = math.floor(pos.y) + 0.5
self.object:set_pos(pos)
new_velo = get_velocity(self.v, self.object:get_yaw(), 0)
else
new_velo = get_velocity(self.v, self.object:get_yaw(),
self.object:get_velocity().y)
self.object:set_pos(self.object:get_pos())
end
end
end
self.object:set_velocity(new_velo)
self.object:set_acceleration(new_acce)
end
minetest.register_entity("nativeamericanvillage:bbcanoe", boat)
minetest.register_craftitem("nativeamericanvillage:bbcanoe", {
description = "Canoe",
inventory_image = "item_bbcanoe.png",
wield_image = "item_bbcanoe.png",
wield_scale = {x = 2, y = 2, z = 1},
liquids_pointable = true,
groups = {flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
local under = pointed_thing.under
local node = minetest.get_node(under)
local udef = minetest.registered_nodes[node.name]
if udef and udef.on_rightclick and
not (placer and placer:is_player() and
placer:get_player_control().sneak) then
return udef.on_rightclick(under, node, placer, itemstack,
pointed_thing) or itemstack
end
if pointed_thing.type ~= "node" then
return itemstack
end
if not is_water(pointed_thing.under) then
return itemstack
end
pointed_thing.under.y = pointed_thing.under.y + 0.5
boat = minetest.add_entity(pointed_thing.under, "nativeamericanvillage:bbcanoe")
if boat then
if placer then
boat:set_yaw(placer:get_look_horizontal())
end
local player_name = placer and placer:get_player_name() or ""
if not (creative and creative.is_enabled_for and
creative.is_enabled_for(player_name)) then
itemstack:take_item()
end
end
return itemstack
end,
})
minetest.register_craft({
output = "nativeamericanvillage:bbcanoe",
recipe = {
{'dye:black', '', ''},
{'default:aspen_tree','', 'default:aspen_tree'},
{'default:aspen_tree', 'default:aspen_tree', 'default:aspen_tree'},
}
})
minetest.register_craft({
type = "fuel",
recipe = "nativeamericanvillage:bbcanoe",
burntime = 50,
})

140
buffalo.lua Normal file
View File

@ -0,0 +1,140 @@
local S = mobs.intllib
-- Original Cow Code by Krupnovpavel
-- Wild Buffalo Code, models and textures by Steamed_Punk
-- find and replace what mob is looking for (grass, wheat etc.)
mobs:register_mob("nativeamericanvillage:buffalo", {
type = "animal",
passive = false,
attack_type = "dogfight",
attack_npcs = false,
reach = 3,
damage = 6,
hp_min = 10,
hp_max = 45,
armor = 150,
collisionbox = {0.4,1.5,0.4, -0.4, 0 , -0.4},
visual = "mesh",
mesh = "wildbuffalo.b3d",
textures = {
{"wildbuffalo.png"},
},
makes_footstep_sound = true,
sounds = {
random = "indianvillage_mobs_buffalo",
},
walk_velocity = 1.5,
run_velocity = 3.5,
jump = true,
jump_height = 6,
knock_back = 0.2,
pushable = false,
view_range =35,
attack_chance = 33,
drops = {
{name = "nativeamericanvillage:wildbuffalomeat", chance = 1, min = 1, max = 2},
{name = "nativeamericanvillage:hide", chance = 1, min = 0, max = 2},
{name = "nativeamericanvillage:fat", chance = 1, min = 0, max = 1},
{name = "nativeamericanvillage:horn", chance = 1, min = 0, max = 1},
},
immune_to = {
{"bows:bow_wood", 30},
{"bows:bow_steel", 40},
{"all"}
},
water_damage = 0,
lava_damage = 5,
light_damage = 0,
fear_height = 2,
group_attack = true,
animation = {
speed_normal = 15,
speed_run = 20,
stand_start = 1,
stand_end = 95,
walk_start = 99,
walk_end = 138,
run_start = 99,
run_end = 138,
punch_start = 70,
punch_end = 100,
},
replace_rate = 10,
replace_what = {
{"group:grass", "air", 0},
{"default:dirt_with_grass", "default:dirt", -1}
},
})
mobs:spawn({
name = "nativeamericanvillage:buffalo",
nodes = {"default:dirt_with_grass", "default:dirt_with_dry_grass", "default:dirt_with_snow", "ethereal:green_dirt"},
neighbors = {"default:dirt_with_grass", "default:dirt_with_dry_grass","default:dirt_with_snow", "ethereal:green_dirt"},
min_light = 7,
interval = 30,
chance = 8000, --15000,
active_object_count = 30,
active_object_count_wider = 0,
min_height = 0,
max_height = 3,
day_toggle = true,
})
mobs:register_egg("nativeamericanvillage:buffalo", S("Wild Buffalo"), "default_dirt.png", 1)
-- Buffalo Meat
minetest.register_craftitem(":nativeamericanvillage:wildbuffalomeat", {
description = S("Wild Buffalo Meat"),
inventory_image = "wildbuffalomeat.png",
stack_max = 3,
on_use = minetest.item_eat(4),
groups = {food_meat = 1, flammable = 3},
})
minetest.register_craftitem(":nativeamericanvillage:wildbuffalomeat_cooked", {
description = S("Buffalo Ribs"),
inventory_image = "wildbuffalomeat_cooked.png",
on_use = minetest.item_eat(8),
groups = {food_meat = 1, flammable = 2},
})
minetest.register_craft({
type = "cooking",
output = "nativeamericanvillage:wildbuffalomeat_cooked",
recipe = "nativeamericanvillage:wildbuffalomeat",
cooktime = 5,
})
-- HIDE
minetest.register_craftitem(":nativeamericanvillage:hide", {
description = S("Buffalo Hide"),
inventory_image = "wildbuffalohide.png",
stack_max = 3,
})
-- FAT
minetest.register_craftitem(":nativeamericanvillage:fat", {
description = S("Buffalo Hide"),
inventory_image = "wildbuffalofat.png",
stack_max = 3,
})
-- HORN
minetest.register_craftitem(":nativeamericanvillage:horn", {
description = S("Buffalo Horn"),
inventory_image = "wildbuffalohorn.png",
stack_max = 3,
})

396
campfire.lua Normal file
View File

@ -0,0 +1,396 @@
-- Load support for intllib.
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
-- Original Campfire by Pavel Litvinoff
-- Wild Buffalo Code, models and textures by Steamed_Punk
-- VARIABLES
indianvillage_campfire_cooking = 1; -- nil - not cooked, 1 - cooked
indianvillage_campfire_limit = 3; -- nil - unlimited campfire, 1 - limited
indianvillage_campfire_ttl = 120; -- Time in sec
indianvillage_campfire_stick_time = indianvillage_campfire_ttl/2; -- How long does the stick increase. In sec.
indianvillage_campfire = {}
-- FUNCTIONS
local function fire_particles_on(pos) -- 3 layers of fire
local meta = minetest.get_meta(pos)
local id = minetest.add_particlespawner({ -- 1 layer big particles fire
amount = 9,
time = 1.3,
minpos = {x = pos.x - 0.2, y = pos.y - 0.4, z = pos.z - 0.2},
maxpos = {x = pos.x + 0.2, y = pos.y - 0.1, z = pos.z + 0.2},
minvel = {x= 0, y= 0, z= 0},
maxvel = {x= 0, y= 0.1, z= 0},
minacc = {x= 0, y= 0, z= 0},
maxacc = {x= 0, y= 0.7, z= 0},
minexptime = 0.5,
maxexptime = 0.7,
minsize = 2,
maxsize = 5,
collisiondetection = false,
vertical = true,
texture = "indianvillage__flame_animated.png",
animation = {type="vertical_frames", aspect_w=65, aspect_h=64, length = 0.8,},
-- playername = "singleplayer"
})
meta:set_int("layer_1", id)
local id = minetest.add_particlespawner({ -- 2 layer smol particles fire
amount = 1,
time = 1.3,
minpos = {x = pos.x - 0.1, y = pos.y, z = pos.z - 0.1},
maxpos = {x = pos.x + 0.1, y = pos.y + 0.4, z = pos.z + 0.1},
minvel = {x= 0, y= 0, z= 0},
maxvel = {x= 0, y= 0.1, z= 0},
minacc = {x= 0, y= 0, z= 0},
maxacc = {x= 0, y= 1, z= 0},
minexptime = 0.4,
maxexptime = 0.6,
minsize = 0.5,
maxsize = 0.7,
collisiondetection = false,
vertical = true,
texture = "indianvillage__flame_animated.png",
animation = {type="vertical_frames", aspect_w=64, aspect_h=64, length = 0.7,},
-- playername = "singleplayer"
})
meta:set_int("layer_2", id)
local id = minetest.add_particlespawner({ --3 layer smoke
amount = 1,
time = 1.3,
minpos = {x = pos.x - 0.1, y = pos.y - 0.2, z = pos.z - 0.1},
maxpos = {x = pos.x + 0.2, y = pos.y + 0.4, z = pos.z + 0.2},
minvel = {x= 0, y= 0, z= 0},
maxvel = {x= 0, y= 0.1, z= 0},
minacc = {x= 0, y= 0, z= 0},
maxacc = {x= 0, y= 1, z= 0},
minexptime = 0.6,
maxexptime = 0.8,
minsize = 2,
maxsize = 4,
collisiondetection = true,
vertical = true,
texture = "indianvillage__smoke_animated.png",
animation = {type="vertical_frames", aspect_w=32, aspect_h=32, length = 0.9,},
-- playername = "singleplayer"
})
meta:set_int("layer_3", id)
end
local function fire_particles_off(pos)
local meta = minetest.get_meta(pos)
local id_1 = meta:get_int("layer_1");
local id_2 = meta:get_int("layer_2");
local id_3 = meta:get_int("layer_3");
minetest.delete_particlespawner(id_1)
minetest.delete_particlespawner(id_2)
minetest.delete_particlespawner(id_3)
end
local function indicator(maxVal, curVal)
local percent_val = math.floor(curVal / maxVal * 100)
local progress = ""
local v = percent_val / 10
for k=1,10 do
if v > 0 then
progress = progress..""
else
progress = progress..""
end
v = v - 1
end
return "\n"..progress.." "..percent_val.."%"
end
local function effect(pos, texture, vlc, acc, time, size)
local id = minetest.add_particle({
pos = pos,
velocity = vlc,
acceleration = acc,
expirationtime = time,
size = size,
collisiondetection = true,
vertical = true,
texture = texture,
})
end
local function infotext_edit(meta)
local infotext = S("Active campfire")
if indianvillage_campfire_limit and indianvillage_campfire_ttl > 0 then
local it_val = meta:get_int("it_val");
infotext = infotext..indicator(indianvillage_campfire_ttl, it_val)
end
local cooked_time = meta:get_int('cooked_time');
if indianvillage_campfire_cooking and cooked_time ~= 0 then
local cooked_cur_time = meta:get_int('cooked_cur_time');
infotext = infotext.."\n"..S("Cooking")..indicator(cooked_time, cooked_cur_time)
end
meta:set_string('infotext', infotext)
end
local function cooking(pos, itemstack)
local meta = minetest.get_meta(pos)
local cooked, _ = minetest.get_craft_result({method = "cooking", width = 1, items = {itemstack}})
local cookable = cooked.time ~= 0
if cookable and indianvillage_campfire_cooking then
local eat_y = ItemStack(cooked.item:to_table().name):get_definition().on_use
if string.find(minetest.serialize(eat_y), "do_item_eat") and meta:get_int("cooked_time") == 0 then
meta:set_int('cooked_time', cooked.time);
meta:set_int('cooked_cur_time', 0);
local name = itemstack:to_table().name
local texture = itemstack:get_definition().inventory_image
infotext_edit(meta)
effect(
{x = pos.x, y = pos.y+0.4, z = pos.z},
texture,
{x=0, y=-1/cooked.time, z=0},
{x=0, y=0, z=0},
cooked.time/2,
4
)
minetest.after(cooked.time/2, function()
if meta:get_int("it_val") > 0 then
effect(
{x = pos.x, y = pos.y-0.1, z = pos.z},
texture,
{x=0, y=1/cooked.time, z=0},
{x=0, y=0, z=0},
cooked.time/2,
4
)
local item = cooked.item:to_table().name
minetest.after(cooked.time/2, function(item)
if meta:get_int("it_val") > 0 then
minetest.add_item({x=pos.x, y=pos.y+0.5, z=pos.z}, item)
meta:set_int('cooked_time', 0);
meta:set_int('cooked_cur_time', 0);
else
minetest.add_item({x=pos.x, y=pos.y+0.5, z=pos.z}, name)
end
end, item)
else
minetest.add_item({x=pos.x, y=pos.y+0.5, z=pos.z}, name)
end
end)
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
return itemstack
end
end
end
end
-- NODES
minetest.register_node('nativeamericanvillage:fireplace', {
description = S("fireplace"),
drawtype = 'mesh',
mesh = 'indianvillage_campfireoff.obj',
tiles = {name='indianvillage_campfire.png'},
walkable = false,
buildable_to = false,
sunlight_propagates = false,
paramtype = 'light',
groups = {dig_immediate=3, flammable=0, not_in_creative_inventory=1},
selection_box = {
type = 'fixed',
fixed = { -1, -1, -1, 1, -1, 1 },
},
drop = {max_items = 3, items = {{items = {"group:tree 3"}}}},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string('infotext', S("fireplace"));
end,
})
minetest.register_node('nativeamericanvillage:campfireoff', {
description = S("Campfire"),
drawtype = 'mesh',
mesh = 'indianvillage_campfireoff.obj',
tiles = {name='indianvillage_campfire.png'},
inventory_image = "item_campfire.png",
wield_image = "item_campfire.png",
walkable = false,
buildable_to = false,
sunlight_propagates = true,
groups = {dig_immediate=3, flammable=0},
paramtype = 'light',
selection_box = {
type = 'fixed',
fixed = { -0.48, -0.5, -0.48, 0.48, -0.4, 0.48 },
},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string('infotext', S("Campfire"));
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
if itemstack:get_name() == "fire:flint_and_steel" then
minetest.sound_play("fire_flint_and_steel",{pos = pos, gain = 0.5, max_hear_distance = 8})
minetest.set_node(pos, {name = 'nativeamericanvillage:campfireon'})
local id = minetest.add_particle({
pos = {x = pos.x, y = pos.y, z = pos.z},
velocity = {x=0, y=0.1, z=0},
acceleration = {x=0, y=0, z=0},
expirationtime = 2,
size = 4,
collisiondetection = true,
vertical = true,
texture = "indianvillage__smoke_animated.png",
animation = {type="vertical_frames", aspect_w=32, aspect_h=32, length = 2.5,},
-- playername = "singleplayer"
})
end
end,
})
minetest.register_node('nativeamericanvillage:campfireon', {
description = S("Campfire lit"),
drawtype = 'mesh',
mesh = 'indianvillage_campfireon.obj',
tiles = {name='indianvillage_campfire.png'},
inventory_image = "item_campfire.png",
wield_image = "item_campfire.png",
walkable = false,
buildable_to = false,
sunlight_propagates = true,
groups = {oddly_breakable_by_hand=3, flammable=0, not_in_creative_inventory=1, igniter=1},
paramtype = 'none',
light_source = 13,
damage_per_second = 3,
drop = "nativeamericanvillage:campfireoff",
selection_box = {
type = 'fixed',
fixed = { -0.48, -0.5, -0.48, 0.48, -0.4, 0.48 },
},
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local meta = minetest.get_meta(pos)
cooking(pos, itemstack)
if itemstack:get_definition().groups.tree == 1 then
local it_val = meta:get_int("it_val") + (indianvillage_campfire_ttl);
meta:set_int('it_val', it_val);
effect(
{x = pos.x, y = pos.y+0.4, z = pos.z},
"item_tree.png",
{x=0, y=-1, z=0},
{x=0, y=0, z=0},
1,
6
)
infotext_edit(meta)
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
return itemstack
end
end
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_int('it_val', indianvillage_campfire_ttl);
infotext_edit(meta)
minetest.get_node_timer(pos):start(2)
end,
on_destruct = function(pos, oldnode, oldmetadata, digger)
fire_particles_off(pos)
local meta = minetest.get_meta(pos)
local handle = meta:get_int("handle")
minetest.sound_stop(handle)
end,
on_timer = function(pos) -- Every 6 seconds play sound fire_small
local meta = minetest.get_meta(pos)
local handle = minetest.sound_play("fire_small",{pos=pos, max_hear_distance = 18, loop=false, gain=0.1})
meta:set_int("handle", handle)
minetest.get_node_timer(pos):start(6)
end,
})
-- CAMPFIRE_CRAFT
minetest.register_craft({
output = "nativeamericanvillage:campfireoff",
recipe = {
{'', 'default:stick', ''},
{'default:stick','nativeamericanvillage:fat', 'default:stick'},
{'group:tree', 'group:tree', 'group:tree'},
}
})
-- CAMPFIRE_ITEM_DROPS
minetest.register_craftitem("nativeamericanvillage:ash", {
description = S("Ash"),
inventory_image = "indianvillage_ash.png"
})
minetest.register_craftitem("nativeamericanvillage:bone", {
description = S("Bone"),
inventory_image = "bonemeal_bone.png"
})
-- ABM
minetest.register_abm({
nodenames = {"nativeamericanvillage:campfireon"},
-- neighbors = {"group:puts_out_fire"},
interval = 1.0, -- Run every 3 seconds
chance = 1, -- Select every 1 in 1 nodes
catch_up = false,
action = function(pos, node, active_object_count, active_object_count_wider)
local fpos, num = minetest.find_nodes_in_area(
{x=pos.x-1, y=pos.y, z=pos.z-1},
{x=pos.x+1, y=pos.y+1, z=pos.z+1},
{"group:water"}
)
if #fpos > 0 then
minetest.set_node(pos, {name = 'nativeamericanvillage:campfireon'})
minetest.sound_play("fire_extinguish_flame",{pos = pos, max_hear_distance = 16, gain = 0.15})
else
local meta = minetest.get_meta(pos)
local it_val = meta:get_int("it_val") - 1;
if indianvillage_campfire_limit and indianvillage_campfire_ttl > 0 then
if it_val <= 0 then
minetest.remove_node(pos)
minetest.set_node(pos, {name = 'nativeamericanvillage:fireplace'})
minetest.add_item(pos, "nativeamericanvillage:ash")
minetest.add_item(pos, "bonemeal:bone")
return
end
meta:set_int('it_val', it_val);
end
if indianvillage_campfire_cooking then
if meta:get_int('cooked_cur_time') <= meta:get_int('cooked_time') then
meta:set_int('cooked_cur_time', meta:get_int('cooked_cur_time') + 1);
else
meta:set_int('cooked_time', 0);
meta:set_int('cooked_cur_time', 0);
end
end
infotext_edit(meta)
fire_particles_on(pos)
end
end
})

51
decor.lua Normal file
View File

@ -0,0 +1,51 @@
-- Totem Pole, models and textures by Steamed_Punk
-- NODES
-- TOTEM
minetest.register_node("nativeamericanvillage:totem", {
description = "Totem",
drawtype = "mesh",
mesh = "indianvillage_totem.obj",
tiles = {"indianvillage_totem.png"},
inventory_image = "indianvillage_totem.png",
wield_image = "indianvillage_totem.png",
buildable_to = false,
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=3},
on_place = minetest.rotate_node,
})
-- TOTEM_CRAFT
minetest.register_craft({
output = "nativeamericanvillage:totem",
recipe = {
{'group:tree', 'group:tree', 'group:tree'},
{'group:dye','group:tree', 'group:dye'},
{'', 'group:tree', ''},
}
})
-- SKULL
minetest.register_node("nativeamericanvillage:buffaloskull", {
description = "Skull",
drawtype = "mesh",
mesh = "indianvillage_buffaloskull.obj",
tiles = {"indianvillage__decor_buffaloskull.png"},
inventory_image = "item_buffaloskull.png",
wield_image = "item_buffaloskull.png",
buildable_to = false,
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy=2, flammable=3},
on_place = minetest.rotate_node,
})

7
depends.txt Normal file
View File

@ -0,0 +1,7 @@
default
player_api
farming
fire
mobs
bows
bonemeal

43
indianvillage.lua Normal file
View File

@ -0,0 +1,43 @@
-- TEEPEE
minetest.register_node("nativeamericanvillage:tepee", {
description = "Tepee",
drawtype = "mesh",
mesh = "indianvillage_teepee01.obj",
tiles = {"indianvillage_teepee01.png"},
wield_image = "item_teepee01.png",
inventory_image = "item_teepee01.png",
buildable_to = false,
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=3},
on_place = minetest.rotate_node,
node_box = {
type = "fixed",
fixed = {
{-1.5, -1.5, -1.5, 1.5, 0, 1.5},
{-1.5, -1.5, -1.5, 0, 1.5, 1.5},
{-1.5, -1.5, -1.5, 1.5, 1.5, 0},
{-1.5, -1.5, 0, 1.5, 1.5, 1.5},
{0, -1.5, -1.5, 1.5, 1.5, 1.5},
},
},
})
minetest.override_item("default:apple", {
wield_image = "default_apple_2.png",
inventory_image = "default_apple_2.png",
})
-- TEEPEE_CRAFT
minetest.register_craft({
output = "nativeamericanvillage:tepee",
recipe = {
{'', 'default:stick ', ''},
{'group:stick','nativeamericanvillage:hide', 'default:stick '},
{'group:stick', 'indianvillage_mobs:hide', 'default:stick '},
}
})

15
init.lua Normal file
View File

@ -0,0 +1,15 @@
-- Native American Village by Steamed_Punk (CC BY-NC 3.0)
local path = minetest.get_modpath("nativeamericanvillage")
-- Load support for intllib.
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
-- Native American Village
dofile(path .. "/indianvillage.lua") -- Steamed_Punk
dofile(path .. "/decor.lua") -- Steamed_Punk
dofile(path .. "/bbcanoe.lua") -- Steamed_Punk
dofile(path .. "/campfire.lua") -- Steamed_Punk
dofile(path .. "/buffalo.lua") -- Steamed_Punk
print (S("[MOD] Native American Village loaded"))

45
intllib.lua Normal file
View File

@ -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

5
mod.conf Normal file
View File

@ -0,0 +1,5 @@
name = nativeamericanvillage
description = Adds tepees, a campfire various decorations and mobs!
release = 0.0.2
author = Steamed Punk
title = Native American Village

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 KiB

BIN
screenshot01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 KiB