Castrum 1.5.0 upload
|
@ -1,4 +1,4 @@
|
||||||
A subgame by 1248
|
A Game by 1248
|
||||||
|
|
||||||
Thanks to:
|
Thanks to:
|
||||||
/
|
/
|
||||||
|
@ -12,7 +12,7 @@ Collect resources and rebuild the old castle
|
||||||
|
|
||||||
License:
|
License:
|
||||||
See README.txt in each mod for more information
|
See README.txt in each mod for more information
|
||||||
Every code written by me is LGPLv2.1 and CC-BY-SA
|
Every code written by me is LGPLv2.1
|
||||||
|
|
||||||
notes:
|
notes:
|
||||||
wood door in doors mod changed
|
wood door in doors mod changed
|
||||||
|
|
BIN
menu/Thumbs.db
|
@ -49,21 +49,24 @@ function beds.register_bed(name, def)
|
||||||
local node = minetest.get_node(under)
|
local node = minetest.get_node(under)
|
||||||
local udef = minetest.registered_nodes[node.name]
|
local udef = minetest.registered_nodes[node.name]
|
||||||
if udef and udef.on_rightclick and
|
if udef and udef.on_rightclick and
|
||||||
not (placer and placer:get_player_control().sneak) then
|
not (placer and placer:is_player() and
|
||||||
|
placer:get_player_control().sneak) then
|
||||||
return udef.on_rightclick(under, node, placer, itemstack,
|
return udef.on_rightclick(under, node, placer, itemstack,
|
||||||
pointed_thing) or itemstack
|
pointed_thing) or itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
local pos
|
local pos
|
||||||
if minetest.registered_items[minetest.get_node(under).name].buildable_to then
|
if udef and udef.buildable_to then
|
||||||
pos = under
|
pos = under
|
||||||
else
|
else
|
||||||
pos = pointed_thing.above
|
pos = pointed_thing.above
|
||||||
end
|
end
|
||||||
|
|
||||||
if minetest.is_protected(pos, placer:get_player_name()) and
|
local player_name = placer and placer:get_player_name() or ""
|
||||||
not minetest.check_player_privs(placer, "protection_bypass") then
|
|
||||||
minetest.record_protection_violation(pos, placer:get_player_name())
|
if minetest.is_protected(pos, player_name) and
|
||||||
|
not minetest.check_player_privs(player_name, "protection_bypass") then
|
||||||
|
minetest.record_protection_violation(pos, player_name)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -72,12 +75,13 @@ function beds.register_bed(name, def)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
local dir = minetest.dir_to_facedir(placer:get_look_dir())
|
local dir = placer and placer:get_look_dir() and
|
||||||
|
minetest.dir_to_facedir(placer:get_look_dir()) or 0
|
||||||
local botpos = vector.add(pos, minetest.facedir_to_dir(dir))
|
local botpos = vector.add(pos, minetest.facedir_to_dir(dir))
|
||||||
|
|
||||||
if minetest.is_protected(botpos, placer:get_player_name()) and
|
if minetest.is_protected(botpos, player_name) and
|
||||||
not minetest.check_player_privs(placer, "protection_bypass") then
|
not minetest.check_player_privs(player_name, "protection_bypass") then
|
||||||
minetest.record_protection_violation(botpos, placer:get_player_name())
|
minetest.record_protection_violation(botpos, player_name)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -90,7 +94,7 @@ function beds.register_bed(name, def)
|
||||||
minetest.set_node(botpos, {name = name .. "_top", param2 = dir})
|
minetest.set_node(botpos, {name = name .. "_top", param2 = dir})
|
||||||
|
|
||||||
if not (creative and creative.is_enabled_for
|
if not (creative and creative.is_enabled_for
|
||||||
and creative.is_enabled_for(placer:get_player_name())) then
|
and creative.is_enabled_for(player_name)) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
|
|
@ -230,7 +230,8 @@ minetest.register_craftitem("boats:boat", {
|
||||||
local node = minetest.get_node(under)
|
local node = minetest.get_node(under)
|
||||||
local udef = minetest.registered_nodes[node.name]
|
local udef = minetest.registered_nodes[node.name]
|
||||||
if udef and udef.on_rightclick and
|
if udef and udef.on_rightclick and
|
||||||
not (placer and placer:get_player_control().sneak) then
|
not (placer and placer:is_player() and
|
||||||
|
placer:get_player_control().sneak) then
|
||||||
return udef.on_rightclick(under, node, placer, itemstack,
|
return udef.on_rightclick(under, node, placer, itemstack,
|
||||||
pointed_thing) or itemstack
|
pointed_thing) or itemstack
|
||||||
end
|
end
|
||||||
|
@ -244,9 +245,12 @@ minetest.register_craftitem("boats:boat", {
|
||||||
pointed_thing.under.y = pointed_thing.under.y + 0.5
|
pointed_thing.under.y = pointed_thing.under.y + 0.5
|
||||||
boat = minetest.add_entity(pointed_thing.under, "boats:boat")
|
boat = minetest.add_entity(pointed_thing.under, "boats:boat")
|
||||||
if boat then
|
if boat then
|
||||||
boat:setyaw(placer:get_look_horizontal())
|
if placer then
|
||||||
if not (creative and creative.is_enabled_for
|
boat:setyaw(placer:get_look_horizontal())
|
||||||
and creative.is_enabled_for(placer:get_player_name())) then
|
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()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -68,6 +68,12 @@ minetest.register_node("bones:bones", {
|
||||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
if meta:get_inventory():is_empty("main") then
|
if meta:get_inventory():is_empty("main") then
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
if inv:room_for_item("main", {name = "bones:bones"}) then
|
||||||
|
inv:add_item("main", {name = "bones:bones"})
|
||||||
|
else
|
||||||
|
minetest.add_item(pos, "bones:bones")
|
||||||
|
end
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -69,7 +69,8 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
|
||||||
|
|
||||||
-- Call on_rightclick if the pointed node defines it
|
-- Call on_rightclick if the pointed node defines it
|
||||||
if ndef and ndef.on_rightclick and
|
if ndef and ndef.on_rightclick and
|
||||||
user and not user:get_player_control().sneak then
|
not (user and user:is_player() and
|
||||||
|
user:get_player_control().sneak) then
|
||||||
return ndef.on_rightclick(
|
return ndef.on_rightclick(
|
||||||
pointed_thing.under,
|
pointed_thing.under,
|
||||||
node, user,
|
node, user,
|
||||||
|
|
|
@ -58,7 +58,8 @@ end
|
||||||
|
|
||||||
function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
|
function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
|
||||||
local pos = self.object:getpos()
|
local pos = self.object:getpos()
|
||||||
if not self.railtype then
|
local vel = self.object:getvelocity()
|
||||||
|
if not self.railtype or vector.equals(vel, {x=0, y=0, z=0}) then
|
||||||
local node = minetest.get_node(pos).name
|
local node = minetest.get_node(pos).name
|
||||||
self.railtype = minetest.get_item_group(node, "connect_to_raillike")
|
self.railtype = minetest.get_item_group(node, "connect_to_raillike")
|
||||||
end
|
end
|
||||||
|
@ -105,7 +106,6 @@ function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities,
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- Player punches cart to alter velocity
|
-- Player punches cart to alter velocity
|
||||||
local vel = self.object:getvelocity()
|
|
||||||
if puncher:get_player_name() == self.driver then
|
if puncher:get_player_name() == self.driver then
|
||||||
if math.abs(vel.x + vel.z) > carts.punch_speed_max then
|
if math.abs(vel.x + vel.z) > carts.punch_speed_max then
|
||||||
return
|
return
|
||||||
|
@ -367,7 +367,8 @@ minetest.register_craftitem("carts:cart", {
|
||||||
local node = minetest.get_node(under)
|
local node = minetest.get_node(under)
|
||||||
local udef = minetest.registered_nodes[node.name]
|
local udef = minetest.registered_nodes[node.name]
|
||||||
if udef and udef.on_rightclick and
|
if udef and udef.on_rightclick and
|
||||||
not (placer and placer:get_player_control().sneak) then
|
not (placer and placer:is_player() and
|
||||||
|
placer:get_player_control().sneak) then
|
||||||
return udef.on_rightclick(under, node, placer, itemstack,
|
return udef.on_rightclick(under, node, placer, itemstack,
|
||||||
pointed_thing) or itemstack
|
pointed_thing) or itemstack
|
||||||
end
|
end
|
||||||
|
|
|
@ -159,23 +159,29 @@ function carts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
|
||||||
end
|
end
|
||||||
|
|
||||||
function carts:pathfinder(pos_, old_pos, old_dir, ctrl, pf_switch, railtype)
|
function carts:pathfinder(pos_, old_pos, old_dir, ctrl, pf_switch, railtype)
|
||||||
|
if vector.equals(old_pos, pos_) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
local pos = vector.round(pos_)
|
local pos = vector.round(pos_)
|
||||||
local pf_pos = vector.round(old_pos)
|
local pf_pos = vector.round(old_pos)
|
||||||
local pf_dir = vector.new(old_dir)
|
local pf_dir = vector.new(old_dir)
|
||||||
|
|
||||||
for i = 1, 3 do
|
for i = 1, 3 do
|
||||||
if vector.equals(pf_pos, pos) then
|
pf_dir, pf_switch = carts:get_rail_direction(
|
||||||
-- Success! Cart moved on correctly
|
pf_pos, pf_dir, ctrl, pf_switch, railtype)
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
pf_dir, pf_switch = carts:get_rail_direction(pf_pos, pf_dir, ctrl, pf_switch, railtype)
|
|
||||||
if vector.equals(pf_dir, {x=0, y=0, z=0}) then
|
if vector.equals(pf_dir, {x=0, y=0, z=0}) then
|
||||||
-- No way forwards
|
-- No way forwards
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
pf_pos = vector.add(pf_pos, pf_dir)
|
pf_pos = vector.add(pf_pos, pf_dir)
|
||||||
|
|
||||||
|
if vector.equals(pf_pos, pos) then
|
||||||
|
-- Success! Cart moved on correctly
|
||||||
|
return true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
-- Cart not found
|
-- Cart not found
|
||||||
return false
|
return false
|
||||||
|
@ -211,7 +217,12 @@ end
|
||||||
|
|
||||||
function carts:get_rail_groups(additional_groups)
|
function carts:get_rail_groups(additional_groups)
|
||||||
-- Get the default rail groups and add more when a table is given
|
-- Get the default rail groups and add more when a table is given
|
||||||
local groups = {dig_immediate = 2, attached_node = 1, rail = 1, connect_to_raillike = 1}
|
local groups = {
|
||||||
|
dig_immediate = 2,
|
||||||
|
attached_node = 1,
|
||||||
|
rail = 1,
|
||||||
|
connect_to_raillike = minetest.raillike_group("rail")
|
||||||
|
}
|
||||||
if type(additional_groups) == "table" then
|
if type(additional_groups) == "table" then
|
||||||
for k, v in pairs(additional_groups) do
|
for k, v in pairs(additional_groups) do
|
||||||
groups[k] = v
|
groups[k] = v
|
||||||
|
|
|
@ -0,0 +1,304 @@
|
||||||
|
local list = {
|
||||||
|
{1, {x=-173, y=9, z=-70},{x=-172, y=9, z=-70},2},
|
||||||
|
{2, {x=-173, y=9, z=-62},{x=-172, y=9, z=-62},2},
|
||||||
|
{3, {x=-171, y=9, z=-69},{x=-170, y=9, z=-69},2},
|
||||||
|
{4, {x=-171, y=9, z=-63},{x=-170, y=9, z=-63},2},
|
||||||
|
{5, {x=-170, y=9, z=-67},{x=-169, y=9, z=-67},2},
|
||||||
|
{6, {x=-170, y=9, z=-65},{x=-169, y=9, z=-65},2},
|
||||||
|
{7, {x=-172, y=9, z=-70},{x=-171, y=9, z=-71},2},
|
||||||
|
{8, {x=-172, y=9, z=-62},{x=-171, y=9, z=-61},2},
|
||||||
|
{9, {x=-171, y=9, z=-71},{x=-170, y=9, z=-71},2},
|
||||||
|
{10, {x=-171, y=9, z=-61},{x=-170, y=9, z=-61},2},
|
||||||
|
{11, {x=-170, y=9, z=-70},{x=-169, y=9, z=-70},2},
|
||||||
|
{12, {x=-170, y=9, z=-62},{x=-169, y=9, z=-62},2},
|
||||||
|
{13, {x=-170, y=9, z=-69},{x=-169, y=9, z=-69},2},
|
||||||
|
{14, {x=-170, y=9, z=-63},{x=-169, y=9, z=-63},2},
|
||||||
|
{15, {x=-169, y=9, z=-68},{x=-168, y=9, z=-68},2},
|
||||||
|
{16, {x=-169, y=9, z=-64},{x=-168, y=9, z=-64},2},
|
||||||
|
{17, {x=-169, y=9, z=-67},{x=-168, y=9, z=-67},2},
|
||||||
|
{18, {x=-169, y=9, z=-65},{x=-168, y=9, z=-65},2},
|
||||||
|
{19, {x=-168, y=9, z=-66},{x=-167, y=9, z=-66},2},
|
||||||
|
{20, {x=-170, y=9, z=-71},{x=-169, y=9, z=-71},2},
|
||||||
|
{21, {x=-170, y=9, z=-61},{x=-169, y=9, z=-61},2},
|
||||||
|
{22, {x=-169, y=9, z=-70},{x=-168, y=9, z=-70},2},
|
||||||
|
{23, {x=-169, y=9, z=-62},{x=-168, y=9, z=-62},2},
|
||||||
|
{24, {x=-169, y=9, z=-69},{x=-168, y=9, z=-69},2},
|
||||||
|
{25, {x=-169, y=9, z=-63},{x=-168, y=9, z=-63},2},
|
||||||
|
{26, {x=-168, y=9, z=-68},{x=-167, y=9, z=-68},2},
|
||||||
|
{27, {x=-168, y=9, z=-64},{x=-167, y=9, z=-64},2},
|
||||||
|
{28, {x=-168, y=9, z=-67},{x=-167, y=9, z=-67},2},
|
||||||
|
{29, {x=-168, y=9, z=-65},{x=-167, y=9, z=-65},2},
|
||||||
|
{30, {x=-167, y=9, z=-66},{x=-166, y=9, z=-66},2},
|
||||||
|
{31, {x=-169, y=9, z=-71},{x=-168, y=9, z=-71},2},
|
||||||
|
{32, {x=-169, y=9, z=-61},{x=-168, y=9, z=-61},2},
|
||||||
|
{33, {x=-168, y=9, z=-70},{x=-167, y=9, z=-70},2},
|
||||||
|
{34, {x=-168, y=9, z=-62},{x=-167, y=9, z=-62},2},
|
||||||
|
{35, {x=-168, y=9, z=-69},{x=-167, y=9, z=-69},2},
|
||||||
|
{36, {x=-168, y=9, z=-63},{x=-167, y=9, z=-63},2},
|
||||||
|
{37, {x=-167, y=9, z=-68},{x=-166, y=9, z=-68},2},
|
||||||
|
{38, {x=-167, y=9, z=-64},{x=-166, y=9, z=-64},2},
|
||||||
|
{39, {x=-167, y=9, z=-67},{x=-166, y=9, z=-67},2},
|
||||||
|
{40, {x=-167, y=9, z=-65},{x=-166, y=9, z=-65},2},
|
||||||
|
{41, {x=-166, y=9, z=-66},{x=-165, y=9, z=-66},2},
|
||||||
|
{42, {x=-168, y=9, z=-71},{x=-167, y=9, z=-72},2},
|
||||||
|
{43, {x=-168, y=9, z=-61},{x=-167, y=9, z=-60},2},
|
||||||
|
{44, {x=-167, y=9, z=-70},{x=-166, y=9, z=-70},2},
|
||||||
|
{45, {x=-167, y=9, z=-62},{x=-166, y=9, z=-62},2},
|
||||||
|
{46, {x=-167, y=9, z=-69},{x=-166, y=9, z=-69},2},
|
||||||
|
{47, {x=-167, y=9, z=-63},{x=-166, y=9, z=-63},2},
|
||||||
|
{48, {x=-166, y=9, z=-68},{x=-165, y=9, z=-68},2},
|
||||||
|
{49, {x=-166, y=9, z=-64},{x=-165, y=9, z=-64},2},
|
||||||
|
{50, {x=-166, y=9, z=-67},{x=-165, y=9, z=-67},2},
|
||||||
|
{51, {x=-166, y=9, z=-65},{x=-165, y=9, z=-65},2},
|
||||||
|
{52, {x=-165, y=9, z=-66},{x=-164, y=9, z=-66},2},
|
||||||
|
{53, {x=-167, y=9, z=-72},{x=-166, y=9, z=-73},2},
|
||||||
|
{54, {x=-167, y=9, z=-60},{x=-166, y=9, z=-59},2},
|
||||||
|
{55, {x=-166, y=9, z=-70},{x=-165, y=9, z=-71},2},
|
||||||
|
{56, {x=-166, y=9, z=-62},{x=-165, y=9, z=-61},2},
|
||||||
|
{57, {x=-166, y=9, z=-69},{x=-165, y=9, z=-69},2},
|
||||||
|
{58, {x=-166, y=9, z=-63},{x=-165, y=9, z=-63},2},
|
||||||
|
{59, {x=-165, y=9, z=-68},{x=-164, y=9, z=-68},2},
|
||||||
|
{60, {x=-165, y=9, z=-64},{x=-164, y=9, z=-64},2},
|
||||||
|
{61, {x=-165, y=9, z=-67},{x=-164, y=9, z=-67},2},
|
||||||
|
{62, {x=-165, y=9, z=-65},{x=-164, y=9, z=-65},2},
|
||||||
|
{63, {x=-164, y=9, z=-66},{x=-163, y=9, z=-66},2},
|
||||||
|
{64, {x=-166, y=9, z=-73},{x=-165, y=9, z=-73},2},
|
||||||
|
{65, {x=-166, y=9, z=-59},{x=-165, y=9, z=-59},2},
|
||||||
|
{66, {x=-165, y=9, z=-71},{x=-164, y=9, z=-71},2},
|
||||||
|
{67, {x=-165, y=9, z=-61},{x=-164, y=9, z=-61},2},
|
||||||
|
{68, {x=-165, y=9, z=-69},{x=-164, y=9, z=-69},2},
|
||||||
|
{69, {x=-165, y=9, z=-63},{x=-164, y=9, z=-63},2},
|
||||||
|
{70, {x=-164, y=9, z=-68},{x=-163, y=9, z=-68},2},
|
||||||
|
{71, {x=-164, y=9, z=-64},{x=-163, y=9, z=-64},2},
|
||||||
|
{72, {x=-164, y=9, z=-67},{x=-163, y=9, z=-67},2},
|
||||||
|
{73, {x=-164, y=9, z=-65},{x=-163, y=9, z=-65},2},
|
||||||
|
{74, {x=-163, y=9, z=-66},{x=-162, y=9, z=-66},2},
|
||||||
|
{75, {x=-165, y=9, z=-73},{x=-164, y=9, z=-74},2},
|
||||||
|
{76, {x=-165, y=9, z=-59},{x=-164, y=9, z=-58},2},
|
||||||
|
{77, {x=-164, y=9, z=-71},{x=-163, y=9, z=-72},2},
|
||||||
|
{78, {x=-164, y=9, z=-61},{x=-163, y=9, z=-60},2},
|
||||||
|
{79, {x=-164, y=9, z=-69},{x=-163, y=9, z=-69},2},
|
||||||
|
{80, {x=-164, y=9, z=-63},{x=-163, y=9, z=-63},2},
|
||||||
|
{81, {x=-163, y=9, z=-68},{x=-162, y=9, z=-68},2},
|
||||||
|
{82, {x=-163, y=9, z=-64},{x=-162, y=9, z=-64},2},
|
||||||
|
{83, {x=-163, y=9, z=-67},{x=-162, y=9, z=-67},2},
|
||||||
|
{84, {x=-163, y=9, z=-65},{x=-162, y=9, z=-65},2},
|
||||||
|
{85, {x=-162, y=9, z=-66},{x=-161, y=9, z=-66},2},
|
||||||
|
{86, {x=-164, y=9, z=-74},{x=-163, y=9, z=-74},2},
|
||||||
|
{87, {x=-164, y=9, z=-58},{x=-163, y=9, z=-58},2},
|
||||||
|
{88, {x=-163, y=9, z=-72},{x=-162, y=9, z=-72},2},
|
||||||
|
{89, {x=-163, y=9, z=-60},{x=-162, y=9, z=-60},2},
|
||||||
|
{90, {x=-163, y=9, z=-69},{x=-162, y=9, z=-70},2},
|
||||||
|
{91, {x=-163, y=9, z=-63},{x=-162, y=9, z=-62},2},
|
||||||
|
{92, {x=-162, y=9, z=-68},{x=-161, y=9, z=-68},2},
|
||||||
|
{93, {x=-162, y=9, z=-64},{x=-161, y=9, z=-64},2},
|
||||||
|
{94, {x=-162, y=9, z=-67},{x=-161, y=9, z=-67},2},
|
||||||
|
{95, {x=-162, y=9, z=-65},{x=-161, y=9, z=-65},2},
|
||||||
|
{96, {x=-161, y=9, z=-66},{x=-160, y=9, z=-66},2},
|
||||||
|
{97, {x=-163, y=9, z=-74},{x=-162, y=9, z=-75},2},
|
||||||
|
{98, {x=-163, y=9, z=-58},{x=-162, y=9, z=-57},2},
|
||||||
|
{99, {x=-162, y=9, z=-72},{x=-161, y=9, z=-73},2},
|
||||||
|
{100, {x=-162, y=9, z=-60},{x=-161, y=9, z=-59},2},
|
||||||
|
{101, {x=-162, y=9, z=-70},{x=-161, y=9, z=-70},2},
|
||||||
|
{102, {x=-162, y=9, z=-62},{x=-161, y=9, z=-62},2},
|
||||||
|
{103, {x=-161, y=9, z=-68},{x=-160, y=9, z=-68},2},
|
||||||
|
{104, {x=-161, y=9, z=-64},{x=-160, y=9, z=-64},2},
|
||||||
|
{105, {x=-161, y=9, z=-67},{x=-160, y=9, z=-67},2},
|
||||||
|
{106, {x=-161, y=9, z=-65},{x=-160, y=9, z=-65},2},
|
||||||
|
{107, {x=-160, y=9, z=-66},{x=-159, y=9, z=-66},2},
|
||||||
|
{108, {x=-162, y=9, z=-75},{x=-161, y=9, z=-75},2},
|
||||||
|
{109, {x=-162, y=9, z=-57},{x=-161, y=9, z=-57},2},
|
||||||
|
{110, {x=-161, y=9, z=-73},{x=-160, y=9, z=-73},2},
|
||||||
|
{111, {x=-161, y=9, z=-59},{x=-160, y=9, z=-59},2},
|
||||||
|
{112, {x=-161, y=9, z=-70},{x=-160, y=9, z=-71},2},
|
||||||
|
{113, {x=-161, y=9, z=-62},{x=-160, y=9, z=-61},2},
|
||||||
|
{114, {x=-160, y=9, z=-68},{x=-159, y=9, z=-69},2},
|
||||||
|
{115, {x=-160, y=9, z=-64},{x=-159, y=9, z=-63},2},
|
||||||
|
{116, {x=-160, y=9, z=-67},{x=-159, y=9, z=-67},2},
|
||||||
|
{117, {x=-160, y=9, z=-65},{x=-159, y=9, z=-65},2},
|
||||||
|
{118, {x=-159, y=9, z=-66},{x=-158, y=9, z=-66},2},
|
||||||
|
{119, {x=-161, y=9, z=-75},{x=-160, y=9, z=-76},2},
|
||||||
|
{120, {x=-161, y=9, z=-57},{x=-160, y=9, z=-56},2},
|
||||||
|
{121, {x=-160, y=9, z=-73},{x=-159, y=9, z=-74},2},
|
||||||
|
{122, {x=-160, y=9, z=-59},{x=-159, y=9, z=-58},2},
|
||||||
|
{123, {x=-160, y=9, z=-71},{x=-159, y=9, z=-71},2},
|
||||||
|
{124, {x=-160, y=9, z=-61},{x=-159, y=9, z=-61},2},
|
||||||
|
{125, {x=-159, y=9, z=-69},{x=-158, y=9, z=-69},2},
|
||||||
|
{126, {x=-159, y=9, z=-63},{x=-158, y=9, z=-63},2},
|
||||||
|
{127, {x=-159, y=9, z=-67},{x=-158, y=9, z=-67},2},
|
||||||
|
{128, {x=-159, y=9, z=-65},{x=-158, y=9, z=-65},2},
|
||||||
|
{129, {x=-160, y=9, z=-76},{x=-159, y=9, z=-76},2},
|
||||||
|
{130, {x=-160, y=9, z=-56},{x=-159, y=9, z=-56},2},
|
||||||
|
{131, {x=-159, y=9, z=-74},{x=-158, y=9, z=-74},2},
|
||||||
|
{132, {x=-159, y=9, z=-58},{x=-158, y=9, z=-58},2},
|
||||||
|
{133, {x=-159, y=9, z=-71},{x=-158, y=9, z=-71},2},
|
||||||
|
{134, {x=-159, y=9, z=-61},{x=-158, y=9, z=-61},2},
|
||||||
|
{135, {x=-159, y=9, z=-76},{x=-158, y=9, z=-76},2},
|
||||||
|
{136, {x=-159, y=9, z=-56},{x=-158, y=9, z=-56},2},
|
||||||
|
{137, {x=-158, y=9, z=-76},{x=-157, y=9, z=-75},2},
|
||||||
|
{138, {x=-158, y=9, z=-56},{x=-157, y=9, z=-57},2},
|
||||||
|
{139, {x=-157, y=9, z=-75},{x=-156, y=9, z=-75},2},
|
||||||
|
{140, {x=-157, y=9, z=-57},{x=-156, y=9, z=-57},2},
|
||||||
|
{141, {x=-158, y=9, z=-74},{x=-157, y=9, z=-73},2},
|
||||||
|
{142, {x=-158, y=9, z=-58},{x=-157, y=9, z=-59},2},
|
||||||
|
{143, {x=-158, y=9, z=-71},{x=-157, y=9, z=-71},2},
|
||||||
|
{144, {x=-158, y=9, z=-61},{x=-157, y=9, z=-61},2},
|
||||||
|
{145, {x=-156, y=9, z=-75},{x=-155, y=9, z=-75},2},
|
||||||
|
{146, {x=-156, y=9, z=-57},{x=-155, y=9, z=-57},2},
|
||||||
|
{147, {x=-157, y=9, z=-73},{x=-156, y=9, z=-73},2},
|
||||||
|
{148, {x=-157, y=9, z=-59},{x=-156, y=9, z=-59},2},
|
||||||
|
{149, {x=-157, y=9, z=-71},{x=-156, y=9, z=-70},2},
|
||||||
|
{150, {x=-157, y=9, z=-61},{x=-156, y=9, z=-62},2},
|
||||||
|
{151, {x=-158, y=9, z=-69},{x=-157, y=9, z=-69},2},
|
||||||
|
{152, {x=-158, y=9, z=-63},{x=-157, y=9, z=-63},2},
|
||||||
|
{153, {x=-158, y=9, z=-67},{x=-157, y=9, z=-67},2},
|
||||||
|
{154, {x=-158, y=9, z=-65},{x=-157, y=9, z=-65},2},
|
||||||
|
{155, {x=-155, y=9, z=-75},{x=-154, y=9, z=-74},2},
|
||||||
|
{156, {x=-155, y=9, z=-57},{x=-154, y=9, z=-58},2},
|
||||||
|
{157, {x=-156, y=9, z=-73},{x=-155, y=9, z=-72},2},
|
||||||
|
{158, {x=-156, y=9, z=-59},{x=-155, y=9, z=-60},2},
|
||||||
|
{159, {x=-156, y=9, z=-70},{x=-155, y=9, z=-70},2},
|
||||||
|
{160, {x=-156, y=9, z=-62},{x=-155, y=9, z=-62},2},
|
||||||
|
{161, {x=-157, y=9, z=-69},{x=-156, y=9, z=-68},2},
|
||||||
|
{162, {x=-157, y=9, z=-63},{x=-156, y=9, z=-64},2},
|
||||||
|
{163, {x=-157, y=9, z=-67},{x=-156, y=9, z=-67},2},
|
||||||
|
{164, {x=-157, y=9, z=-65},{x=-156, y=9, z=-65},2},
|
||||||
|
{165, {x=-158, y=9, z=-66},{x=-157, y=9, z=-66},2},
|
||||||
|
{166, {x=-154, y=9, z=-74},{x=-153, y=9, z=-74},2},
|
||||||
|
{167, {x=-154, y=9, z=-58},{x=-153, y=9, z=-58},2},
|
||||||
|
{168, {x=-155, y=9, z=-72},{x=-154, y=9, z=-72},2},
|
||||||
|
{169, {x=-155, y=9, z=-60},{x=-154, y=9, z=-60},2},
|
||||||
|
{170, {x=-155, y=9, z=-70},{x=-154, y=9, z=-70},2},
|
||||||
|
{171, {x=-155, y=9, z=-62},{x=-154, y=9, z=-62},2},
|
||||||
|
{172, {x=-156, y=9, z=-68},{x=-155, y=9, z=-68},2},
|
||||||
|
{173, {x=-156, y=9, z=-64},{x=-155, y=9, z=-64},2},
|
||||||
|
{174, {x=-156, y=9, z=-67},{x=-155, y=9, z=-67},2},
|
||||||
|
{175, {x=-156, y=9, z=-65},{x=-155, y=9, z=-65},2},
|
||||||
|
{176, {x=-157, y=9, z=-66},{x=-156, y=9, z=-66},2},
|
||||||
|
{177, {x=-153, y=9, z=-74},{x=-152, y=9, z=-74},2},
|
||||||
|
{178, {x=-153, y=9, z=-58},{x=-152, y=9, z=-58},2},
|
||||||
|
{179, {x=-154, y=9, z=-72},{x=-153, y=9, z=-72},2},
|
||||||
|
{180, {x=-154, y=9, z=-60},{x=-153, y=9, z=-60},2},
|
||||||
|
{181, {x=-154, y=9, z=-70},{x=-153, y=9, z=-69},2},
|
||||||
|
{182, {x=-154, y=9, z=-62},{x=-153, y=9, z=-63},2},
|
||||||
|
{183, {x=-155, y=9, z=-68},{x=-154, y=9, z=-68},2},
|
||||||
|
{184, {x=-155, y=9, z=-64},{x=-154, y=9, z=-64},2},
|
||||||
|
{185, {x=-155, y=9, z=-67},{x=-154, y=9, z=-67},2},
|
||||||
|
{186, {x=-155, y=9, z=-65},{x=-154, y=9, z=-65},2},
|
||||||
|
{187, {x=-156, y=9, z=-66},{x=-155, y=9, z=-66},2},
|
||||||
|
{188, {x=-152, y=9, z=-74},{x=-151, y=9, z=-73},2},
|
||||||
|
{189, {x=-152, y=9, z=-58},{x=-151, y=9, z=-59},2},
|
||||||
|
{190, {x=-153, y=9, z=-72},{x=-152, y=9, z=-71},2},
|
||||||
|
{191, {x=-153, y=9, z=-60},{x=-152, y=9, z=-61},2},
|
||||||
|
{192, {x=-153, y=9, z=-69},{x=-152, y=9, z=-69},2},
|
||||||
|
{193, {x=-153, y=9, z=-63},{x=-152, y=9, z=-63},2},
|
||||||
|
{194, {x=-154, y=9, z=-68},{x=-153, y=9, z=-68},2},
|
||||||
|
{195, {x=-154, y=9, z=-64},{x=-153, y=9, z=-64},2},
|
||||||
|
{196, {x=-154, y=9, z=-67},{x=-153, y=9, z=-67},2},
|
||||||
|
{197, {x=-154, y=9, z=-65},{x=-153, y=9, z=-65},2},
|
||||||
|
{198, {x=-155, y=9, z=-66},{x=-154, y=9, z=-66},2},
|
||||||
|
{199, {x=-151, y=9, z=-73},{x=-150, y=9, z=-73},2},
|
||||||
|
{200, {x=-151, y=9, z=-59},{x=-150, y=9, z=-59},2},
|
||||||
|
{201, {x=-152, y=9, z=-71},{x=-151, y=9, z=-71},2},
|
||||||
|
{202, {x=-152, y=9, z=-61},{x=-151, y=9, z=-61},2},
|
||||||
|
{203, {x=-152, y=9, z=-69},{x=-151, y=9, z=-69},2},
|
||||||
|
{204, {x=-152, y=9, z=-63},{x=-151, y=9, z=-63},2},
|
||||||
|
{205, {x=-153, y=9, z=-68},{x=-152, y=9, z=-68},2},
|
||||||
|
{206, {x=-153, y=9, z=-64},{x=-152, y=9, z=-64},2},
|
||||||
|
{207, {x=-153, y=9, z=-67},{x=-152, y=9, z=-67},2},
|
||||||
|
{208, {x=-153, y=9, z=-65},{x=-152, y=9, z=-65},2},
|
||||||
|
{209, {x=-154, y=9, z=-66},{x=-153, y=9, z=-66},2},
|
||||||
|
{210, {x=-150, y=9, z=-73},{x=-149, y=9, z=-73},2},
|
||||||
|
{211, {x=-150, y=9, z=-59},{x=-149, y=9, z=-59},2},
|
||||||
|
{212, {x=-151, y=9, z=-71},{x=-150, y=9, z=-71},2},
|
||||||
|
{213, {x=-151, y=9, z=-61},{x=-150, y=9, z=-61},2},
|
||||||
|
{214, {x=-151, y=9, z=-69},{x=-150, y=9, z=-69},2},
|
||||||
|
{215, {x=-151, y=9, z=-63},{x=-150, y=9, z=-63},2},
|
||||||
|
{216, {x=-152, y=9, z=-68},{x=-151, y=9, z=-68},2},
|
||||||
|
{217, {x=-152, y=9, z=-64},{x=-151, y=9, z=-64},2},
|
||||||
|
{218, {x=-152, y=9, z=-67},{x=-151, y=9, z=-67},2},
|
||||||
|
{219, {x=-152, y=9, z=-65},{x=-151, y=9, z=-65},2},
|
||||||
|
{220, {x=-153, y=9, z=-66},{x=-152, y=9, z=-66},2},
|
||||||
|
{221, {x=-149, y=9, z=-73},{x=-148, y=9, z=-72},2},
|
||||||
|
{222, {x=-149, y=9, z=-59},{x=-148, y=9, z=-60},2},
|
||||||
|
{223, {x=-150, y=9, z=-71},{x=-149, y=9, z=-70},2},
|
||||||
|
{224, {x=-150, y=9, z=-61},{x=-149, y=9, z=-62},2},
|
||||||
|
{225, {x=-150, y=9, z=-69},{x=-149, y=9, z=-69},2},
|
||||||
|
{226, {x=-150, y=9, z=-63},{x=-149, y=9, z=-63},2},
|
||||||
|
{227, {x=-151, y=9, z=-68},{x=-150, y=9, z=-68},2},
|
||||||
|
{228, {x=-151, y=9, z=-64},{x=-150, y=9, z=-64},2},
|
||||||
|
{229, {x=-151, y=9, z=-67},{x=-150, y=9, z=-67},2},
|
||||||
|
{230, {x=-151, y=9, z=-65},{x=-150, y=9, z=-65},2},
|
||||||
|
{231, {x=-152, y=9, z=-66},{x=-151, y=9, z=-66},2},
|
||||||
|
{232, {x=-148, y=9, z=-72},{x=-147, y=9, z=-72},2},
|
||||||
|
{233, {x=-148, y=9, z=-60},{x=-147, y=9, z=-60},2},
|
||||||
|
{234, {x=-149, y=9, z=-70},{x=-148, y=9, z=-70},2},
|
||||||
|
{235, {x=-149, y=9, z=-62},{x=-148, y=9, z=-62},2},
|
||||||
|
{236, {x=-149, y=9, z=-69},{x=-148, y=9, z=-69},2},
|
||||||
|
{237, {x=-149, y=9, z=-63},{x=-148, y=9, z=-63},2},
|
||||||
|
{238, {x=-150, y=9, z=-68},{x=-149, y=9, z=-68},2},
|
||||||
|
{239, {x=-150, y=9, z=-64},{x=-149, y=9, z=-64},2},
|
||||||
|
{240, {x=-150, y=9, z=-67},{x=-149, y=9, z=-67},2},
|
||||||
|
{241, {x=-150, y=9, z=-65},{x=-149, y=9, z=-65},2},
|
||||||
|
{242, {x=-151, y=9, z=-66},{x=-150, y=9, z=-66},2},
|
||||||
|
{243, {x=-147, y=9, z=-72},{x=-146, y=9, z=-72},2},
|
||||||
|
{244, {x=-147, y=9, z=-60},{x=-146, y=9, z=-60},2},
|
||||||
|
{245, {x=-148, y=9, z=-70},{x=-147, y=9, z=-70},2},
|
||||||
|
{246, {x=-148, y=9, z=-62},{x=-147, y=9, z=-62},2},
|
||||||
|
{247, {x=-148, y=9, z=-69},{x=-147, y=9, z=-69},2},
|
||||||
|
{248, {x=-148, y=9, z=-63},{x=-147, y=9, z=-63},2},
|
||||||
|
{249, {x=-149, y=9, z=-68},{x=-148, y=9, z=-68},2},
|
||||||
|
{250, {x=-149, y=9, z=-64},{x=-148, y=9, z=-64},2},
|
||||||
|
{251, {x=-149, y=9, z=-67},{x=-148, y=9, z=-67},2},
|
||||||
|
{252, {x=-149, y=9, z=-65},{x=-148, y=9, z=-65},2},
|
||||||
|
{253, {x=-150, y=9, z=-66},{x=-149, y=9, z=-66},2},
|
||||||
|
{254, {x=-146, y=9, z=-72},{x=-145, y=9, z=-71},2},
|
||||||
|
{255, {x=-146, y=9, z=-60},{x=-145, y=9, z=-61},2},
|
||||||
|
{256, {x=-147, y=9, z=-70},{x=-146, y=9, z=-70},2},
|
||||||
|
{257, {x=-147, y=9, z=-62},{x=-146, y=9, z=-62},2},
|
||||||
|
{258, {x=-145, y=9, z=-71},{x=-144, y=9, z=-71},2},
|
||||||
|
{259, {x=-145, y=9, z=-61},{x=-144, y=9, z=-61},2},
|
||||||
|
{260, {x=-146, y=9, z=-70},{x=-145, y=9, z=-70},2},
|
||||||
|
{261, {x=-146, y=9, z=-62},{x=-145, y=9, z=-62},2},
|
||||||
|
{262, {x=-147, y=9, z=-69},{x=-146, y=9, z=-69},2},
|
||||||
|
{263, {x=-147, y=9, z=-63},{x=-146, y=9, z=-63},2},
|
||||||
|
{264, {x=-148, y=9, z=-68},{x=-147, y=9, z=-68},2},
|
||||||
|
{265, {x=-148, y=9, z=-64},{x=-147, y=9, z=-64},2},
|
||||||
|
{266, {x=-144, y=9, z=-71},{x=-144, y=9, z=-70},2},
|
||||||
|
{267, {x=-144, y=9, z=-61},{x=-144, y=9, z=-62},2},
|
||||||
|
{268, {x=-145, y=9, z=-70},{x=-145, y=9, z=-69},2},
|
||||||
|
{269, {x=-145, y=9, z=-62},{x=-145, y=9, z=-63},2},
|
||||||
|
{270, {x=-147, y=9, z=-68},{x=-146, y=9, z=-68},2},
|
||||||
|
{271, {x=-147, y=9, z=-64},{x=-146, y=9, z=-64},2},
|
||||||
|
{272, {x=-148, y=9, z=-67},{x=-147, y=9, z=-67},2},
|
||||||
|
{273, {x=-148, y=9, z=-65},{x=-147, y=9, z=-65},2},
|
||||||
|
{274, {x=-149, y=9, z=-66},{x=-148, y=9, z=-66},2},
|
||||||
|
{275, {x=-147, y=9, z=-67},{x=-146, y=9, z=-67},2},
|
||||||
|
{276, {x=-147, y=9, z=-65},{x=-146, y=9, z=-65},2},
|
||||||
|
{277, {x=-148, y=9, z=-66},{x=-147, y=9, z=-66},2},
|
||||||
|
{278, {x=-146, y=9, z=-69},{x=-145, y=9, z=-68},2},
|
||||||
|
{279, {x=-146, y=9, z=-63},{x=-145, y=9, z=-64},2},
|
||||||
|
{280, {x=-144, y=9, z=-70},{x=-144, y=9, z=-69},2},
|
||||||
|
{281, {x=-144, y=9, z=-62},{x=-144, y=9, z=-63},2},
|
||||||
|
{282, {x=-145, y=9, z=-68},{x=-144, y=9, z=-67},2},
|
||||||
|
{283, {x=-145, y=9, z=-64},{x=-144, y=9, z=-65},2},
|
||||||
|
{284, {x=-147, y=9, z=-66},{x=-146, y=9, z=-66},2},
|
||||||
|
{285, {x=-146, y=9, z=-67},{x=-145, y=9, z=-67},2},
|
||||||
|
{286, {x=-146, y=9, z=-65},{x=-145, y=9, z=-65},2},
|
||||||
|
{287, {x=-146, y=9, z=-66},{x=-145, y=9, z=-66},2},
|
||||||
|
{288, {x=-146, y=9, z=-68},{x=-146, y=9, z=-67},2},
|
||||||
|
{289, {x=-146, y=9, z=-64},{x=-146, y=9, z=-65},2},
|
||||||
|
{290, {x=-145, y=9, z=-69},{x=-145, y=9, z=-68},2},
|
||||||
|
{291, {x=-145, y=9, z=-63},{x=-145, y=9, z=-64},2},
|
||||||
|
{292, {x=-144, y=9, z=-69},{x=-144, y=9, z=-68},2},
|
||||||
|
{293, {x=-144, y=9, z=-63},{x=-144, y=9, z=-64},2},
|
||||||
|
{294, {x=-146, y=9, z=-67},{x=-145, y=9, z=-67},2},
|
||||||
|
{295, {x=-146, y=9, z=-65},{x=-145, y=9, z=-65},2},
|
||||||
|
{296, {x=-145, y=9, z=-68},{x=-145, y=9, z=-67},2},
|
||||||
|
{297, {x=-145, y=9, z=-64},{x=-145, y=9, z=-65},2},
|
||||||
|
{298, {x=-144, y=9, z=-68},{x=-144, y=9, z=-67},2},
|
||||||
|
{299, {x=-144, y=9, z=-64},{x=-144, y=9, z=-65},2},
|
||||||
|
}
|
||||||
|
function Chapter3()
|
||||||
|
return list
|
||||||
|
end
|
|
@ -47,18 +47,34 @@ end
|
||||||
minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
|
minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
|
||||||
if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "castrum:fight2" then
|
if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "castrum:fight2" then
|
||||||
local dig = false
|
local dig = false
|
||||||
local dignum = 0
|
local dignum = math.random(4)
|
||||||
|
local com = 0
|
||||||
if node.name == "castrum:knight_dark" then
|
if node.name == "castrum:knight_dark" then
|
||||||
dig = true
|
dig = true
|
||||||
elseif node.name == "castrum:knight_lv1_dark" then
|
elseif node.name == "castrum:knight_lv1_dark" then
|
||||||
local fightnode = puncher:get_attribute("fightnode")
|
local fightnode = puncher:get_attribute("fightnode")
|
||||||
if fightnode == "1" then
|
if fightnode == "1" then
|
||||||
dignum = math.random(2)
|
com = 3
|
||||||
else
|
elseif fightnode == "2" then
|
||||||
dignum = 1
|
com = 4
|
||||||
|
elseif fightnode == "6" then
|
||||||
|
com = 3
|
||||||
|
elseif fightnode == "7" then
|
||||||
|
com = 4
|
||||||
|
end
|
||||||
|
elseif node.name == "castrum:knight_lv2_dark" then
|
||||||
|
local fightnode = puncher:get_attribute("fightnode")
|
||||||
|
if fightnode == "1" then
|
||||||
|
com = 2
|
||||||
|
elseif fightnode == "2" then
|
||||||
|
com = 3
|
||||||
|
elseif fightnode == "6" then
|
||||||
|
com = 2
|
||||||
|
elseif fightnode == "7" then
|
||||||
|
com = 3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if dignum == 1 then
|
if dignum < com then
|
||||||
dig = true
|
dig = true
|
||||||
end
|
end
|
||||||
if dig == true then
|
if dig == true then
|
||||||
|
@ -70,6 +86,30 @@ minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
|
||||||
if fightnode == "1" then
|
if fightnode == "1" then
|
||||||
minetest.set_node(minetest.string_to_pos(fightpos), {name="castrum:knight_lv1"})
|
minetest.set_node(minetest.string_to_pos(fightpos), {name="castrum:knight_lv1"})
|
||||||
screwdriver_handler(puncher, {type="node", under=minetest.string_to_pos(fightpos), above=minetest.string_to_pos(fightpos)}, 1)
|
screwdriver_handler(puncher, {type="node", under=minetest.string_to_pos(fightpos), above=minetest.string_to_pos(fightpos)}, 1)
|
||||||
|
local inv = puncher:get_inventory()
|
||||||
|
inv:remove_item("main", "castrum:knight_lv1")
|
||||||
|
end
|
||||||
|
if fightnode == "2" then
|
||||||
|
minetest.set_node(minetest.string_to_pos(fightpos), {name="castrum:knight_lv2"})
|
||||||
|
screwdriver_handler(puncher, {type="node", under=minetest.string_to_pos(fightpos), above=minetest.string_to_pos(fightpos)}, 1)
|
||||||
|
local inv = puncher:get_inventory()
|
||||||
|
inv:remove_item("main", "castrum:knight_lv2")
|
||||||
|
end
|
||||||
|
if fightnode == "6" then
|
||||||
|
local pos = minetest.string_to_pos(fightpos)
|
||||||
|
minetest.set_node({x=pos.x,y=pos.y,z=pos.z}, {name="castrum:horse1"})
|
||||||
|
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name="castrum:knight_lv1_sit"})
|
||||||
|
screwdriver_handler(puncher, {type="node", under={x=pos.x,y=pos.y+1,z=pos.z}, above={x=pos.x,y=pos.y+2,z=pos.z}}, 1)
|
||||||
|
local inv = puncher:get_inventory()
|
||||||
|
inv:remove_item("main", "castrum:horse1_item_1")
|
||||||
|
end
|
||||||
|
if fightnode == "7" then
|
||||||
|
local pos = minetest.string_to_pos(fightpos)
|
||||||
|
minetest.set_node({x=pos.x,y=pos.y,z=pos.z}, {name="castrum:horse1"})
|
||||||
|
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name="castrum:knight_lv2_sit"})
|
||||||
|
screwdriver_handler(puncher, {type="node", under={x=pos.x,y=pos.y+1,z=pos.z}, above={x=pos.x,y=pos.y+2,z=pos.z}}, 1)
|
||||||
|
local inv = puncher:get_inventory()
|
||||||
|
inv:remove_item("main", "castrum:horse1_item_2")
|
||||||
end
|
end
|
||||||
for j=144,174 do
|
for j=144,174 do
|
||||||
for i=51,81 do
|
for i=51,81 do
|
||||||
|
@ -77,59 +117,96 @@ minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
fight_step2(puncher)
|
fight_step2(puncher)
|
||||||
local inv = puncher:get_inventory()
|
|
||||||
inv:remove_item("main", "castrum:knight_lv1")
|
|
||||||
puncher:set_attribute("fightdig", "false")
|
puncher:set_attribute("fightdig", "false")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function get_fight(level,player)
|
function get_fight(level,player)
|
||||||
for j=144,174 do
|
player:set_attribute("fightkill1", "0")
|
||||||
for i=51,81 do
|
player:set_attribute("fightkill2", "0")
|
||||||
minetest.set_node({x=j*(-1), y=9, z=i*(-1)}, {name="air"})
|
player:set_attribute("fighthkill1", "0")
|
||||||
minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="default:dirt_with_grass"})
|
file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "r")
|
||||||
end
|
|
||||||
end
|
|
||||||
for i=67,76 do
|
|
||||||
minetest.set_node({x=-144, y=8, z=i*(-1)}, {name="castrum:fight1"})
|
|
||||||
end
|
|
||||||
for i=56,65 do
|
|
||||||
minetest.set_node({x=-144, y=8, z=i*(-1)}, {name="castrum:fight1"})
|
|
||||||
end
|
|
||||||
for i=57,75 do
|
|
||||||
minetest.set_node({x=-145, y=8, z=i*(-1)}, {name="castrum:fight1"})
|
|
||||||
end
|
|
||||||
for i=58,74 do
|
|
||||||
minetest.set_node({x=-146, y=8, z=i*(-1)}, {name="castrum:fight1"})
|
|
||||||
end
|
|
||||||
for i=59,73 do
|
|
||||||
minetest.set_node({x=-147, y=8, z=i*(-1)}, {name="castrum:fight1"})
|
|
||||||
end
|
|
||||||
for i=61,71 do
|
|
||||||
minetest.set_node({x=-148, y=8, z=i*(-1)}, {name="castrum:fight1"})
|
|
||||||
end
|
|
||||||
for i=63,69 do
|
|
||||||
minetest.set_node({x=-149, y=8, z=i*(-1)}, {name="castrum:fight1"})
|
|
||||||
end
|
|
||||||
for i=65,67 do
|
|
||||||
minetest.set_node({x=-150, y=8, z=i*(-1)}, {name="castrum:fight1"})
|
|
||||||
end
|
|
||||||
minetest.set_node({x=-144, y=9, z=-66}, {name="castrum:castrum_knight1"})
|
|
||||||
minetest.set_node({x=-174, y=9, z=-66}, {name="castrum:knight_dark"})
|
|
||||||
player:setpos({x=-135, y=8.5, z=-66})
|
|
||||||
screwdriver_handler(player, {type="node", under={x=-144, y=9, z=-66}, above={x=-144, y=9, z=-66}}, 1)
|
|
||||||
screwdriver_handler(player, {type="node", under={x=-174, y=9, z=-66}, above={x=-174, y=9, z=-66}}, 1)
|
|
||||||
screwdriver_handler(player, {type="node", under={x=-174, y=9, z=-66}, above={x=-174, y=9, z=-66}}, 1)
|
|
||||||
screwdriver_handler(player, {type="node", under={x=-174, y=9, z=-66}, above={x=-174, y=9, z=-66}}, 1)
|
|
||||||
file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "r")
|
|
||||||
local knight_1 = file:read("*l")
|
local knight_1 = file:read("*l")
|
||||||
file:close()
|
file:close()
|
||||||
local inv = player:get_inventory()
|
file = io.open(minetest.get_worldpath().."/SAVE/Knight_2.txt", "r")
|
||||||
if tonumber(knight_1) > 0 then
|
local knight_2 = file:read("*l")
|
||||||
inv:add_item("main","castrum:knight_lv1 "..knight_1)
|
file:close()
|
||||||
end
|
local inv = player:get_inventory()
|
||||||
player:set_attribute("fight", "false")
|
local num = 0
|
||||||
set_fight(player,level)
|
for i=1,32 do
|
||||||
|
if inv:get_stack("main", i):is_empty() then
|
||||||
|
num = num+1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if tonumber(knight_1) > 0 or tonumber(knight_2) > 0 then
|
||||||
|
if num > 9 then
|
||||||
|
for j=144,174 do
|
||||||
|
for i=51,81 do
|
||||||
|
minetest.set_node({x=j*(-1), y=10, z=i*(-1)}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="default:dirt_with_grass"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for i=67,76 do
|
||||||
|
minetest.set_node({x=-144, y=8, z=i*(-1)}, {name="castrum:fight1"})
|
||||||
|
end
|
||||||
|
for i=56,65 do
|
||||||
|
minetest.set_node({x=-144, y=8, z=i*(-1)}, {name="castrum:fight1"})
|
||||||
|
end
|
||||||
|
for i=57,75 do
|
||||||
|
minetest.set_node({x=-145, y=8, z=i*(-1)}, {name="castrum:fight1"})
|
||||||
|
end
|
||||||
|
for i=58,74 do
|
||||||
|
minetest.set_node({x=-146, y=8, z=i*(-1)}, {name="castrum:fight1"})
|
||||||
|
end
|
||||||
|
for i=59,73 do
|
||||||
|
minetest.set_node({x=-147, y=8, z=i*(-1)}, {name="castrum:fight1"})
|
||||||
|
end
|
||||||
|
for i=61,71 do
|
||||||
|
minetest.set_node({x=-148, y=8, z=i*(-1)}, {name="castrum:fight1"})
|
||||||
|
end
|
||||||
|
for i=63,69 do
|
||||||
|
minetest.set_node({x=-149, y=8, z=i*(-1)}, {name="castrum:fight1"})
|
||||||
|
end
|
||||||
|
for i=65,67 do
|
||||||
|
minetest.set_node({x=-150, y=8, z=i*(-1)}, {name="castrum:fight1"})
|
||||||
|
end
|
||||||
|
minetest.set_node({x=-144, y=9, z=-66}, {name="castrum:castrum_knight1"})
|
||||||
|
minetest.set_node({x=-174, y=9, z=-66}, {name="castrum:knight_dark"})
|
||||||
|
player:setpos({x=-135, y=8.5, z=-66})
|
||||||
|
screwdriver_handler(player, {type="node", under={x=-144, y=9, z=-66}, above={x=-144, y=9, z=-66}}, 1)
|
||||||
|
screwdriver_handler(player, {type="node", under={x=-174, y=9, z=-66}, above={x=-174, y=9, z=-66}}, 1)
|
||||||
|
screwdriver_handler(player, {type="node", under={x=-174, y=9, z=-66}, above={x=-174, y=9, z=-66}}, 1)
|
||||||
|
screwdriver_handler(player, {type="node", under={x=-174, y=9, z=-66}, above={x=-174, y=9, z=-66}}, 1)
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "r")
|
||||||
|
local knight_1 = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Knight_2.txt", "r")
|
||||||
|
local knight_2 = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Knight_2.txt", "r")
|
||||||
|
local knight_2 = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Horse_1.txt", "r")
|
||||||
|
local horse_1 = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
if tonumber(knight_1) > 0 then
|
||||||
|
inv:add_item("main","castrum:knight_lv1 "..knight_1)
|
||||||
|
end
|
||||||
|
if tonumber(knight_2) > 0 then
|
||||||
|
inv:add_item("main","castrum:knight_lv2 "..knight_2)
|
||||||
|
end
|
||||||
|
if tonumber(horse_1) > 0 then
|
||||||
|
inv:add_item("main","castrum:horse1_item "..horse_1)
|
||||||
|
end
|
||||||
|
player:set_attribute("fight", "false")
|
||||||
|
set_fight(player,level)
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(player:get_player_name(), "you have not enough space in your inventory")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(player:get_player_name(), "you have no knights")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
function set_fight(player,level)
|
function set_fight(player,level)
|
||||||
if level == 1 then
|
if level == 1 then
|
||||||
|
@ -176,6 +253,33 @@ function set_fight(player,level)
|
||||||
turn(player,{x=-170, y=9, z=-62},3)
|
turn(player,{x=-170, y=9, z=-62},3)
|
||||||
minetest.set_node({x=-169, y=9, z=-64}, {name="castrum:knight_lv1_dark"})
|
minetest.set_node({x=-169, y=9, z=-64}, {name="castrum:knight_lv1_dark"})
|
||||||
turn(player,{x=-169, y=9, z=-64},3)
|
turn(player,{x=-169, y=9, z=-64},3)
|
||||||
|
elseif level == 3 then
|
||||||
|
minetest.set_node({x=-173, y=9, z=-65}, {name="castrum:knight_lv2_dark"})
|
||||||
|
turn(player,{x=-173, y=9, z=-65},3)
|
||||||
|
minetest.set_node({x=-173, y=9, z=-67}, {name="castrum:knight_lv2_dark"})
|
||||||
|
turn(player,{x=-173, y=9, z=-67},3)
|
||||||
|
minetest.set_node({x=-173, y=9, z=-62}, {name="castrum:knight_lv2_dark"})
|
||||||
|
turn(player,{x=-173, y=9, z=-62},3)
|
||||||
|
minetest.set_node({x=-173, y=9, z=-70}, {name="castrum:knight_lv2_dark"})
|
||||||
|
turn(player,{x=-173, y=9, z=-70},3)
|
||||||
|
minetest.set_node({x=-171, y=9, z=-69}, {name="castrum:knight_lv2_dark"})
|
||||||
|
turn(player,{x=-171, y=9, z=-69},3)
|
||||||
|
minetest.set_node({x=-171, y=9, z=-63}, {name="castrum:knight_lv2_dark"})
|
||||||
|
turn(player,{x=-171, y=9, z=-63},3)
|
||||||
|
minetest.set_node({x=-170, y=9, z=-65}, {name="castrum:knight_lv2_dark"})
|
||||||
|
turn(player,{x=-170, y=9, z=-65},3)
|
||||||
|
minetest.set_node({x=-170, y=9, z=-67}, {name="castrum:knight_lv2_dark"})
|
||||||
|
turn(player,{x=-170, y=9, z=-67},3)
|
||||||
|
minetest.set_node({x=-170, y=9, z=-70}, {name="castrum:knight_lv2_dark"})
|
||||||
|
turn(player,{x=-170, y=9, z=-70},3)
|
||||||
|
minetest.set_node({x=-169, y=9, z=-68}, {name="castrum:knight_lv2_dark"})
|
||||||
|
turn(player,{x=-169, y=9, z=-68},3)
|
||||||
|
minetest.set_node({x=-168, y=9, z=-66}, {name="castrum:knight_lv2_dark"})
|
||||||
|
turn(player,{x=-168, y=9, z=-66},3)
|
||||||
|
minetest.set_node({x=-170, y=9, z=-62}, {name="castrum:knight_lv2_dark"})
|
||||||
|
turn(player,{x=-170, y=9, z=-62},3)
|
||||||
|
minetest.set_node({x=-169, y=9, z=-64}, {name="castrum:knight_lv2_dark"})
|
||||||
|
turn(player,{x=-169, y=9, z=-64},3)
|
||||||
end
|
end
|
||||||
player:set_attribute("fightlv", ""..level)
|
player:set_attribute("fightlv", ""..level)
|
||||||
end
|
end
|
||||||
|
@ -185,7 +289,10 @@ function fight_step1(player)
|
||||||
local start = false
|
local start = false
|
||||||
for j=144,174 do
|
for j=144,174 do
|
||||||
for i=51,81 do
|
for i=51,81 do
|
||||||
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv1" then
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv2" then
|
||||||
|
start = true
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=10, z=i*(-1)}).name == "castrum:knight_lv1_sit" or minetest.get_node({x=j*(-1), y=10, z=i*(-1)}).name == "castrum:knight_lv2_sit" then
|
||||||
start = true
|
start = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -195,9 +302,11 @@ function fight_step1(player)
|
||||||
else
|
else
|
||||||
player:set_attribute("fight", "true")
|
player:set_attribute("fight", "true")
|
||||||
player:set_attribute("fightmove", "1")
|
player:set_attribute("fightmove", "1")
|
||||||
player:set_attribute("fightkill", "0")
|
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
inv:remove_item("main", "castrum:knight_lv1 80")
|
inv:remove_item("main", "castrum:knight_lv1 80")
|
||||||
|
inv:remove_item("main", "castrum:knight_lv2 80")
|
||||||
|
inv:remove_item("main", "castrum:horse1_item 5")
|
||||||
for j=144,174 do
|
for j=144,174 do
|
||||||
for i=51,81 do
|
for i=51,81 do
|
||||||
minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="default:dirt_with_grass"})
|
minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="default:dirt_with_grass"})
|
||||||
|
@ -217,6 +326,8 @@ function fight_step2(player)
|
||||||
list = Chapter1()
|
list = Chapter1()
|
||||||
elseif tonumber(chapter) == 2 then
|
elseif tonumber(chapter) == 2 then
|
||||||
list = Chapter2()
|
list = Chapter2()
|
||||||
|
elseif tonumber(chapter) == 3 then
|
||||||
|
list = Chapter3()
|
||||||
end
|
end
|
||||||
local move2 = move
|
local move2 = move
|
||||||
local d = 0
|
local d = 0
|
||||||
|
@ -224,54 +335,473 @@ function fight_step2(player)
|
||||||
local dignum = 0
|
local dignum = 0
|
||||||
for j=144,174 do
|
for j=144,174 do
|
||||||
for i=51,81 do
|
for i=51,81 do
|
||||||
dignum = math.random(2)
|
dignum = math.random(4)
|
||||||
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv1_dark" and dignum == 1 then
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv1_dark" and dignum < 3 then
|
||||||
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)}).name == "castrum:castrum_knight1" then
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)+1, y=10, z=i*(-1)}).name == "castrum:knight_lv1_sit" then
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=10, z=i*(-1)}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)-1, y=10, z=i*(-1)}).name == "castrum:knight_lv1_sit" then
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=10, z=i*(-1)}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1), y=10, z=i*(-1)}).name == "castrum:knight_lv1_sit" then
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1), y=10, z=i*(-1)}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)-1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)+1, y=10, z=i*(-1)-1}).name == "castrum:knight_lv1_sit" then
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)-1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)-1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=10, z=i*(-1)-1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)-1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)-1, y=10, z=i*(-1)-1}).name == "castrum:knight_lv1_sit" then
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)-1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)-1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=10, z=i*(-1)-1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)-1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1), y=10, z=i*(-1)-1}).name == "castrum:knight_lv1_sit" then
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)-1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)-1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1), y=10, z=i*(-1)-1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)+1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)-1, y=10, z=i*(-1)+1}).name == "castrum:knight_lv1_sit" then
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)+1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)+1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=10, z=i*(-1)+1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)+1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)+1, y=10, z=i*(-1)+1}).name == "castrum:knight_lv1_sit" then
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)+1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)+1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=10, z=i*(-1)+1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)+1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1), y=10, z=i*(-1)+1}).name == "castrum:knight_lv1_sit" then
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)+1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)+1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1), y=10, z=i*(-1)+1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)}).name == "castrum:castrum_knight1" and dd == 0 then
|
||||||
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)}, {name="air"})
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)}, {name="air"})
|
||||||
player:set_attribute("fightkill", ""..(player:get_attribute("fightkill")+1))
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
dd = 1
|
dd = 1
|
||||||
end
|
end
|
||||||
if (minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)}).name == "castrum:castrum_knight1") and dd == 0 then
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)}).name == "castrum:castrum_knight1" and dd == 0 then
|
||||||
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)}, {name="air"})
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)}, {name="air"})
|
||||||
player:set_attribute("fightkill", ""..(player:get_attribute("fightkill")+1))
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
dd = 1
|
dd = 1
|
||||||
end
|
end
|
||||||
if (minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:castrum_knight1") and dd == 0 then
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:castrum_knight1" and dd == 0 then
|
||||||
minetest.set_node({x=j*(-1), y=9, z=i*(-1)}, {name="air"})
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)}, {name="air"})
|
||||||
player:set_attribute("fightkill", ""..(player:get_attribute("fightkill")+1))
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
dd = 1
|
dd = 1
|
||||||
end
|
end
|
||||||
if (minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)-1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)-1}).name == "castrum:castrum_knight1") and dd == 0 then
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)-1}).name == "castrum:castrum_knight1" and dd == 0 then
|
||||||
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)-1}, {name="air"})
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)-1}, {name="air"})
|
||||||
player:set_attribute("fightkill", ""..(player:get_attribute("fightkill")+1))
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
dd = 1
|
dd = 1
|
||||||
end
|
end
|
||||||
if (minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)-1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)-1}).name == "castrum:castrum_knight1") and dd == 0 then
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)-1}).name == "castrum:castrum_knight1" and dd == 0 then
|
||||||
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)-1}, {name="air"})
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)-1}, {name="air"})
|
||||||
player:set_attribute("fightkill", ""..(player:get_attribute("fightkill")+1))
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
dd = 1
|
dd = 1
|
||||||
end
|
end
|
||||||
if (minetest.get_node({x=j*(-1), y=9, z=i*(-1)-1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1), y=9, z=i*(-1)-1}).name == "castrum:castrum_knight1") and dd == 0 then
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)-1}).name == "castrum:castrum_knight1" and dd == 0 then
|
||||||
minetest.set_node({x=j*(-1), y=9, z=i*(-1)-1}, {name="air"})
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)-1}, {name="air"})
|
||||||
player:set_attribute("fightkill", ""..(player:get_attribute("fightkill")+1))
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
dd = 1
|
dd = 1
|
||||||
end
|
end
|
||||||
if (minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)+1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)+1}).name == "castrum:castrum_knight1") and dd == 0 then
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)+1}).name == "castrum:castrum_knight1" and dd == 0 then
|
||||||
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)+1}, {name="air"})
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)+1}, {name="air"})
|
||||||
player:set_attribute("fightkill", ""..(player:get_attribute("fightkill")+1))
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
dd = 1
|
dd = 1
|
||||||
end
|
end
|
||||||
if (minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)+1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)+1}).name == "castrum:castrum_knight1") and dd == 0 then
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)+1}).name == "castrum:castrum_knight1" and dd == 0 then
|
||||||
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)+1}, {name="air"})
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)+1}, {name="air"})
|
||||||
player:set_attribute("fightkill", ""..(player:get_attribute("fightkill")+1))
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
dd = 1
|
dd = 1
|
||||||
end
|
end
|
||||||
if (minetest.get_node({x=j*(-1), y=9, z=i*(-1)+1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1), y=9, z=i*(-1)+1}).name == "castrum:castrum_knight1") and dd == 0 then
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)+1}).name == "castrum:castrum_knight1" and dd == 0 then
|
||||||
minetest.set_node({x=j*(-1), y=9, z=i*(-1)+1}, {name="air"})
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)+1}, {name="air"})
|
||||||
player:set_attribute("fightkill", ""..(player:get_attribute("fightkill")+1))
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
dd = 1
|
dd = 1
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv1_dark" and dignum < 2 then
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1)+1, y=10, z=i*(-1)}).name == "castrum:knight_lv2_sit" then
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=10, z=i*(-1)}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1)-1, y=10, z=i*(-1)}).name == "castrum:knight_lv2_sit" then
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=10, z=i*(-1)}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1), y=10, z=i*(-1)}).name == "castrum:knight_lv2_sit" then
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1), y=10, z=i*(-1)}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)-1}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1)+1, y=10, z=i*(-1)-1}).name == "castrum:knight_lv2_sit" then
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)-1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)-1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=10, z=i*(-1)-1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)-1}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1)-1, y=10, z=i*(-1)-1}).name == "castrum:knight_lv2_sit" then
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)-1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)-1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=10, z=i*(-1)-1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)-1}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1), y=10, z=i*(-1)-1}).name == "castrum:knight_lv2_sit" then
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)-1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)-1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1), y=10, z=i*(-1)-1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)+1}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1)-1, y=10, z=i*(-1)+1}).name == "castrum:knight_lv2_sit" then
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)+1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)+1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=10, z=i*(-1)+1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)+1}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1)+1, y=10, z=i*(-1)+1}).name == "castrum:knight_lv12_sit" then
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)+1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)+1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=10, z=i*(-1)+1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)+1}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1), y=10, z=i*(-1)+1}).name == "castrum:knight_lv2_sit" then
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)+1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)+1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1), y=10, z=i*(-1)+1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)}).name == "castrum:knight_lv2" and dd == 0 then
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)}, {name="air"})
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)}).name == "castrum:knight_lv2" and dd == 0 then
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)}, {name="air"})
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv2" and dd == 0 then
|
||||||
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)}, {name="air"})
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)-1}).name == "castrum:knight_lv2" and dd == 0 then
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)-1}, {name="air"})
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)-1}).name == "castrum:knight_lv2" and dd == 0 then
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)-1}, {name="air"})
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)-1}).name == "castrum:knight_lv2" and dd == 0 then
|
||||||
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)-1}, {name="air"})
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)+1}).name == "castrum:knight_lv2" and dd == 0 then
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)+1}, {name="air"})
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)+1}).name == "castrum:knight_lv2" and dd == 0 then
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)+1}, {name="air"})
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)+1}).name == "castrum:knight_lv2" and dd == 0 then
|
||||||
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)+1}, {name="air"})
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv2_dark" and dignum < 4 then
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)+1, y=10, z=i*(-1)}).name == "castrum:knight_lv1_sit" then
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=10, z=i*(-1)}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)-1, y=10, z=i*(-1)}).name == "castrum:knight_lv1_sit" then
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=10, z=i*(-1)}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1), y=10, z=i*(-1)}).name == "castrum:knight_lv1_sit" then
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1), y=10, z=i*(-1)}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)-1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)+1, y=10, z=i*(-1)-1}).name == "castrum:knight_lv1_sit" then
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)-1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)-1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=10, z=i*(-1)-1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)-1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)-1, y=10, z=i*(-1)-1}).name == "castrum:knight_lv1_sit" then
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)-1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)-1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=10, z=i*(-1)-1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)-1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1), y=10, z=i*(-1)-1}).name == "castrum:knight_lv1_sit" then
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)-1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)-1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1), y=10, z=i*(-1)-1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)+1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)-1, y=10, z=i*(-1)+1}).name == "castrum:knight_lv1_sit" then
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)+1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)+1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=10, z=i*(-1)+1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)+1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)+1, y=10, z=i*(-1)+1}).name == "castrum:knight_lv1_sit" then
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)+1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)+1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=10, z=i*(-1)+1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)+1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1), y=10, z=i*(-1)+1}).name == "castrum:knight_lv1_sit" then
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)+1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)+1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1), y=10, z=i*(-1)+1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)}).name == "castrum:castrum_knight1" and dd == 0 then
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)}, {name="air"})
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)}).name == "castrum:castrum_knight1" and dd == 0 then
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)}, {name="air"})
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:castrum_knight1" and dd == 0 then
|
||||||
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)}, {name="air"})
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)-1}).name == "castrum:castrum_knight1" and dd == 0 then
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)-1}, {name="air"})
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)-1}).name == "castrum:castrum_knight1" and dd == 0 then
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)-1}, {name="air"})
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)-1}).name == "castrum:castrum_knight1" and dd == 0 then
|
||||||
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)-1}, {name="air"})
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)+1}).name == "castrum:castrum_knight1" and dd == 0 then
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)+1}, {name="air"})
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)+1}).name == "castrum:castrum_knight1" and dd == 0 then
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)+1}, {name="air"})
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)+1}).name == "castrum:castrum_knight1" and dd == 0 then
|
||||||
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)+1}, {name="air"})
|
||||||
|
player:set_attribute("fightkill1", ""..(player:get_attribute("fightkill1")+1))
|
||||||
|
dd = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv2_dark" and dignum < 3 then
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1)+1, y=10, z=i*(-1)}).name == "castrum:knight_lv2_sit" then
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=10, z=i*(-1)}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1)-1, y=10, z=i*(-1)}).name == "castrum:knight_lv2_sit" then
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=10, z=i*(-1)}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1), y=10, z=i*(-1)}).name == "castrum:knight_lv2_sit" then
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1), y=10, z=i*(-1)}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)-1}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1)+1, y=10, z=i*(-1)-1}).name == "castrum:knight_lv2_sit" then
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)-1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)-1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=10, z=i*(-1)-1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)-1}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1)-1, y=10, z=i*(-1)-1}).name == "castrum:knight_lv2_sit" then
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)-1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)-1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=10, z=i*(-1)-1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)-1}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1), y=10, z=i*(-1)-1}).name == "castrum:knight_lv2_sit" then
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)-1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)-1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1), y=10, z=i*(-1)-1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)+1}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1)-1, y=10, z=i*(-1)+1}).name == "castrum:knight_lv2_sit" then
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)+1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)+1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)-1, y=10, z=i*(-1)+1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)+1}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1)+1, y=10, z=i*(-1)+1}).name == "castrum:knight_lv12_sit" then
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)+1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)+1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1)+1, y=10, z=i*(-1)+1}, {name="air"})
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)+1}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1), y=10, z=i*(-1)+1}).name == "castrum:knight_lv2_sit" then
|
||||||
|
player:set_attribute("fightkill2", ""..(player:get_attribute("fightkill2")+1))
|
||||||
|
dd = 1
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)+1}).name == "castrum:horse1" then
|
||||||
|
player:set_attribute("fighthkill1", ""..(player:get_attribute("fighthkill1")+1))
|
||||||
|
end
|
||||||
|
minetest.set_node({x=j*(-1), y=9, z=i*(-1)+1}, {name="air"})
|
||||||
|
minetest.set_node({x=j*(-1), y=10, z=i*(-1)+1}, {name="air"})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -301,15 +831,28 @@ function fight_step2(player)
|
||||||
move2 = move2+1
|
move2 = move2+1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
while d == 0 and move2 < 300 and dd == 0 and tonumber(chapter) == 3 do
|
||||||
|
if minetest.get_node(list[move2][2]).name == "castrum:knight_lv2_dark" then
|
||||||
|
minetest.set_node(list[move2][2], {name="air"})
|
||||||
|
minetest.set_node(list[move2][3], {name="castrum:knight_lv2_dark"})
|
||||||
|
player:set_attribute("fightmove", ""..(move2+1))
|
||||||
|
screwdriver_handler(player, {type="node", under=list[move2][3], above=list[move2][3]}, 1)
|
||||||
|
screwdriver_handler(player, {type="node", under=list[move2][3], above=list[move2][3]}, 1)
|
||||||
|
screwdriver_handler(player, {type="node", under=list[move2][3], above=list[move2][3]}, 1)
|
||||||
|
d = 1
|
||||||
|
else
|
||||||
|
move2 = move2+1
|
||||||
|
end
|
||||||
|
end
|
||||||
local kg = 0
|
local kg = 0
|
||||||
local ky = 0
|
local ky = 0
|
||||||
local tg = 0
|
local tg = 0
|
||||||
local ty = 0
|
local ty = 0
|
||||||
for j=144,174 do
|
for j=144,174 do
|
||||||
for i=51,81 do
|
for i=51,81 do
|
||||||
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv1_dark" then
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv1_dark" or minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv2_dark" then
|
||||||
tg = 1
|
tg = 1
|
||||||
elseif minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv1" then
|
elseif minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1), y=10, z=i*(-1)}).name == "castrum:knight_lv1_sit" or minetest.get_node({x=j*(-1), y=10, z=i*(-1)}).name == "castrum:knight_lv2_sit" then
|
||||||
ty = 1
|
ty = 1
|
||||||
elseif minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:castrum_knight1" then
|
elseif minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:castrum_knight1" then
|
||||||
ky = 1
|
ky = 1
|
||||||
|
@ -323,6 +866,9 @@ function fight_step2(player)
|
||||||
player:setpos({x=-74, y=8.5, z=-77})
|
player:setpos({x=-74, y=8.5, z=-77})
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
inv:remove_item("main", "castrum:knight_lv1 80")
|
inv:remove_item("main", "castrum:knight_lv1 80")
|
||||||
|
inv:remove_item("main", "castrum:knight_lv2 80")
|
||||||
|
inv:remove_item("main", "castrum:horse1_item_1 5")
|
||||||
|
inv:remove_item("main", "castrum:horse1_item_2 5")
|
||||||
file = io.open(minetest.get_worldpath().."/SAVE/Chapter.txt", "r")
|
file = io.open(minetest.get_worldpath().."/SAVE/Chapter.txt", "r")
|
||||||
local chapter = file:read("*l")
|
local chapter = file:read("*l")
|
||||||
file:close()
|
file:close()
|
||||||
|
@ -333,29 +879,157 @@ function fight_step2(player)
|
||||||
local knight_1 = file:read("*l")
|
local knight_1 = file:read("*l")
|
||||||
file:close()
|
file:close()
|
||||||
file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "w")
|
file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "w")
|
||||||
file:write((tonumber(knight_1)-player:get_attribute("fightkill")))
|
file:write((tonumber(knight_1)-player:get_attribute("fightkill1")))
|
||||||
|
file:close()
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Knight_2.txt", "r")
|
||||||
|
local knight_2 = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Knight_2.txt", "w")
|
||||||
|
file:write((tonumber(knight_2)-player:get_attribute("fightkill2")))
|
||||||
|
file:close()
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Horse_1.txt", "r")
|
||||||
|
local horse_1 = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Horse_1.txt", "w")
|
||||||
|
file:write((tonumber(horse_1)-player:get_attribute("fighthkill1")))
|
||||||
file:close()
|
file:close()
|
||||||
Update_knight(player)
|
Update_knight(player)
|
||||||
|
Update_horse(player)
|
||||||
elseif ky == 0 or ty == 0 then
|
elseif ky == 0 or ty == 0 then
|
||||||
minetest.chat_send_player(player:get_player_name(), "you lose")
|
minetest.chat_send_player(player:get_player_name(), "you lose")
|
||||||
player:setpos({x=-74, y=8.5, z=-77})
|
player:setpos({x=-74, y=8.5, z=-77})
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
inv:remove_item("main", "castrum:knight_lv1 80")
|
inv:remove_item("main", "castrum:knight_lv1 80")
|
||||||
|
inv:remove_item("main", "castrum:knight_lv2 80")
|
||||||
|
inv:remove_item("main", "castrum:horse1_item_1 5")
|
||||||
|
inv:remove_item("main", "castrum:horse1_item_2 5")
|
||||||
file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "r")
|
file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "r")
|
||||||
local knight_1 = file:read("*l")
|
local knight_1 = file:read("*l")
|
||||||
file:close()
|
file:close()
|
||||||
file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "w")
|
file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "w")
|
||||||
file:write((tonumber(knight_1)-player:get_attribute("fightkill")))
|
file:write((tonumber(knight_1)-player:get_attribute("fightkill1")))
|
||||||
|
file:close()
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Knight_2.txt", "r")
|
||||||
|
local knight_2 = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Knight_2.txt", "w")
|
||||||
|
file:write((tonumber(knight_2)-player:get_attribute("fightkill2")))
|
||||||
|
file:close()
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Horse_1.txt", "r")
|
||||||
|
local horse_1 = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Horse_1.txt", "w")
|
||||||
|
file:write((tonumber(horse_1)-player:get_attribute("fighthkill1")))
|
||||||
file:close()
|
file:close()
|
||||||
Update_knight(player)
|
Update_knight(player)
|
||||||
|
Update_horse(player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local start_fight = {}
|
||||||
|
start_fight.get_formspec = function(player, pos)
|
||||||
|
if player == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
formspec = "size[5,6.5]"
|
||||||
|
.."background[5,6.5;1,1;gui_formbg.png;true]"
|
||||||
|
.."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]"
|
||||||
|
.."bgcolor[#080808BB;true]"
|
||||||
|
.."button[0,2;5,1;;Start Fight]"
|
||||||
|
.."button[0,3;5,1;;Go Back]"
|
||||||
|
.."image_button[4.5,-0.3;0.8,0.8;;esc;X]"
|
||||||
|
return formspec
|
||||||
|
end
|
||||||
|
local go_back = {}
|
||||||
|
go_back.get_formspec = function(player, pos)
|
||||||
|
if player == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
formspec = "size[5,6.5]"
|
||||||
|
.."background[5,6.5;1,1;gui_formbg.png;true]"
|
||||||
|
.."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]"
|
||||||
|
.."bgcolor[#080808BB;true]"
|
||||||
|
.."label[0,1.4;If you go back, you will lose your placed knights and horses!]"
|
||||||
|
.."label[0,1.7;Go Back?]"
|
||||||
|
.."button[0,2;2.5,1;;Yes]"
|
||||||
|
.."button[2.5,2;2.5,1;;No]"
|
||||||
|
.."image_button[4.5,-0.3;0.8,0.8;;esc;X]"
|
||||||
|
return formspec
|
||||||
|
end
|
||||||
minetest.register_node("castrum:start_fight",{
|
minetest.register_node("castrum:start_fight",{
|
||||||
tiles = {"castrum_bridge_status.png"},
|
tiles = {"default_diamond_block.png"},
|
||||||
description = "Start fight",
|
description = "Start fight",
|
||||||
--groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
--groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
||||||
on_punch = function(pos, node, player, pointed_thing)
|
on_punch = function(pos, node, player, pointed_thing)
|
||||||
fight_step1(player)
|
minetest.show_formspec(player:get_player_name(), "start_fight" , start_fight.get_formspec(player))
|
||||||
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
local player_inv = player:get_inventory()
|
||||||
|
if formname == "start_fight" then
|
||||||
|
for k, v in pairs(fields) do
|
||||||
|
if v == "Start Fight" then
|
||||||
|
fight_step1(player)
|
||||||
|
minetest.show_formspec(player:get_player_name(), "", "")
|
||||||
|
elseif v == "Go Back" then
|
||||||
|
minetest.show_formspec(player:get_player_name(), "go_back", go_back.get_formspec(player))
|
||||||
|
elseif v == "X" then
|
||||||
|
minetest.show_formspec(player:get_player_name(), "", "")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if formname == "go_back" then
|
||||||
|
for k, v in pairs(fields) do
|
||||||
|
if v == "Yes" then
|
||||||
|
local k1 = player:get_attribute("fightkill1")
|
||||||
|
local k2 = player:get_attribute("fightkill2")
|
||||||
|
local h1 = player:get_attribute("fighthkill1")
|
||||||
|
for j=144,174 do
|
||||||
|
for i=51,81 do
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1), y=10, z=i*(-1)}).name == "castrum:knight_lv1_sit" then
|
||||||
|
k1 = k1+1
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv2" or minetest.get_node({x=j*(-1), y=10, z=i*(-1)}).name == "castrum:knight_lv2_sit" then
|
||||||
|
k2 = k2+1
|
||||||
|
end
|
||||||
|
if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:horse1" then
|
||||||
|
h1 = h1+1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "r")
|
||||||
|
local knight_1 = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "w")
|
||||||
|
file:write((tonumber(knight_1)-k1))
|
||||||
|
file:close()
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Knight_2.txt", "r")
|
||||||
|
local knight_2 = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Knight_2.txt", "w")
|
||||||
|
file:write((tonumber(knight_2)-k2))
|
||||||
|
file:close()
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Horse_1.txt", "r")
|
||||||
|
local horse_1 = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Horse_1.txt", "w")
|
||||||
|
file:write((tonumber(horse_1)-h1))
|
||||||
|
file:close()
|
||||||
|
Update_knight(player)
|
||||||
|
Update_horse(player)
|
||||||
|
player:setpos({x=-74, y=8.5, z=-77})
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
inv:remove_item("main", "castrum:knight_lv1 80")
|
||||||
|
inv:remove_item("main", "castrum:knight_lv2 80")
|
||||||
|
inv:remove_item("main", "castrum:horse1_item 5")
|
||||||
|
inv:remove_item("main", "castrum:horse1_item_1 5")
|
||||||
|
inv:remove_item("main", "castrum:horse1_item_2 5")
|
||||||
|
|
||||||
|
minetest.show_formspec(player:get_player_name(), "", "")
|
||||||
|
elseif v == "No" then
|
||||||
|
minetest.show_formspec(player:get_player_name(), "", "")
|
||||||
|
elseif v == "X" then
|
||||||
|
minetest.show_formspec(player:get_player_name(), "", "")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.8 KiB |
|
@ -0,0 +1,24 @@
|
||||||
|
# Blender MTL File: 'horse.blend'
|
||||||
|
# Material Count: 2
|
||||||
|
|
||||||
|
newmtl horse
|
||||||
|
Ns 96.078431
|
||||||
|
Ka 1.000000 1.000000 1.000000
|
||||||
|
Kd 0.640000 0.640000 0.640000
|
||||||
|
Ks 0.500000 0.500000 0.500000
|
||||||
|
Ke 0.000000 0.000000 0.000000
|
||||||
|
Ni 1.000000
|
||||||
|
d 1.000000
|
||||||
|
illum 2
|
||||||
|
map_Kd D:\Home\Documents\LOTT\Horse\template.png
|
||||||
|
|
||||||
|
newmtl horse_NONE
|
||||||
|
Ns 96.078431
|
||||||
|
Ka 1.000000 1.000000 1.000000
|
||||||
|
Kd 0.640000 0.640000 0.640000
|
||||||
|
Ks 0.500000 0.500000 0.500000
|
||||||
|
Ke 0.000000 0.000000 0.000000
|
||||||
|
Ni 1.000000
|
||||||
|
d 1.000000
|
||||||
|
illum 2
|
||||||
|
map_Kd D:\\Home\\Documents\\LOTT\\Horse\\horse.png
|
|
@ -0,0 +1,561 @@
|
||||||
|
# Blender v2.79 (sub 0) OBJ File: 'horse.blend'
|
||||||
|
# www.blender.org
|
||||||
|
mtllib horse.mtl
|
||||||
|
o horse_Cube
|
||||||
|
v -0.720000 -0.000000 -0.269999
|
||||||
|
v 0.720000 -0.000000 -0.270001
|
||||||
|
v 0.720000 -0.000000 0.269999
|
||||||
|
v -0.720000 -0.000000 0.270001
|
||||||
|
v -0.720000 0.540004 -0.269999
|
||||||
|
v 0.720000 0.540004 -0.270001
|
||||||
|
v 0.720000 0.540004 0.269999
|
||||||
|
v -0.720000 0.540004 0.270001
|
||||||
|
v -0.450000 -0.360003 -0.090000
|
||||||
|
v -0.630000 -0.360003 -0.089999
|
||||||
|
v -0.630000 -0.360003 -0.269999
|
||||||
|
v -0.450000 -0.360003 -0.270000
|
||||||
|
v -0.450000 -0.000000 -0.090000
|
||||||
|
v -0.630000 -0.000000 -0.089999
|
||||||
|
v -0.630000 -0.000000 -0.269999
|
||||||
|
v -0.450000 -0.000000 -0.270000
|
||||||
|
v -0.450000 -0.000000 0.090000
|
||||||
|
v -0.630000 -0.000000 0.090001
|
||||||
|
v -0.630000 -0.000000 0.270001
|
||||||
|
v -0.450000 -0.000000 0.270000
|
||||||
|
v -0.450000 -0.360003 0.090000
|
||||||
|
v -0.630000 -0.360003 0.090001
|
||||||
|
v -0.630000 -0.360003 0.270001
|
||||||
|
v -0.450000 -0.360003 0.270000
|
||||||
|
v 0.630000 -0.360003 0.269999
|
||||||
|
v 0.450000 -0.360003 0.270000
|
||||||
|
v 0.450000 -0.360003 0.090000
|
||||||
|
v 0.630000 -0.360003 0.089999
|
||||||
|
v 0.630000 -0.000000 0.269999
|
||||||
|
v 0.450000 -0.000000 0.270000
|
||||||
|
v 0.450000 -0.000000 0.090000
|
||||||
|
v 0.630000 -0.000000 0.089999
|
||||||
|
v 0.630000 -0.000000 -0.270001
|
||||||
|
v 0.450000 -0.000000 -0.270000
|
||||||
|
v 0.450000 -0.000000 -0.090000
|
||||||
|
v 0.630000 -0.000000 -0.090001
|
||||||
|
v 0.630000 -0.360003 -0.270001
|
||||||
|
v 0.450000 -0.360003 -0.270000
|
||||||
|
v 0.450000 -0.360003 -0.090000
|
||||||
|
v 0.630000 -0.360003 -0.090001
|
||||||
|
v 1.281838 0.847285 0.161999
|
||||||
|
v 0.772721 0.338165 0.161999
|
||||||
|
v 0.772721 0.338165 -0.162001
|
||||||
|
v 1.281837 0.847285 -0.162001
|
||||||
|
v 1.027279 1.101846 0.161999
|
||||||
|
v 0.518162 0.592725 0.161999
|
||||||
|
v 0.518162 0.592725 -0.162001
|
||||||
|
v 1.027279 1.101846 -0.162001
|
||||||
|
v 1.387279 0.338165 0.179998
|
||||||
|
v 0.878163 0.847285 0.179999
|
||||||
|
v 0.878162 0.847285 -0.180001
|
||||||
|
v 1.387279 0.338165 -0.180001
|
||||||
|
v 1.641838 0.592725 0.179998
|
||||||
|
v 1.132721 1.101846 0.179999
|
||||||
|
v 1.132721 1.101846 -0.180001
|
||||||
|
v 1.641837 0.592725 -0.180002
|
||||||
|
v -0.720000 -0.270002 0.090001
|
||||||
|
v -0.900000 -0.270002 0.090001
|
||||||
|
v -0.900000 -0.270002 -0.089999
|
||||||
|
v -0.720000 -0.270002 -0.089999
|
||||||
|
v -0.720000 0.450003 0.090001
|
||||||
|
v -0.900000 0.450003 0.090001
|
||||||
|
v -0.900000 0.450003 -0.089999
|
||||||
|
v -0.720000 0.450003 -0.089999
|
||||||
|
v 1.080000 0.952728 0.134999
|
||||||
|
v 0.952721 1.080008 0.134999
|
||||||
|
v 0.952721 1.080008 0.044999
|
||||||
|
v 1.080000 0.952727 0.044999
|
||||||
|
v 1.207279 1.080008 0.134999
|
||||||
|
v 1.080000 1.207288 0.134999
|
||||||
|
v 1.080000 1.207288 0.044999
|
||||||
|
v 1.207279 1.080008 0.044999
|
||||||
|
v 1.080000 0.952728 -0.045001
|
||||||
|
v 0.952721 1.080008 -0.045001
|
||||||
|
v 0.952721 1.080008 -0.135001
|
||||||
|
v 1.080000 0.952727 -0.135001
|
||||||
|
v 1.207279 1.080008 -0.045001
|
||||||
|
v 1.080000 1.207288 -0.045001
|
||||||
|
v 1.080000 1.207288 -0.135001
|
||||||
|
v 1.207279 1.080008 -0.135001
|
||||||
|
v -0.450000 -0.720005 -0.090000
|
||||||
|
v -0.630000 -0.720005 -0.089999
|
||||||
|
v -0.630000 -0.720005 -0.269999
|
||||||
|
v -0.450000 -0.720005 -0.270000
|
||||||
|
v -0.450000 -0.360003 -0.090000
|
||||||
|
v -0.630000 -0.360003 -0.089999
|
||||||
|
v -0.630000 -0.360003 -0.269999
|
||||||
|
v -0.450000 -0.360003 -0.270000
|
||||||
|
v -0.450000 -0.360003 0.090000
|
||||||
|
v -0.630000 -0.360003 0.090001
|
||||||
|
v -0.630000 -0.360003 0.270001
|
||||||
|
v -0.450000 -0.360003 0.270000
|
||||||
|
v -0.450000 -0.720005 0.090000
|
||||||
|
v -0.630000 -0.720005 0.090001
|
||||||
|
v -0.630000 -0.720005 0.270001
|
||||||
|
v -0.450000 -0.720005 0.270000
|
||||||
|
v 0.630000 -0.720005 0.269999
|
||||||
|
v 0.450000 -0.720005 0.270000
|
||||||
|
v 0.450000 -0.720005 0.090000
|
||||||
|
v 0.630000 -0.720005 0.089999
|
||||||
|
v 0.630000 -0.360003 0.269999
|
||||||
|
v 0.450000 -0.360003 0.270000
|
||||||
|
v 0.450000 -0.360003 0.090000
|
||||||
|
v 0.630000 -0.360003 0.089999
|
||||||
|
v 0.630000 -0.360003 -0.270001
|
||||||
|
v 0.450000 -0.360003 -0.270000
|
||||||
|
v 0.450000 -0.360003 -0.090000
|
||||||
|
v 0.630000 -0.360003 -0.090001
|
||||||
|
v 0.630000 -0.720005 -0.270001
|
||||||
|
v 0.450000 -0.720005 -0.270000
|
||||||
|
v 0.450000 -0.720005 -0.090000
|
||||||
|
v 0.630000 -0.720005 -0.090001
|
||||||
|
v 0.438270 0.636914 -0.045001
|
||||||
|
v 0.438270 0.636914 0.044999
|
||||||
|
v 1.010090 1.208738 0.044999
|
||||||
|
v 1.010090 1.208738 -0.045001
|
||||||
|
v 0.501910 0.573274 -0.045001
|
||||||
|
v 0.501910 0.573274 0.044999
|
||||||
|
v 1.073730 1.145098 0.044999
|
||||||
|
v 1.073730 1.145098 -0.045001
|
||||||
|
vt -0.000001 0.750000
|
||||||
|
vt 0.999999 0.750000
|
||||||
|
vt 1.000001 1.000000
|
||||||
|
vt 0.000001 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt -0.000000 0.750000
|
||||||
|
vt 1.000000 0.750000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt -0.000000 0.750000
|
||||||
|
vt 1.000000 0.750000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.500000 0.166666
|
||||||
|
vt 0.500000 0.500000
|
||||||
|
vt 0.000000 0.500000
|
||||||
|
vt -0.000000 0.166667
|
||||||
|
vt 1.000000 0.750000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt -0.000000 1.000000
|
||||||
|
vt 0.000000 0.750000
|
||||||
|
vt 0.000001 0.500000
|
||||||
|
vt -0.000001 0.166667
|
||||||
|
vt 0.499999 0.166666
|
||||||
|
vt 0.500001 0.499999
|
||||||
|
vt 0.687500 0.750000
|
||||||
|
vt 0.687500 0.666667
|
||||||
|
vt 0.937500 0.666826
|
||||||
|
vt 0.937500 0.750159
|
||||||
|
vt 0.687500 0.750000
|
||||||
|
vt 0.687500 0.666667
|
||||||
|
vt 0.937500 0.666826
|
||||||
|
vt 0.937500 0.750159
|
||||||
|
vt 0.687500 0.750000
|
||||||
|
vt 0.687500 0.666667
|
||||||
|
vt 0.937500 0.666826
|
||||||
|
vt 0.937500 0.750159
|
||||||
|
vt 0.687500 0.750000
|
||||||
|
vt 0.687500 0.666667
|
||||||
|
vt 0.937500 0.666826
|
||||||
|
vt 0.937500 0.750159
|
||||||
|
vt 0.500000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.083333
|
||||||
|
vt 0.500000 0.083333
|
||||||
|
vt 0.500000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.083333
|
||||||
|
vt 0.500000 0.083333
|
||||||
|
vt 0.687500 0.750000
|
||||||
|
vt 0.687500 0.666667
|
||||||
|
vt 0.937500 0.666826
|
||||||
|
vt 0.937500 0.750159
|
||||||
|
vt 0.687500 0.750000
|
||||||
|
vt 0.687500 0.666667
|
||||||
|
vt 0.937500 0.666826
|
||||||
|
vt 0.937500 0.750159
|
||||||
|
vt 0.687500 0.750000
|
||||||
|
vt 0.687500 0.666667
|
||||||
|
vt 0.937500 0.666826
|
||||||
|
vt 0.937500 0.750159
|
||||||
|
vt 0.687500 0.750000
|
||||||
|
vt 0.687500 0.666667
|
||||||
|
vt 0.937500 0.666826
|
||||||
|
vt 0.937500 0.750159
|
||||||
|
vt 0.687500 0.750000
|
||||||
|
vt 0.687500 0.666667
|
||||||
|
vt 0.937500 0.666826
|
||||||
|
vt 0.937500 0.750159
|
||||||
|
vt 0.687500 0.750000
|
||||||
|
vt 0.687500 0.666667
|
||||||
|
vt 0.937500 0.666826
|
||||||
|
vt 0.937500 0.750159
|
||||||
|
vt 0.687500 0.750000
|
||||||
|
vt 0.687500 0.666667
|
||||||
|
vt 0.937500 0.666826
|
||||||
|
vt 0.937500 0.750159
|
||||||
|
vt 0.687500 0.750000
|
||||||
|
vt 0.687500 0.666667
|
||||||
|
vt 0.937500 0.666826
|
||||||
|
vt 0.937500 0.750159
|
||||||
|
vt 0.500000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.083333
|
||||||
|
vt 0.500000 0.083333
|
||||||
|
vt 0.500000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.083333
|
||||||
|
vt 0.500000 0.083333
|
||||||
|
vt 0.687500 0.750000
|
||||||
|
vt 0.687500 0.666667
|
||||||
|
vt 0.937500 0.666826
|
||||||
|
vt 0.937500 0.750159
|
||||||
|
vt 0.687500 0.750000
|
||||||
|
vt 0.687500 0.666667
|
||||||
|
vt 0.937500 0.666826
|
||||||
|
vt 0.937500 0.750159
|
||||||
|
vt 0.687500 0.750000
|
||||||
|
vt 0.687500 0.666667
|
||||||
|
vt 0.937500 0.666826
|
||||||
|
vt 0.937500 0.750159
|
||||||
|
vt 0.687500 0.750000
|
||||||
|
vt 0.687500 0.666667
|
||||||
|
vt 0.937500 0.666826
|
||||||
|
vt 0.937500 0.750159
|
||||||
|
vt 0.500000 0.666666
|
||||||
|
vt 0.000000 0.666667
|
||||||
|
vt -0.000000 0.500000
|
||||||
|
vt 0.500000 0.500000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.250000 0.000000
|
||||||
|
vt 0.250000 0.166667
|
||||||
|
vt 0.000000 0.166667
|
||||||
|
vt 0.000000 0.500000
|
||||||
|
vt 0.500000 0.500000
|
||||||
|
vt 0.500000 0.666667
|
||||||
|
vt 0.000000 0.666667
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.250000 0.000000
|
||||||
|
vt 0.250000 0.166667
|
||||||
|
vt 0.000000 0.166667
|
||||||
|
vt 0.500000 0.666666
|
||||||
|
vt 0.000000 0.666667
|
||||||
|
vt -0.000000 0.500000
|
||||||
|
vt 0.500000 0.500000
|
||||||
|
vt 0.500000 0.666666
|
||||||
|
vt 0.000000 0.666667
|
||||||
|
vt -0.000000 0.500000
|
||||||
|
vt 0.500000 0.500000
|
||||||
|
vt 1.000000 0.500000
|
||||||
|
vt 0.500000 0.500000
|
||||||
|
vt 0.500000 0.333334
|
||||||
|
vt 1.000000 0.333333
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.250000 0.000000
|
||||||
|
vt 0.250000 0.166667
|
||||||
|
vt 0.000000 0.166667
|
||||||
|
vt 0.500000 0.500000
|
||||||
|
vt 1.000000 0.500000
|
||||||
|
vt 1.000000 0.333333
|
||||||
|
vt 0.500000 0.333333
|
||||||
|
vt 0.250000 0.000000
|
||||||
|
vt 0.500000 0.000000
|
||||||
|
vt 0.500000 0.166667
|
||||||
|
vt 0.250000 0.166667
|
||||||
|
vt 0.500000 0.166667
|
||||||
|
vt 1.000000 0.166666
|
||||||
|
vt 1.000000 0.666666
|
||||||
|
vt 0.500000 0.666667
|
||||||
|
vt 0.000000 0.750000
|
||||||
|
vt -0.000000 0.666667
|
||||||
|
vt 0.500000 0.666666
|
||||||
|
vt 0.500000 0.750000
|
||||||
|
vt 0.000000 0.750000
|
||||||
|
vt -0.000000 0.666667
|
||||||
|
vt 0.500000 0.666666
|
||||||
|
vt 0.500000 0.750000
|
||||||
|
vt 0.000000 0.750000
|
||||||
|
vt -0.000000 0.666667
|
||||||
|
vt 0.500000 0.666666
|
||||||
|
vt 0.500000 0.750000
|
||||||
|
vt 0.000000 0.750000
|
||||||
|
vt -0.000000 0.666667
|
||||||
|
vt 0.500000 0.666666
|
||||||
|
vt 0.500000 0.750000
|
||||||
|
vt 0.000000 0.666667
|
||||||
|
vt 0.125000 0.666667
|
||||||
|
vt 0.125000 0.750000
|
||||||
|
vt 0.000000 0.750000
|
||||||
|
vt 0.500000 0.083333
|
||||||
|
vt 0.625000 0.083333
|
||||||
|
vt 0.625000 0.166667
|
||||||
|
vt 0.500000 0.166667
|
||||||
|
vt 0.937500 0.750000
|
||||||
|
vt 0.937500 0.666667
|
||||||
|
vt 1.000000 0.666667
|
||||||
|
vt 1.000000 0.750000
|
||||||
|
vt 0.500000 0.083333
|
||||||
|
vt 0.625000 0.083333
|
||||||
|
vt 0.625000 0.166667
|
||||||
|
vt 0.500000 0.166667
|
||||||
|
vt 0.937500 0.750000
|
||||||
|
vt 0.937500 0.666667
|
||||||
|
vt 1.000000 0.666667
|
||||||
|
vt 1.000000 0.750000
|
||||||
|
vt 0.937500 0.750000
|
||||||
|
vt 0.937500 0.666667
|
||||||
|
vt 1.000000 0.666667
|
||||||
|
vt 1.000000 0.750000
|
||||||
|
vt 0.500000 0.083333
|
||||||
|
vt 0.625000 0.083333
|
||||||
|
vt 0.625000 0.166667
|
||||||
|
vt 0.500000 0.166667
|
||||||
|
vt 0.937500 0.750000
|
||||||
|
vt 0.937500 0.666667
|
||||||
|
vt 1.000000 0.666667
|
||||||
|
vt 1.000000 0.750000
|
||||||
|
vt 0.500000 0.083333
|
||||||
|
vt 0.625000 0.083333
|
||||||
|
vt 0.625000 0.166667
|
||||||
|
vt 0.500000 0.166667
|
||||||
|
vt 0.937500 0.750000
|
||||||
|
vt 0.937500 0.666667
|
||||||
|
vt 1.000000 0.666667
|
||||||
|
vt 1.000000 0.750000
|
||||||
|
vt 0.937500 0.750000
|
||||||
|
vt 0.937500 0.666667
|
||||||
|
vt 1.000000 0.666667
|
||||||
|
vt 1.000000 0.750000
|
||||||
|
vt 0.875000 0.666799
|
||||||
|
vt 0.875000 0.750132
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.625000 0.666667
|
||||||
|
vt 0.875000 0.666799
|
||||||
|
vt 0.875000 0.750132
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.625000 0.666667
|
||||||
|
vt 0.875000 0.666799
|
||||||
|
vt 0.875000 0.750132
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.625000 0.666667
|
||||||
|
vt 0.875000 0.666799
|
||||||
|
vt 0.875000 0.750132
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.625000 0.666667
|
||||||
|
vt 0.500000 0.666667
|
||||||
|
vt 0.500000 0.750000
|
||||||
|
vt 0.500000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.083333
|
||||||
|
vt 0.500000 0.083333
|
||||||
|
vt 0.500000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.083333
|
||||||
|
vt 0.500000 0.083333
|
||||||
|
vt 0.500000 0.666667
|
||||||
|
vt 0.625000 0.666667
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.500000 0.750000
|
||||||
|
vt 0.875000 0.666799
|
||||||
|
vt 0.875000 0.750132
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.625000 0.666667
|
||||||
|
vt 0.875000 0.666799
|
||||||
|
vt 0.875000 0.750132
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.625000 0.666667
|
||||||
|
vt 0.875000 0.666799
|
||||||
|
vt 0.875000 0.750132
|
||||||
|
vt 0.875000 0.666799
|
||||||
|
vt 0.875000 0.750132
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.625000 0.666667
|
||||||
|
vt 0.875000 0.666799
|
||||||
|
vt 0.875000 0.750132
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.625000 0.666667
|
||||||
|
vt 0.875000 0.666799
|
||||||
|
vt 0.875000 0.750132
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.625000 0.666667
|
||||||
|
vt 0.875000 0.666799
|
||||||
|
vt 0.875000 0.750132
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.625000 0.666667
|
||||||
|
vt 0.875000 0.666799
|
||||||
|
vt 0.875000 0.750132
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.625000 0.666667
|
||||||
|
vt 0.500000 0.666667
|
||||||
|
vt 0.500000 0.750000
|
||||||
|
vt 0.500000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.083333
|
||||||
|
vt 0.500000 0.083333
|
||||||
|
vt 0.500000 0.000000
|
||||||
|
vt 0.625000 0.000000
|
||||||
|
vt 0.625000 0.083333
|
||||||
|
vt 0.500000 0.083333
|
||||||
|
vt 0.500000 0.666667
|
||||||
|
vt 0.625000 0.666667
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.500000 0.750000
|
||||||
|
vt 0.875000 0.666799
|
||||||
|
vt 0.875000 0.750132
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.625000 0.666667
|
||||||
|
vt 0.875000 0.666799
|
||||||
|
vt 0.875000 0.750132
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.625000 0.666667
|
||||||
|
vt 0.875000 0.666799
|
||||||
|
vt 0.875000 0.750132
|
||||||
|
vt 0.875000 0.666799
|
||||||
|
vt 0.875000 0.750132
|
||||||
|
vt 0.625000 0.750000
|
||||||
|
vt 0.625000 0.666667
|
||||||
|
vt 0.625000 0.166667
|
||||||
|
vt 0.625000 0.125000
|
||||||
|
vt 0.906250 0.125000
|
||||||
|
vt 0.906250 0.166667
|
||||||
|
vt 0.937500 0.125000
|
||||||
|
vt 1.000000 0.125000
|
||||||
|
vt 1.000000 0.166667
|
||||||
|
vt 0.937500 0.166667
|
||||||
|
vt 0.625000 0.166667
|
||||||
|
vt 0.625000 0.125000
|
||||||
|
vt 0.906250 0.166667
|
||||||
|
vt 0.625000 0.166667
|
||||||
|
vt 0.906250 0.125000
|
||||||
|
vt 0.906250 0.166667
|
||||||
|
vt 0.625000 0.125000
|
||||||
|
vt 0.906250 0.125000
|
||||||
|
vt 0.937500 0.125000
|
||||||
|
vt 1.000000 0.125000
|
||||||
|
vt 1.000000 0.166667
|
||||||
|
vt 0.937500 0.166667
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.125000 0.666667
|
||||||
|
vt 0.125000 0.750000
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
vn -0.0000 0.0000 -1.0000
|
||||||
|
vn 1.0000 -0.0000 -0.0000
|
||||||
|
vn 0.0000 -0.0000 1.0000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn -0.7071 -0.7071 0.0000
|
||||||
|
vn 0.7071 0.7071 -0.0000
|
||||||
|
vn 0.7071 -0.7071 -0.0000
|
||||||
|
vn -0.7071 0.7071 0.0000
|
||||||
|
usemtl horse
|
||||||
|
s off
|
||||||
|
f 1/1/1 2/2/1 3/3/1 4/4/1
|
||||||
|
f 5/5/2 8/6/2 7/7/2 6/8/2
|
||||||
|
f 1/9/3 5/10/3 6/11/3 2/12/3
|
||||||
|
f 2/13/4 6/14/4 7/15/4 3/16/4
|
||||||
|
f 3/17/5 7/18/5 8/19/5 4/20/5
|
||||||
|
f 5/21/6 1/22/6 4/23/6 8/24/6
|
||||||
|
f 13/25/5 14/26/5 10/27/5 9/28/5
|
||||||
|
f 14/29/6 15/30/6 11/31/6 10/32/6
|
||||||
|
f 15/33/3 16/34/3 12/35/3 11/36/3
|
||||||
|
f 16/37/4 13/38/4 9/39/4 12/40/4
|
||||||
|
f 9/41/1 10/42/1 11/43/1 12/44/1
|
||||||
|
f 24/45/1 23/46/1 22/47/1 21/48/1
|
||||||
|
f 17/49/4 20/50/4 24/51/4 21/52/4
|
||||||
|
f 18/53/3 17/54/3 21/55/3 22/56/3
|
||||||
|
f 19/57/6 18/58/6 22/59/6 23/60/6
|
||||||
|
f 20/61/5 19/62/5 23/63/5 24/64/5
|
||||||
|
f 29/65/5 30/66/5 26/67/5 25/68/5
|
||||||
|
f 30/69/6 31/70/6 27/71/6 26/72/6
|
||||||
|
f 31/73/3 32/74/3 28/75/3 27/76/3
|
||||||
|
f 32/77/4 29/78/4 25/79/4 28/80/4
|
||||||
|
f 25/81/1 26/82/1 27/83/1 28/84/1
|
||||||
|
f 40/85/1 39/86/1 38/87/1 37/88/1
|
||||||
|
f 33/89/4 36/90/4 40/91/4 37/92/4
|
||||||
|
f 34/93/3 33/94/3 37/95/3 38/96/3
|
||||||
|
f 35/97/6 34/98/6 38/99/6 39/100/6
|
||||||
|
f 36/101/5 35/102/5 39/103/5 40/104/5
|
||||||
|
f 45/105/5 46/106/5 42/107/5 41/108/5
|
||||||
|
f 46/109/7 47/110/7 43/111/7 42/112/7
|
||||||
|
f 47/113/3 48/114/3 44/115/3 43/116/3
|
||||||
|
f 48/117/8 45/118/8 41/119/8 44/120/8
|
||||||
|
f 41/121/9 42/122/9 43/123/9 44/124/9
|
||||||
|
f 48/125/10 47/126/10 46/127/10 45/128/10
|
||||||
|
f 53/129/5 54/130/5 50/131/5 49/132/5
|
||||||
|
f 54/133/10 55/134/10 51/135/10 50/136/10
|
||||||
|
f 55/137/3 56/138/3 52/139/3 51/140/3
|
||||||
|
f 56/141/9 53/142/9 49/143/9 52/144/9
|
||||||
|
f 49/132/7 50/131/7 51/145/7 52/146/7
|
||||||
|
f 56/147/8 55/148/8 54/130/8 53/129/8
|
||||||
|
f 61/149/5 62/150/5 58/151/5 57/152/5
|
||||||
|
f 62/153/6 63/154/6 59/155/6 58/156/6
|
||||||
|
f 63/157/3 64/158/3 60/159/3 59/160/3
|
||||||
|
f 64/161/4 61/162/4 57/163/4 60/164/4
|
||||||
|
f 57/165/1 58/166/1 59/167/1 60/168/1
|
||||||
|
f 69/169/5 70/170/5 66/171/5 65/172/5
|
||||||
|
f 70/173/10 71/174/10 67/175/10 66/176/10
|
||||||
|
f 71/177/3 72/178/3 68/179/3 67/180/3
|
||||||
|
f 72/181/9 69/182/9 65/183/9 68/184/9
|
||||||
|
f 65/185/7 66/186/7 67/175/7 68/184/7
|
||||||
|
f 72/181/8 71/174/8 70/187/8 69/188/8
|
||||||
|
f 77/189/5 78/190/5 74/191/5 73/192/5
|
||||||
|
f 78/193/10 79/194/10 75/195/10 74/196/10
|
||||||
|
f 79/197/3 80/198/3 76/199/3 75/200/3
|
||||||
|
f 80/201/9 77/202/9 73/203/9 76/204/9
|
||||||
|
f 73/205/7 74/206/7 75/195/7 76/204/7
|
||||||
|
f 80/201/8 79/194/8 78/207/8 77/208/8
|
||||||
|
f 85/209/5 86/210/5 82/211/5 81/212/5
|
||||||
|
f 86/213/6 87/214/6 83/215/6 82/216/6
|
||||||
|
f 87/217/3 88/218/3 84/219/3 83/220/3
|
||||||
|
f 88/221/4 85/222/4 81/223/4 84/224/4
|
||||||
|
f 81/225/1 82/216/1 83/215/1 84/226/1
|
||||||
|
f 88/227/2 87/228/2 86/229/2 85/230/2
|
||||||
|
f 89/231/2 90/232/2 91/233/2 92/234/2
|
||||||
|
f 96/235/1 95/236/1 94/237/1 93/238/1
|
||||||
|
f 89/239/4 92/240/4 96/241/4 93/242/4
|
||||||
|
f 90/243/3 89/244/3 93/245/3 94/246/3
|
||||||
|
f 91/247/6 90/248/6 94/237/6 95/236/6
|
||||||
|
f 92/249/5 91/250/5 95/251/5 96/252/5
|
||||||
|
f 101/253/5 102/254/5 98/255/5 97/256/5
|
||||||
|
f 102/257/6 103/258/6 99/259/6 98/260/6
|
||||||
|
f 103/261/3 104/262/3 100/263/3 99/264/3
|
||||||
|
f 104/265/4 101/266/4 97/267/4 100/268/4
|
||||||
|
f 97/269/1 98/260/1 99/259/1 100/270/1
|
||||||
|
f 104/271/2 103/272/2 102/273/2 101/274/2
|
||||||
|
f 105/275/2 106/276/2 107/277/2 108/278/2
|
||||||
|
f 112/279/1 111/280/1 110/281/1 109/282/1
|
||||||
|
f 105/283/4 108/284/4 112/285/4 109/286/4
|
||||||
|
f 106/287/3 105/288/3 109/289/3 110/290/3
|
||||||
|
f 107/291/6 106/292/6 110/281/6 111/280/6
|
||||||
|
f 108/293/5 107/294/5 111/295/5 112/296/5
|
||||||
|
f 120/297/9 119/298/9 118/299/9 117/300/9
|
||||||
|
f 114/301/7 113/302/7 117/303/7 118/304/7
|
||||||
|
f 115/305/5 114/306/5 118/299/5 119/307/5
|
||||||
|
f 113/308/10 114/306/10 115/309/10 116/310/10
|
||||||
|
f 113/308/3 116/311/3 120/312/3 117/300/3
|
||||||
|
f 116/313/8 115/314/8 119/315/8 120/316/8
|
||||||
|
usemtl horse_NONE
|
||||||
|
f 16/317/2 15/318/2 14/319/2 13/320/2
|
||||||
|
f 17/321/2 18/322/2 19/323/2 20/324/2
|
||||||
|
f 32/325/2 31/326/2 30/327/2 29/328/2
|
||||||
|
f 33/329/2 34/330/2 35/331/2 36/332/2
|
||||||
|
f 64/158/2 63/333/2 62/334/2 61/149/2
|
After Width: | Height: | Size: 795 B |
After Width: | Height: | Size: 358 B |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 606 B |
After Width: | Height: | Size: 442 B |
After Width: | Height: | Size: 522 B |
|
@ -32,13 +32,6 @@ minetest.register_chatcommand("update", {
|
||||||
Battleground(i,player)
|
Battleground(i,player)
|
||||||
end
|
end
|
||||||
|
|
||||||
file = io.open(minetest.get_worldpath().."/SAVE/Bridge.txt", "r")
|
|
||||||
local level = file:read("*l")
|
|
||||||
file:close()
|
|
||||||
for i=1,tonumber(level) do
|
|
||||||
Bridge(i,player)
|
|
||||||
end
|
|
||||||
|
|
||||||
file = io.open(minetest.get_worldpath().."/SAVE/Camp1.txt", "r")
|
file = io.open(minetest.get_worldpath().."/SAVE/Camp1.txt", "r")
|
||||||
local level = file:read("*l")
|
local level = file:read("*l")
|
||||||
file:close()
|
file:close()
|
||||||
|
@ -234,5 +227,60 @@ minetest.register_chatcommand("update", {
|
||||||
if tonumber(level) > 0 then
|
if tonumber(level) > 0 then
|
||||||
Update_knight(player)
|
Update_knight(player)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Camp2.txt", "r")
|
||||||
|
local level = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
for i=1,tonumber(level) do
|
||||||
|
Camp2(i,player)
|
||||||
|
end
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Cactusfarm.txt", "r")
|
||||||
|
local level = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
for i=1,tonumber(level) do
|
||||||
|
Cactusfarm(i,player)
|
||||||
|
end
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Island_Smithy.txt", "r")
|
||||||
|
local level = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
for i=1,tonumber(level) do
|
||||||
|
Island_Smithy(i,player)
|
||||||
|
end
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Lake2.txt", "r")
|
||||||
|
local level = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
for i=1,tonumber(level) do
|
||||||
|
Lake2(i,player)
|
||||||
|
end
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Bridge.txt", "r")
|
||||||
|
local level = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
for i=1,tonumber(level) do
|
||||||
|
Bridge(i,player)
|
||||||
|
end
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Stable.txt", "r")
|
||||||
|
local level = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
for i=1,tonumber(level) do
|
||||||
|
Stable(i,player)
|
||||||
|
end
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Mountain_Quarry.txt", "r")
|
||||||
|
local level = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
for i=1,tonumber(level) do
|
||||||
|
Mountain_Quarry(i,player)
|
||||||
|
end
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Mountain_Fountain.txt", "r")
|
||||||
|
local level = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
for i=1,tonumber(level) do
|
||||||
|
Mountain_Fountain(i,player)
|
||||||
|
end
|
||||||
|
file = io.open(minetest.get_worldpath().."/SAVE/Island_Home1.txt", "r")
|
||||||
|
local level = file:read("*l")
|
||||||
|
file:close()
|
||||||
|
for i=1,tonumber(level) do
|
||||||
|
Island_Home1(i,player)
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
|
@ -40,16 +40,16 @@ end
|
||||||
|
|
||||||
-- Unlimited node placement
|
-- Unlimited node placement
|
||||||
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
|
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
|
||||||
return creative.is_enabled_for(placer:get_player_name())
|
if placer and placer:is_player() then
|
||||||
|
return creative.is_enabled_for(placer:get_player_name())
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Don't pick up if the item is already in the inventory
|
-- Don't pick up if the item is already in the inventory
|
||||||
local old_handle_node_drops = minetest.handle_node_drops
|
local old_handle_node_drops = minetest.handle_node_drops
|
||||||
function minetest.handle_node_drops(pos, drops, digger)
|
function minetest.handle_node_drops(pos, drops, digger)
|
||||||
if not digger or not digger:is_player() then
|
if not digger or not digger:is_player() or
|
||||||
return
|
not creative.is_enabled_for(digger:get_player_name()) then
|
||||||
end
|
|
||||||
if not creative.is_enabled_for(digger:get_player_name()) then
|
|
||||||
return old_handle_node_drops(pos, drops, digger)
|
return old_handle_node_drops(pos, drops, digger)
|
||||||
end
|
end
|
||||||
local inv = digger:get_inventory()
|
local inv = digger:get_inventory()
|
||||||
|
|
|
@ -1,4 +1,19 @@
|
||||||
local player_inventory = {}
|
local player_inventory = {}
|
||||||
|
local inventory_cache = {}
|
||||||
|
|
||||||
|
local function init_creative_cache(items)
|
||||||
|
inventory_cache[items] = {}
|
||||||
|
local i_cache = inventory_cache[items]
|
||||||
|
|
||||||
|
for name, def in pairs(items) do
|
||||||
|
if def.groups.not_in_creative_inventory ~= 1 and
|
||||||
|
def.description and def.description ~= "" then
|
||||||
|
i_cache[name] = def
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort(i_cache)
|
||||||
|
return i_cache
|
||||||
|
end
|
||||||
|
|
||||||
function creative.init_creative_inventory(player)
|
function creative.init_creative_inventory(player)
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
|
@ -10,22 +25,25 @@ function creative.init_creative_inventory(player)
|
||||||
|
|
||||||
minetest.create_detached_inventory("creative_" .. player_name, {
|
minetest.create_detached_inventory("creative_" .. player_name, {
|
||||||
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player2)
|
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player2)
|
||||||
if not to_list == "main" then
|
local name = player2 and player2:get_player_name() or ""
|
||||||
return count
|
if not creative.is_enabled_for(name) or
|
||||||
else
|
to_list == "main" then
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
return count
|
||||||
end,
|
end,
|
||||||
allow_put = function(inv, listname, index, stack, player2)
|
allow_put = function(inv, listname, index, stack, player2)
|
||||||
return 0
|
return 0
|
||||||
end,
|
end,
|
||||||
allow_take = function(inv, listname, index, stack, player2)
|
allow_take = function(inv, listname, index, stack, player2)
|
||||||
|
local name = player2 and player2:get_player_name() or ""
|
||||||
|
if not creative.is_enabled_for(name) then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
return -1
|
return -1
|
||||||
end,
|
end,
|
||||||
on_move = function(inv, from_list, from_index, to_list, to_index, count, player2)
|
on_move = function(inv, from_list, from_index, to_list, to_index, count, player2)
|
||||||
end,
|
end,
|
||||||
on_put = function(inv, listname, index, stack, player2)
|
|
||||||
end,
|
|
||||||
on_take = function(inv, listname, index, stack, player2)
|
on_take = function(inv, listname, index, stack, player2)
|
||||||
if stack and stack:get_count() > 0 then
|
if stack and stack:get_count() > 0 then
|
||||||
minetest.log("action", player_name .. " takes " .. stack:get_name().. " from creative inventory")
|
minetest.log("action", player_name .. " takes " .. stack:get_name().. " from creative inventory")
|
||||||
|
@ -42,11 +60,11 @@ function creative.update_creative_inventory(player_name, tab_content)
|
||||||
creative.init_creative_inventory(minetest.get_player_by_name(player_name))
|
creative.init_creative_inventory(minetest.get_player_by_name(player_name))
|
||||||
local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name})
|
local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name})
|
||||||
|
|
||||||
for name, def in pairs(tab_content) do
|
local items = inventory_cache[tab_content] or init_creative_cache(tab_content)
|
||||||
if not (def.groups.not_in_creative_inventory == 1) and
|
|
||||||
def.description and def.description ~= "" and
|
for name, def in pairs(items) do
|
||||||
(def.name:find(inv.filter, 1, true) or
|
if def.name:find(inv.filter, 1, true) or
|
||||||
def.description:lower():find(inv.filter, 1, true)) then
|
def.description:lower():find(inv.filter, 1, true) then
|
||||||
creative_list[#creative_list+1] = name
|
creative_list[#creative_list+1] = name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -100,6 +118,8 @@ function creative.register_tab(name, title, items)
|
||||||
button[2.75,3.4;0.8,0.5;creative_clear;X]
|
button[2.75,3.4;0.8,0.5;creative_clear;X]
|
||||||
tooltip[creative_search;Search]
|
tooltip[creative_search;Search]
|
||||||
tooltip[creative_clear;Reset]
|
tooltip[creative_clear;Reset]
|
||||||
|
tooltip[creative_prev;Previous page]
|
||||||
|
tooltip[creative_next;Next page]
|
||||||
listring[current_player;main]
|
listring[current_player;main]
|
||||||
field_close_on_enter[creative_filter;false]
|
field_close_on_enter[creative_filter;false]
|
||||||
]] ..
|
]] ..
|
||||||
|
@ -158,10 +178,6 @@ function creative.register_tab(name, title, items)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
|
||||||
creative.update_creative_inventory(player:get_player_name(), minetest.registered_items)
|
|
||||||
end)
|
|
||||||
|
|
||||||
creative.register_tab("all", "All", minetest.registered_items)
|
creative.register_tab("all", "All", minetest.registered_items)
|
||||||
creative.register_tab("nodes", "Nodes", minetest.registered_nodes)
|
creative.register_tab("nodes", "Nodes", minetest.registered_nodes)
|
||||||
creative.register_tab("tools", "Tools", minetest.registered_tools)
|
creative.register_tab("tools", "Tools", minetest.registered_tools)
|
||||||
|
|
|
@ -119,6 +119,7 @@ paramat (CC BY-SA 3.0):
|
||||||
default_silver_sandstone.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
|
default_silver_sandstone.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
|
||||||
default_silver_sandstone_brick.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
|
default_silver_sandstone_brick.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
|
||||||
default_silver_sandstone_block.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
|
default_silver_sandstone_block.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
|
||||||
|
default_bookshelf_slot.png -- Derived from a texture by Gambit (CC-BY-SA 3.0)
|
||||||
|
|
||||||
brunob.santos (CC BY-SA 4.0):
|
brunob.santos (CC BY-SA 4.0):
|
||||||
default_desert_cobble.png
|
default_desert_cobble.png
|
||||||
|
@ -131,7 +132,6 @@ BlockMen (CC BY-SA 3.0):
|
||||||
default_gold_ingot.png
|
default_gold_ingot.png
|
||||||
default_tool_steelsword.png
|
default_tool_steelsword.png
|
||||||
default_diamond.png
|
default_diamond.png
|
||||||
default_book.png
|
|
||||||
default_tool_*.png
|
default_tool_*.png
|
||||||
default_lava_source_animated.png
|
default_lava_source_animated.png
|
||||||
default_lava_flowing_animated.png
|
default_lava_flowing_animated.png
|
||||||
|
@ -145,11 +145,7 @@ BlockMen (CC BY-SA 3.0):
|
||||||
bubble.png
|
bubble.png
|
||||||
gui_*.png
|
gui_*.png
|
||||||
|
|
||||||
Wuzzy (CC BY-SA 3.0):
|
|
||||||
default_bookshelf_slot.png (based on default_book.png)
|
|
||||||
|
|
||||||
sofar (CC BY-SA 3.0):
|
sofar (CC BY-SA 3.0):
|
||||||
default_book_written.png, based on default_book.png
|
|
||||||
default_aspen_sapling
|
default_aspen_sapling
|
||||||
default_aspen_tree
|
default_aspen_tree
|
||||||
default_aspen_tree_top, derived from default_pine_tree_top (by paramat)
|
default_aspen_tree_top, derived from default_pine_tree_top (by paramat)
|
||||||
|
@ -186,6 +182,7 @@ Gambit (CC BY-SA 3.0):
|
||||||
default_snowball.png
|
default_snowball.png
|
||||||
default_key.png
|
default_key.png
|
||||||
default_key_skeleton.png
|
default_key_skeleton.png
|
||||||
|
default_book.png
|
||||||
|
|
||||||
asl97 (CC BY-SA 3.0):
|
asl97 (CC BY-SA 3.0):
|
||||||
default_ice.png
|
default_ice.png
|
||||||
|
@ -221,6 +218,9 @@ kilbith (CC BY-SA 3.0):
|
||||||
default_tin_ingot.png
|
default_tin_ingot.png
|
||||||
default_tin_lump.png
|
default_tin_lump.png
|
||||||
|
|
||||||
|
CloudyProton (CC BY-SA 3.0):
|
||||||
|
default_book_written.png, based on default_book.png by Gambit
|
||||||
|
|
||||||
Glass breaking sounds (CC BY 3.0):
|
Glass breaking sounds (CC BY 3.0):
|
||||||
1: http://www.freesound.org/people/cmusounddesign/sounds/71947/
|
1: http://www.freesound.org/people/cmusounddesign/sounds/71947/
|
||||||
2: http://www.freesound.org/people/Tomlija/sounds/97669/
|
2: http://www.freesound.org/people/Tomlija/sounds/97669/
|
||||||
|
|
|
@ -190,6 +190,9 @@ minetest.register_craft({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Axes
|
||||||
|
-- Recipes face left to match appearence in textures and inventory
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'default:axe_wood',
|
output = 'default:axe_wood',
|
||||||
recipe = {
|
recipe = {
|
||||||
|
@ -244,60 +247,6 @@ minetest.register_craft({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'default:axe_wood',
|
|
||||||
recipe = {
|
|
||||||
{'group:wood', 'group:wood'},
|
|
||||||
{'group:stick', 'group:wood'},
|
|
||||||
{'group:stick',''},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'default:axe_stone',
|
|
||||||
recipe = {
|
|
||||||
{'group:stone', 'group:stone'},
|
|
||||||
{'group:stick', 'group:stone'},
|
|
||||||
{'group:stick', ''},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'default:axe_steel',
|
|
||||||
recipe = {
|
|
||||||
{'default:steel_ingot', 'default:steel_ingot'},
|
|
||||||
{'group:stick', 'default:steel_ingot'},
|
|
||||||
{'group:stick', ''},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'default:axe_bronze',
|
|
||||||
recipe = {
|
|
||||||
{'default:bronze_ingot', 'default:bronze_ingot'},
|
|
||||||
{'group:stick', 'default:bronze_ingot'},
|
|
||||||
{'group:stick', ''},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'default:axe_mese',
|
|
||||||
recipe = {
|
|
||||||
{'default:mese_crystal', 'default:mese_crystal'},
|
|
||||||
{'group:stick', 'default:mese_crystal'},
|
|
||||||
{'group:stick', ''},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'default:axe_diamond',
|
|
||||||
recipe = {
|
|
||||||
{'default:diamond', 'default:diamond'},
|
|
||||||
{'group:stick', 'default:diamond'},
|
|
||||||
{'group:stick', ''},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'default:sword_wood',
|
output = 'default:sword_wood',
|
||||||
recipe = {
|
recipe = {
|
||||||
|
@ -904,7 +853,7 @@ minetest.register_craft({
|
||||||
-- Fuels
|
-- Fuels
|
||||||
--
|
--
|
||||||
|
|
||||||
-- Support use of group:tree
|
-- Support use of group:tree, includes default:tree which has the same burn time
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "group:tree",
|
recipe = "group:tree",
|
||||||
|
@ -927,12 +876,6 @@ minetest.register_craft({
|
||||||
burntime = 26,
|
burntime = 26,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "fuel",
|
|
||||||
recipe = "default:tree",
|
|
||||||
burntime = 30,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "default:acacia_tree",
|
recipe = "default:acacia_tree",
|
||||||
|
@ -946,7 +889,7 @@ minetest.register_craft({
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- Support use of group:wood
|
-- Support use of group:wood, includes default:wood which has the same burn time
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "group:wood",
|
recipe = "group:wood",
|
||||||
|
@ -965,12 +908,6 @@ minetest.register_craft({
|
||||||
burntime = 6,
|
burntime = 6,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "fuel",
|
|
||||||
recipe = "default:wood",
|
|
||||||
burntime = 7,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "default:acacia_wood",
|
recipe = "default:acacia_wood",
|
||||||
|
@ -984,53 +921,47 @@ minetest.register_craft({
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- Support use of group:sapling
|
-- Support use of group:sapling, includes default:sapling which has the same burn time
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "group:sapling",
|
recipe = "group:sapling",
|
||||||
burntime = 10,
|
burntime = 5,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "default:bush_sapling",
|
recipe = "default:bush_sapling",
|
||||||
burntime = 6,
|
burntime = 3,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "default:acacia_bush_sapling",
|
recipe = "default:acacia_bush_sapling",
|
||||||
burntime = 7,
|
burntime = 4,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "default:aspen_sapling",
|
recipe = "default:aspen_sapling",
|
||||||
burntime = 8,
|
burntime = 4,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "default:pine_sapling",
|
recipe = "default:pine_sapling",
|
||||||
burntime = 9,
|
burntime = 5,
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "fuel",
|
|
||||||
recipe = "default:sapling",
|
|
||||||
burntime = 10,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "default:acacia_sapling",
|
recipe = "default:acacia_sapling",
|
||||||
burntime = 11,
|
burntime = 6,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "default:junglesapling",
|
recipe = "default:junglesapling",
|
||||||
burntime = 12,
|
burntime = 6,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -1080,13 +1011,13 @@ minetest.register_craft({
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "default:junglegrass",
|
recipe = "default:junglegrass",
|
||||||
burntime = 2,
|
burntime = 3,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "group:leaves",
|
recipe = "group:leaves",
|
||||||
burntime = 1,
|
burntime = 4,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
@ -1098,7 +1029,7 @@ minetest.register_craft({
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "default:papyrus",
|
recipe = "default:papyrus",
|
||||||
burntime = 1,
|
burntime = 3,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
@ -1110,7 +1041,7 @@ minetest.register_craft({
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "default:ladder_wood",
|
recipe = "default:ladder_wood",
|
||||||
burntime = 2,
|
burntime = 7,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
@ -1143,12 +1074,6 @@ minetest.register_craft({
|
||||||
burntime = 30,
|
burntime = 30,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "fuel",
|
|
||||||
recipe = "default:apple",
|
|
||||||
burntime = 3,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "default:coal_lump",
|
recipe = "default:coal_lump",
|
||||||
|
|
|
@ -75,12 +75,16 @@ local function book_on_use(itemstack, user)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local max_text_size = 10000
|
||||||
|
local max_title_size = 80
|
||||||
|
local short_title_size = 35
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if formname ~= "default:book" then return end
|
if formname ~= "default:book" then return end
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
local stack = player:get_wielded_item()
|
local stack = player:get_wielded_item()
|
||||||
|
|
||||||
if fields.save and fields.title ~= "" and fields.text ~= "" then
|
if fields.save and fields.title and fields.text
|
||||||
|
and fields.title ~= "" and fields.text ~= "" then
|
||||||
local new_stack, data
|
local new_stack, data
|
||||||
if stack:get_name() ~= "default:book_written" then
|
if stack:get_name() ~= "default:book_written" then
|
||||||
local count = stack:get_count()
|
local count = stack:get_count()
|
||||||
|
@ -99,11 +103,16 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not data then data = {} end
|
if not data then data = {} end
|
||||||
data.title = fields.title
|
data.title = fields.title:sub(1, max_title_size)
|
||||||
data.owner = player:get_player_name()
|
data.owner = player:get_player_name()
|
||||||
data.description = "\""..fields.title.."\" by "..data.owner
|
local short_title = data.title
|
||||||
data.text = fields.text
|
-- Don't bother triming the title if the trailing dots would make it longer
|
||||||
data.text_len = #data.text
|
if #short_title > short_title_size + 3 then
|
||||||
|
short_title = short_title:sub(1, short_title_size) .. "..."
|
||||||
|
end
|
||||||
|
data.description = "\""..short_title.."\" by "..data.owner
|
||||||
|
data.text = fields.text:sub(1, max_text_size)
|
||||||
|
data.text = data.text:gsub("\r\n", "\n"):gsub("\r", "\n")
|
||||||
data.page = 1
|
data.page = 1
|
||||||
data.page_max = math.ceil((#data.text:gsub("[^\n]", "") + 1) / lpp)
|
data.page_max = math.ceil((#data.text:gsub("[^\n]", "") + 1) / lpp)
|
||||||
|
|
||||||
|
|
|
@ -136,10 +136,12 @@ if minetest.settings:get_bool("enable_lavacooling") ~= false then
|
||||||
label = "Lava cooling",
|
label = "Lava cooling",
|
||||||
nodenames = {"default:lava_source", "default:lava_flowing"},
|
nodenames = {"default:lava_source", "default:lava_flowing"},
|
||||||
neighbors = {"group:cools_lava", "group:water"},
|
neighbors = {"group:cools_lava", "group:water"},
|
||||||
interval = 1,
|
interval = 2,
|
||||||
chance = 2,
|
chance = 2,
|
||||||
catch_up = false,
|
catch_up = false,
|
||||||
action = default.cool_lava,
|
action = function(...)
|
||||||
|
default.cool_lava(...)
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -222,7 +224,9 @@ minetest.register_abm({
|
||||||
neighbors = {"group:sand"},
|
neighbors = {"group:sand"},
|
||||||
interval = 12,
|
interval = 12,
|
||||||
chance = 83,
|
chance = 83,
|
||||||
action = default.grow_cactus
|
action = function(...)
|
||||||
|
default.grow_cactus(...)
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
|
@ -231,7 +235,9 @@ minetest.register_abm({
|
||||||
neighbors = {"default:dirt", "default:dirt_with_grass"},
|
neighbors = {"default:dirt", "default:dirt_with_grass"},
|
||||||
interval = 14,
|
interval = 14,
|
||||||
chance = 71,
|
chance = 71,
|
||||||
action = default.grow_papyrus
|
action = function(...)
|
||||||
|
default.grow_papyrus(...)
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -291,7 +297,7 @@ function default.register_fence(name, def)
|
||||||
groups = {},
|
groups = {},
|
||||||
}
|
}
|
||||||
for k, v in pairs(default_fields) do
|
for k, v in pairs(default_fields) do
|
||||||
if not def[k] then
|
if def[k] == nil then
|
||||||
def[k] = v
|
def[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -313,7 +319,7 @@ end
|
||||||
-- Prevent decay of placed leaves
|
-- Prevent decay of placed leaves
|
||||||
|
|
||||||
default.after_place_leaves = function(pos, placer, itemstack, pointed_thing)
|
default.after_place_leaves = function(pos, placer, itemstack, pointed_thing)
|
||||||
if placer and not placer:get_player_control().sneak then
|
if placer and placer:is_player() and not placer:get_player_control().sneak then
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
node.param2 = 1
|
node.param2 = 1
|
||||||
minetest.set_node(pos, node)
|
minetest.set_node(pos, node)
|
||||||
|
|
|
@ -119,7 +119,7 @@ local function furnace_node_timer(pos, elapsed)
|
||||||
local fuel
|
local fuel
|
||||||
|
|
||||||
local update = true
|
local update = true
|
||||||
while update do
|
while elapsed > 0 and update do
|
||||||
update = false
|
update = false
|
||||||
|
|
||||||
srclist = inv:get_list("src")
|
srclist = inv:get_list("src")
|
||||||
|
@ -134,13 +134,18 @@ local function furnace_node_timer(pos, elapsed)
|
||||||
cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||||
cookable = cooked.time ~= 0
|
cookable = cooked.time ~= 0
|
||||||
|
|
||||||
|
local el = math.min(elapsed, fuel_totaltime - fuel_time)
|
||||||
|
if cookable then -- fuel lasts long enough, adjust el to cooking duration
|
||||||
|
el = math.min(el, cooked.time - src_time)
|
||||||
|
end
|
||||||
|
|
||||||
-- Check if we have enough fuel to burn
|
-- Check if we have enough fuel to burn
|
||||||
if fuel_time < fuel_totaltime then
|
if fuel_time < fuel_totaltime then
|
||||||
-- The furnace is currently active and has enough fuel
|
-- The furnace is currently active and has enough fuel
|
||||||
fuel_time = fuel_time + elapsed
|
fuel_time = fuel_time + el
|
||||||
-- If there is a cookable item then check if it is ready yet
|
-- If there is a cookable item then check if it is ready yet
|
||||||
if cookable then
|
if cookable then
|
||||||
src_time = src_time + elapsed
|
src_time = src_time + el
|
||||||
if src_time >= cooked.time then
|
if src_time >= cooked.time then
|
||||||
-- Place result in dst list if possible
|
-- Place result in dst list if possible
|
||||||
if inv:room_for_item("dst", cooked.item) then
|
if inv:room_for_item("dst", cooked.item) then
|
||||||
|
@ -149,6 +154,9 @@ local function furnace_node_timer(pos, elapsed)
|
||||||
src_time = src_time - cooked.time
|
src_time = src_time - cooked.time
|
||||||
update = true
|
update = true
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
-- Item could not be cooked: probably missing fuel
|
||||||
|
update = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -166,8 +174,7 @@ local function furnace_node_timer(pos, elapsed)
|
||||||
-- Take fuel from fuel list
|
-- Take fuel from fuel list
|
||||||
inv:set_stack("fuel", 1, afterfuel.items[1])
|
inv:set_stack("fuel", 1, afterfuel.items[1])
|
||||||
update = true
|
update = true
|
||||||
fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime)
|
fuel_totaltime = fuel.time + (fuel_totaltime - fuel_time)
|
||||||
src_time = src_time + elapsed
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- We don't need to get new fuel since there is no cookable item
|
-- We don't need to get new fuel since there is no cookable item
|
||||||
|
@ -177,7 +184,7 @@ local function furnace_node_timer(pos, elapsed)
|
||||||
fuel_time = 0
|
fuel_time = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
elapsed = 0
|
elapsed = elapsed - el
|
||||||
end
|
end
|
||||||
|
|
||||||
if fuel and fuel_totaltime > fuel.time then
|
if fuel and fuel_totaltime > fuel.time then
|
||||||
|
|
|
@ -19,7 +19,7 @@ Licenses of media (textures, models and sounds)
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
|
|
||||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||||
Copyright (C) 2010-2016:
|
Copyright (C) 2010-2017:
|
||||||
celeron55, Perttu Ahola <celeron55@gmail.com>
|
celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||||
Cisoun
|
Cisoun
|
||||||
G4JC
|
G4JC
|
||||||
|
@ -44,6 +44,7 @@ Copyright (C) 2010-2016:
|
||||||
GreenXenith
|
GreenXenith
|
||||||
kaeza
|
kaeza
|
||||||
kilbith
|
kilbith
|
||||||
|
CloudyProton
|
||||||
|
|
||||||
You are free to:
|
You are free to:
|
||||||
Share — copy and redistribute the material in any medium or format.
|
Share — copy and redistribute the material in any medium or format.
|
||||||
|
@ -111,7 +112,6 @@ http://creativecommons.org/licenses/by-sa/4.0/
|
||||||
Attribution-ShareAlike 2.0 Generic (CC BY-SA 2.0)
|
Attribution-ShareAlike 2.0 Generic (CC BY-SA 2.0)
|
||||||
Copyright (C) 2014-2016 Neuromancer
|
Copyright (C) 2014-2016 Neuromancer
|
||||||
|
|
||||||
|
|
||||||
You are free to:
|
You are free to:
|
||||||
Share — copy and redistribute the material in any medium or format.
|
Share — copy and redistribute the material in any medium or format.
|
||||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
||||||
|
|
|
@ -440,7 +440,7 @@ minetest.register_node("default:dirt_with_snow", {
|
||||||
tiles = {"default_snow.png", "default_dirt.png",
|
tiles = {"default_snow.png", "default_dirt.png",
|
||||||
{name = "default_dirt.png^default_snow_side.png",
|
{name = "default_dirt.png^default_snow_side.png",
|
||||||
tileable_vertical = false}},
|
tileable_vertical = false}},
|
||||||
groups = {crumbly = 3, spreading_dirt_type = 1, snowy = 1},
|
groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1, snowy = 1},
|
||||||
drop = 'default:dirt',
|
drop = 'default:dirt',
|
||||||
sounds = default.node_sound_dirt_defaults({
|
sounds = default.node_sound_dirt_defaults({
|
||||||
footstep = {name = "default_snow_footstep", gain = 0.15},
|
footstep = {name = "default_snow_footstep", gain = 0.15},
|
||||||
|
@ -608,7 +608,7 @@ minetest.register_node("default:sapling", {
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
minetest.get_node_timer(pos):start(math.random(2400,4800))
|
minetest.get_node_timer(pos):start(math.random(300, 1500))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
@ -673,9 +673,7 @@ minetest.register_node("default:apple", {
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
after_place_node = function(pos, placer, itemstack)
|
after_place_node = function(pos, placer, itemstack)
|
||||||
if placer:is_player() then
|
minetest.set_node(pos, {name = "default:apple", param2 = 1})
|
||||||
minetest.set_node(pos, {name = "default:apple", param2 = 1})
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -742,7 +740,7 @@ minetest.register_node("default:junglesapling", {
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
minetest.get_node_timer(pos):start(math.random(2400,4800))
|
minetest.get_node_timer(pos):start(math.random(300, 1500))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
@ -821,7 +819,7 @@ minetest.register_node("default:pine_sapling", {
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
minetest.get_node_timer(pos):start(math.random(2400,4800))
|
minetest.get_node_timer(pos):start(math.random(300, 1500))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
@ -901,7 +899,7 @@ minetest.register_node("default:acacia_sapling", {
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
minetest.get_node_timer(pos):start(math.random(2400,4800))
|
minetest.get_node_timer(pos):start(math.random(300, 1500))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
@ -979,7 +977,7 @@ minetest.register_node("default:aspen_sapling", {
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
minetest.get_node_timer(pos):start(math.random(2400,4800))
|
minetest.get_node_timer(pos):start(math.random(300, 1500))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
@ -1362,7 +1360,7 @@ minetest.register_node("default:bush_sapling", {
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
minetest.get_node_timer(pos):start(math.random(1200, 2400))
|
minetest.get_node_timer(pos):start(math.random(300, 1500))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
@ -1433,7 +1431,7 @@ minetest.register_node("default:acacia_bush_sapling", {
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
minetest.get_node_timer(pos):start(math.random(1200, 2400))
|
minetest.get_node_timer(pos):start(math.random(300, 1500))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
@ -1783,13 +1781,14 @@ local function get_chest_formspec(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function chest_lid_obstructed(pos)
|
local function chest_lid_obstructed(pos)
|
||||||
local above = { x = pos.x, y = pos.y + 1, z = pos.z }
|
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||||
local def = minetest.registered_nodes[minetest.get_node(above).name]
|
local def = minetest.registered_nodes[minetest.get_node(above).name]
|
||||||
-- allow ladders, signs, wallmounted things and torches to not obstruct
|
-- allow ladders, signs, wallmounted things and torches to not obstruct
|
||||||
if def.drawtype == "airlike" or
|
if def and
|
||||||
|
(def.drawtype == "airlike" or
|
||||||
def.drawtype == "signlike" or
|
def.drawtype == "signlike" or
|
||||||
def.drawtype == "torchlike" or
|
def.drawtype == "torchlike" or
|
||||||
(def.drawtype == "nodebox" and def.paramtype2 == "wallmounted") then
|
(def.drawtype == "nodebox" and def.paramtype2 == "wallmounted")) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
|
@ -1797,6 +1796,24 @@ end
|
||||||
|
|
||||||
local open_chests = {}
|
local open_chests = {}
|
||||||
|
|
||||||
|
local function chest_lid_close(pn)
|
||||||
|
local pos = open_chests[pn].pos
|
||||||
|
local sound = open_chests[pn].sound
|
||||||
|
local swap = open_chests[pn].swap
|
||||||
|
|
||||||
|
open_chests[pn] = nil
|
||||||
|
for k, v in pairs(open_chests) do
|
||||||
|
if v.pos.x == pos.x and v.pos.y == pos.y and v.pos.z == pos.z then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
minetest.after(0.2, minetest.swap_node, pos, { name = "default:" .. swap,
|
||||||
|
param2 = node.param2 })
|
||||||
|
minetest.sound_play(sound, {gain = 0.3, pos = pos, max_hear_distance = 10})
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if formname ~= "default:chest" then
|
if formname ~= "default:chest" then
|
||||||
return
|
return
|
||||||
|
@ -1810,23 +1827,17 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local pos = open_chests[pn].pos
|
chest_lid_close(pn)
|
||||||
local sound = open_chests[pn].sound
|
|
||||||
local swap = open_chests[pn].swap
|
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
|
|
||||||
open_chests[pn] = nil
|
|
||||||
for k, v in pairs(open_chests) do
|
|
||||||
if v.pos.x == pos.x and v.pos.y == pos.y and v.pos.z == pos.z then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
minetest.after(0.2, minetest.swap_node, pos, { name = "default:" .. swap,
|
|
||||||
param2 = node.param2 })
|
|
||||||
minetest.sound_play(sound, {gain = 0.3, pos = pos, max_hear_distance = 10})
|
|
||||||
return true
|
return true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
minetest.register_on_leaveplayer(function(player)
|
||||||
|
local pn = player:get_player_name()
|
||||||
|
if open_chests[pn] then
|
||||||
|
chest_lid_close(pn)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
function default.register_chest(name, d)
|
function default.register_chest(name, d)
|
||||||
local def = table.copy(d)
|
local def = table.copy(d)
|
||||||
def.drawtype = "mesh"
|
def.drawtype = "mesh"
|
||||||
|
@ -1960,6 +1971,13 @@ function default.register_chest(name, d)
|
||||||
open_chests[clicker:get_player_name()] = { pos = pos,
|
open_chests[clicker:get_player_name()] = { pos = pos,
|
||||||
sound = def.sound_close, swap = name }
|
sound = def.sound_close, swap = name }
|
||||||
end
|
end
|
||||||
|
def.on_blast = function(pos)
|
||||||
|
local drops = {}
|
||||||
|
default.get_inventory_drops(pos, "main", drops)
|
||||||
|
drops[#drops+1] = "default:" .. name
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
return drops
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def.on_metadata_inventory_move = function(pos, from_list, from_index,
|
def.on_metadata_inventory_move = function(pos, from_list, from_index,
|
||||||
|
@ -1977,27 +1995,28 @@ function default.register_chest(name, d)
|
||||||
" takes " .. stack:get_name() ..
|
" takes " .. stack:get_name() ..
|
||||||
" from chest at " .. minetest.pos_to_string(pos))
|
" from chest at " .. minetest.pos_to_string(pos))
|
||||||
end
|
end
|
||||||
def.on_blast = function(pos)
|
|
||||||
local drops = {}
|
|
||||||
default.get_inventory_drops(pos, "main", drops)
|
|
||||||
drops[#drops+1] = "default:chest"
|
|
||||||
minetest.remove_node(pos)
|
|
||||||
return drops
|
|
||||||
end
|
|
||||||
|
|
||||||
local def_opened = table.copy(def)
|
local def_opened = table.copy(def)
|
||||||
local def_closed = table.copy(def)
|
local def_closed = table.copy(def)
|
||||||
|
|
||||||
def_opened.mesh = "chest_open.obj"
|
def_opened.mesh = "chest_open.obj"
|
||||||
|
for i = 1, #def_opened.tiles do
|
||||||
|
if type(def_opened.tiles[i]) == "string" then
|
||||||
|
def_opened.tiles[i] = {name = def_opened.tiles[i], backface_culling = true}
|
||||||
|
elseif def_opened.tiles[i].backface_culling == nil then
|
||||||
|
def_opened.tiles[i].backface_culling = true
|
||||||
|
end
|
||||||
|
end
|
||||||
def_opened.drop = "default:" .. name
|
def_opened.drop = "default:" .. name
|
||||||
def_opened.groups.not_in_creative_inventory = 1
|
def_opened.groups.not_in_creative_inventory = 1
|
||||||
def_opened.selection_box = {
|
def_opened.selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = { -1/2, -1/2, -1/2, 1/2, 3/16, 1/2 },
|
fixed = { -1/2, -1/2, -1/2, 1/2, 3/16, 1/2 },
|
||||||
}
|
}
|
||||||
def_opened.can_dig = function()
|
def_opened.can_dig = function()
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
def_opened.on_blast = function() end
|
||||||
|
|
||||||
def_closed.mesh = nil
|
def_closed.mesh = nil
|
||||||
def_closed.drawtype = nil
|
def_closed.drawtype = nil
|
||||||
|
|
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 262 B |
Before Width: | Height: | Size: 191 B After Width: | Height: | Size: 140 B |
|
@ -389,7 +389,8 @@ minetest.register_tool("default:key", {
|
||||||
local node = minetest.get_node(under)
|
local node = minetest.get_node(under)
|
||||||
local def = minetest.registered_nodes[node.name]
|
local def = minetest.registered_nodes[node.name]
|
||||||
if def and def.on_rightclick and
|
if def and def.on_rightclick and
|
||||||
not (placer and placer:get_player_control().sneak) then
|
not (placer and placer:is_player() and
|
||||||
|
placer:get_player_control().sneak) then
|
||||||
return def.on_rightclick(under, node, placer, itemstack,
|
return def.on_rightclick(under, node, placer, itemstack,
|
||||||
pointed_thing) or itemstack
|
pointed_thing) or itemstack
|
||||||
end
|
end
|
||||||
|
|
|
@ -63,7 +63,8 @@ minetest.register_node("default:torch", {
|
||||||
local node = minetest.get_node(under)
|
local node = minetest.get_node(under)
|
||||||
local def = minetest.registered_nodes[node.name]
|
local def = minetest.registered_nodes[node.name]
|
||||||
if def and def.on_rightclick and
|
if def and def.on_rightclick and
|
||||||
((not placer) or (placer and not placer:get_player_control().sneak)) then
|
not (placer and placer:is_player() and
|
||||||
|
placer:get_player_control().sneak) then
|
||||||
return def.on_rightclick(under, node, placer, itemstack,
|
return def.on_rightclick(under, node, placer, itemstack,
|
||||||
pointed_thing) or itemstack
|
pointed_thing) or itemstack
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,12 +31,12 @@ local function is_snow_nearby(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Sapling ABM
|
-- Grow sapling
|
||||||
|
|
||||||
function default.grow_sapling(pos)
|
function default.grow_sapling(pos)
|
||||||
if not default.can_grow(pos) then
|
if not default.can_grow(pos) then
|
||||||
-- try a bit later again
|
-- try again 5 min later
|
||||||
minetest.get_node_timer(pos):start(math.random(240, 600))
|
minetest.get_node_timer(pos):start(300)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ minetest.register_lbm({
|
||||||
"default:pine_sapling", "default:acacia_sapling",
|
"default:pine_sapling", "default:acacia_sapling",
|
||||||
"default:aspen_sapling"},
|
"default:aspen_sapling"},
|
||||||
action = function(pos)
|
action = function(pos)
|
||||||
minetest.get_node_timer(pos):start(math.random(1200, 2400))
|
minetest.get_node_timer(pos):start(math.random(300, 1500))
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -468,7 +468,9 @@ function default.sapling_on_place(itemstack, placer, pointed_thing,
|
||||||
local node = minetest.get_node_or_nil(pos)
|
local node = minetest.get_node_or_nil(pos)
|
||||||
local pdef = node and minetest.registered_nodes[node.name]
|
local pdef = node and minetest.registered_nodes[node.name]
|
||||||
|
|
||||||
if pdef and pdef.on_rightclick and not placer:get_player_control().sneak then
|
if pdef and pdef.on_rightclick and
|
||||||
|
not (placer and placer:is_player() and
|
||||||
|
placer:get_player_control().sneak) then
|
||||||
return pdef.on_rightclick(pos, node, placer, itemstack, pointed_thing)
|
return pdef.on_rightclick(pos, node, placer, itemstack, pointed_thing)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -481,7 +483,7 @@ function default.sapling_on_place(itemstack, placer, pointed_thing,
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local player_name = placer:get_player_name()
|
local player_name = placer and placer:get_player_name() or ""
|
||||||
-- Check sapling position for protection
|
-- Check sapling position for protection
|
||||||
if minetest.is_protected(pos, player_name) then
|
if minetest.is_protected(pos, player_name) then
|
||||||
minetest.record_protection_violation(pos, player_name)
|
minetest.record_protection_violation(pos, player_name)
|
||||||
|
|
|
@ -203,12 +203,7 @@ end
|
||||||
|
|
||||||
local function can_dig_door(pos, digger)
|
local function can_dig_door(pos, digger)
|
||||||
replace_old_owner_information(pos)
|
replace_old_owner_information(pos)
|
||||||
if default.can_interact_with_node(digger, pos) then
|
return default.can_interact_with_node(digger, pos)
|
||||||
return true
|
|
||||||
else
|
|
||||||
minetest.record_protection_violation(pos, digger:get_player_name())
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function doors.register(name, def)
|
function doors.register(name, def)
|
||||||
|
@ -266,7 +261,8 @@ function doors.register(name, def)
|
||||||
local node = minetest.get_node(pointed_thing.under)
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
local pdef = minetest.registered_nodes[node.name]
|
local pdef = minetest.registered_nodes[node.name]
|
||||||
if pdef and pdef.on_rightclick and
|
if pdef and pdef.on_rightclick and
|
||||||
not placer:get_player_control().sneak then
|
not (placer and placer:is_player() and
|
||||||
|
placer:get_player_control().sneak) then
|
||||||
return pdef.on_rightclick(pointed_thing.under,
|
return pdef.on_rightclick(pointed_thing.under,
|
||||||
node, placer, itemstack, pointed_thing)
|
node, placer, itemstack, pointed_thing)
|
||||||
end
|
end
|
||||||
|
@ -290,12 +286,12 @@ function doors.register(name, def)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
local pn = placer:get_player_name()
|
local pn = placer and placer:get_player_name() or ""
|
||||||
if minetest.is_protected(pos, pn) or minetest.is_protected(above, pn) then
|
if minetest.is_protected(pos, pn) or minetest.is_protected(above, pn) then
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
local dir = minetest.dir_to_facedir(placer:get_look_dir())
|
local dir = placer and minetest.dir_to_facedir(placer:get_look_dir()) or 0
|
||||||
|
|
||||||
local ref = {
|
local ref = {
|
||||||
{x = -1, y = 0, z = 0},
|
{x = -1, y = 0, z = 0},
|
||||||
|
@ -712,7 +708,7 @@ function doors.register_fencegate(name, def)
|
||||||
local fence = {
|
local fence = {
|
||||||
description = def.description,
|
description = def.description,
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
tiles = {def.texture},
|
tiles = {},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
|
@ -734,6 +730,16 @@ function doors.register_fencegate(name, def)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if type(def.texture) == "string" then
|
||||||
|
fence.tiles[1] = {name = def.texture, backface_culling = true}
|
||||||
|
elseif def.texture.backface_culling == nil then
|
||||||
|
fence.tiles[1] = table.copy(def.texture)
|
||||||
|
fence.tiles[1].backface_culling = true
|
||||||
|
else
|
||||||
|
fence.tiles[1] = def.texture
|
||||||
|
end
|
||||||
|
|
||||||
if not fence.sounds then
|
if not fence.sounds then
|
||||||
fence.sounds = default.node_sound_wood_defaults()
|
fence.sounds = default.node_sound_wood_defaults()
|
||||||
end
|
end
|
||||||
|
|
|
@ -118,15 +118,6 @@ farming.register_hoe = function(name, def)
|
||||||
{"", "group:stick", ""}
|
{"", "group:stick", ""}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
-- Reverse Recipe
|
|
||||||
minetest.register_craft({
|
|
||||||
output = name:sub(2),
|
|
||||||
recipe = {
|
|
||||||
{"", def.material, def.material},
|
|
||||||
{"", "group:stick", ""},
|
|
||||||
{"", "group:stick", ""}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -153,12 +144,14 @@ farming.place_seed = function(itemstack, placer, pointed_thing, plantname)
|
||||||
local under = minetest.get_node(pt.under)
|
local under = minetest.get_node(pt.under)
|
||||||
local above = minetest.get_node(pt.above)
|
local above = minetest.get_node(pt.above)
|
||||||
|
|
||||||
if minetest.is_protected(pt.under, placer:get_player_name()) then
|
local player_name = placer and placer:get_player_name() or ""
|
||||||
minetest.record_protection_violation(pt.under, placer:get_player_name())
|
|
||||||
|
if minetest.is_protected(pt.under, player_name) then
|
||||||
|
minetest.record_protection_violation(pt.under, player_name)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if minetest.is_protected(pt.above, placer:get_player_name()) then
|
if minetest.is_protected(pt.above, player_name) then
|
||||||
minetest.record_protection_violation(pt.above, placer:get_player_name())
|
minetest.record_protection_violation(pt.above, player_name)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -189,7 +182,7 @@ farming.place_seed = function(itemstack, placer, pointed_thing, plantname)
|
||||||
minetest.add_node(pt.above, {name = plantname, param2 = 1})
|
minetest.add_node(pt.above, {name = plantname, param2 = 1})
|
||||||
tick(pt.above)
|
tick(pt.above)
|
||||||
if not (creative and creative.is_enabled_for
|
if not (creative and creative.is_enabled_for
|
||||||
and creative.is_enabled_for(placer:get_player_name())) then
|
and creative.is_enabled_for(player_name)) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
@ -319,7 +312,8 @@ farming.register_plant = function(name, def)
|
||||||
local node = minetest.get_node(under)
|
local node = minetest.get_node(under)
|
||||||
local udef = minetest.registered_nodes[node.name]
|
local udef = minetest.registered_nodes[node.name]
|
||||||
if udef and udef.on_rightclick and
|
if udef and udef.on_rightclick and
|
||||||
not (placer and placer:get_player_control().sneak) then
|
not (placer and placer:is_player() and
|
||||||
|
placer:get_player_control().sneak) then
|
||||||
return udef.on_rightclick(under, node, placer, itemstack,
|
return udef.on_rightclick(under, node, placer, itemstack,
|
||||||
pointed_thing) or itemstack
|
pointed_thing) or itemstack
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
default
|
default
|
||||||
wool
|
wool
|
||||||
|
stairs
|
||||||
|
|
|
@ -98,6 +98,16 @@ minetest.register_node("farming:straw", {
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
stairs.register_stair_and_slab(
|
||||||
|
"straw",
|
||||||
|
"farming:straw",
|
||||||
|
{snappy = 3, flammable = 4},
|
||||||
|
{"farming_straw.png"},
|
||||||
|
"Straw Stair",
|
||||||
|
"Straw Slab",
|
||||||
|
default.node_sound_leaves_defaults()
|
||||||
|
)
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Farming soil",
|
label = "Farming soil",
|
||||||
nodenames = {"group:field"},
|
nodenames = {"group:field"},
|
||||||
|
|
|
@ -127,24 +127,29 @@ function flowers.flower_spread(pos, node)
|
||||||
|
|
||||||
local pos0 = vector.subtract(pos, 4)
|
local pos0 = vector.subtract(pos, 4)
|
||||||
local pos1 = vector.add(pos, 4)
|
local pos1 = vector.add(pos, 4)
|
||||||
if #minetest.find_nodes_in_area(pos0, pos1, "group:flora") > 3 then
|
-- Maximum flower density created by mapgen is 13 per 9x9 area.
|
||||||
|
-- The limit of 7 below was tuned by in-game testing to result in a maximum
|
||||||
|
-- flower density by ABM spread of 13 per 9x9 area.
|
||||||
|
-- Warning: Setting this limit theoretically without in-game testing
|
||||||
|
-- results in a maximum flower density by ABM spread that is far too high.
|
||||||
|
if #minetest.find_nodes_in_area(pos0, pos1, "group:flora") > 7 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local soils = minetest.find_nodes_in_area_under_air(
|
local soils = minetest.find_nodes_in_area_under_air(
|
||||||
pos0, pos1, "group:soil")
|
pos0, pos1, "group:soil")
|
||||||
if #soils > 0 then
|
local num_soils = #soils
|
||||||
local seedling = soils[math.random(#soils)]
|
if num_soils >= 1 then
|
||||||
local seedling_above =
|
for si = 1, math.min(3, num_soils) do
|
||||||
{x = seedling.x, y = seedling.y + 1, z = seedling.z}
|
local soil = soils[math.random(num_soils)]
|
||||||
light = minetest.get_node_light(seedling_above)
|
local soil_above = {x = soil.x, y = soil.y + 1, z = soil.z}
|
||||||
if not light or light < 13 or
|
light = minetest.get_node_light(soil_above)
|
||||||
-- Desert sand is in the soil group
|
if light and light >= 13 and
|
||||||
minetest.get_node(seedling).name == "default:desert_sand" then
|
-- Desert sand is in the soil group
|
||||||
return
|
minetest.get_node(soil).name ~= "default:desert_sand" then
|
||||||
|
minetest.set_node(soil_above, {name = node.name})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.set_node(seedling_above, {name = node.name})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -152,7 +157,7 @@ minetest.register_abm({
|
||||||
label = "Flower spread",
|
label = "Flower spread",
|
||||||
nodenames = {"group:flora"},
|
nodenames = {"group:flora"},
|
||||||
interval = 13,
|
interval = 13,
|
||||||
chance = 96,
|
chance = 300,
|
||||||
action = function(...)
|
action = function(...)
|
||||||
flowers.flower_spread(...)
|
flowers.flower_spread(...)
|
||||||
end,
|
end,
|
||||||
|
@ -204,38 +209,34 @@ minetest.register_node("flowers:mushroom_brown", {
|
||||||
|
|
||||||
-- Mushroom spread and death
|
-- Mushroom spread and death
|
||||||
|
|
||||||
|
function flowers.mushroom_spread(pos, node)
|
||||||
|
if minetest.get_node_light(pos, nil) == 15 then
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local positions = minetest.find_nodes_in_area_under_air(
|
||||||
|
{x = pos.x - 1, y = pos.y - 2, z = pos.z - 1},
|
||||||
|
{x = pos.x + 1, y = pos.y + 1, z = pos.z + 1},
|
||||||
|
{"group:soil", "group:tree"})
|
||||||
|
if #positions == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local pos2 = positions[math.random(#positions)]
|
||||||
|
pos2.y = pos2.y + 1
|
||||||
|
if minetest.get_node_light(pos, 0.5) <= 3 and
|
||||||
|
minetest.get_node_light(pos2, 0.5) <= 3 then
|
||||||
|
minetest.set_node(pos2, {name = node.name})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Mushroom spread",
|
label = "Mushroom spread",
|
||||||
nodenames = {"flowers:mushroom_brown", "flowers:mushroom_red"},
|
nodenames = {"flowers:mushroom_brown", "flowers:mushroom_red"},
|
||||||
interval = 11,
|
interval = 11,
|
||||||
chance = 50,
|
chance = 150,
|
||||||
action = function(pos, node)
|
action = function(...)
|
||||||
if minetest.get_node_light(pos, nil) == 15 then
|
flowers.mushroom_spread(...)
|
||||||
minetest.remove_node(pos)
|
end,
|
||||||
return
|
|
||||||
end
|
|
||||||
local random = {
|
|
||||||
x = pos.x + math.random(-2, 2),
|
|
||||||
y = pos.y + math.random(-1, 1),
|
|
||||||
z = pos.z + math.random(-2, 2)
|
|
||||||
}
|
|
||||||
local random_node = minetest.get_node_or_nil(random)
|
|
||||||
if not random_node or random_node.name ~= "air" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local node_under = minetest.get_node_or_nil({x = random.x,
|
|
||||||
y = random.y - 1, z = random.z})
|
|
||||||
if not node_under then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if (minetest.get_item_group(node_under.name, "soil") ~= 0 or
|
|
||||||
minetest.get_item_group(node_under.name, "tree") ~= 0) and
|
|
||||||
minetest.get_node_light(pos, 0.5) <= 3 and
|
|
||||||
minetest.get_node_light(random, 0.5) <= 3 then
|
|
||||||
minetest.set_node(random, {name = node.name})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -280,12 +281,17 @@ minetest.register_node("flowers:waterlily", {
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
local pos = pointed_thing.above
|
local pos = pointed_thing.above
|
||||||
local node = minetest.get_node(pointed_thing.under).name
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
local def = minetest.registered_nodes[node]
|
local def = minetest.registered_nodes[node.name]
|
||||||
local player_name = placer:get_player_name()
|
local player_name = placer and placer:get_player_name() or ""
|
||||||
|
|
||||||
|
if def and def.on_rightclick then
|
||||||
|
return def.on_rightclick(pointed_thing.under, node, placer, itemstack,
|
||||||
|
pointed_thing)
|
||||||
|
end
|
||||||
|
|
||||||
if def and def.liquidtype == "source" and
|
if def and def.liquidtype == "source" and
|
||||||
minetest.get_item_group(node, "water") > 0 then
|
minetest.get_item_group(node.name, "water") > 0 then
|
||||||
if not minetest.is_protected(pos, player_name) then
|
if not minetest.is_protected(pos, player_name) then
|
||||||
minetest.set_node(pos, {name = "flowers:waterlily",
|
minetest.set_node(pos, {name = "flowers:waterlily",
|
||||||
param2 = math.random(0, 3)})
|
param2 = math.random(0, 3)})
|
||||||
|
|
|
@ -85,9 +85,10 @@ screwdriver.handler = function(itemstack, user, pointed_thing, mode, uses)
|
||||||
end
|
end
|
||||||
|
|
||||||
local pos = pointed_thing.under
|
local pos = pointed_thing.under
|
||||||
|
local player_name = user and user:get_player_name() or ""
|
||||||
|
|
||||||
if minetest.is_protected(pos, user:get_player_name()) then
|
if minetest.is_protected(pos, player_name) then
|
||||||
minetest.record_protection_violation(pos, user:get_player_name())
|
minetest.record_protection_violation(pos, player_name)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -133,8 +134,8 @@ screwdriver.handler = function(itemstack, user, pointed_thing, mode, uses)
|
||||||
minetest.check_for_falling(pos)
|
minetest.check_for_falling(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not (creative and creative.is_enabled_for
|
if not (creative and creative.is_enabled_for and
|
||||||
and creative.is_enabled_for(user:get_player_name())) then
|
creative.is_enabled_for(player_name)) then
|
||||||
itemstack:add_wear(65535 / ((uses or 200) - 1))
|
itemstack:add_wear(65535 / ((uses or 200) - 1))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,8 @@ end
|
||||||
function sfinv.get_nav_fs(player, context, nav, current_idx)
|
function sfinv.get_nav_fs(player, context, nav, current_idx)
|
||||||
-- Only show tabs if there is more than one page
|
-- Only show tabs if there is more than one page
|
||||||
if #nav > 1 then
|
if #nav > 1 then
|
||||||
return "tabheader[0,0;tabs;" .. table.concat(nav, ",") .. ";" .. current_idx .. ";true;false]"
|
return "tabheader[0,0;sfinv_nav_tabs;" .. table.concat(nav, ",") ..
|
||||||
|
";" .. current_idx .. ";true;false]"
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
@ -84,9 +85,20 @@ function sfinv.get_formspec(player, context)
|
||||||
return page:get(player, context)
|
return page:get(player, context)
|
||||||
else
|
else
|
||||||
local old_page = context.page
|
local old_page = context.page
|
||||||
context.page = sfinv.get_homepage_name(player)
|
local home_page = sfinv.get_homepage_name(player)
|
||||||
|
|
||||||
|
if old_page == home_page then
|
||||||
|
minetest.log("error", "[sfinv] Couldn't find " .. dump(old_page) ..
|
||||||
|
", which is also the old page")
|
||||||
|
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
context.page = home_page
|
||||||
assert(sfinv.pages[context.page], "[sfinv] Invalid homepage")
|
assert(sfinv.pages[context.page], "[sfinv] Invalid homepage")
|
||||||
minetest.log("warning", "[sfinv] Couldn't find " .. dump(old_page) .. " so using switching to homepage")
|
minetest.log("warning", "[sfinv] Couldn't find " .. dump(old_page) ..
|
||||||
|
" so switching to homepage")
|
||||||
|
|
||||||
return sfinv.get_formspec(player, context)
|
return sfinv.get_formspec(player, context)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -151,8 +163,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Was a tab selected?
|
-- Was a tab selected?
|
||||||
if fields.tabs and context.nav then
|
if fields.sfinv_nav_tabs and context.nav then
|
||||||
local tid = tonumber(fields.tabs)
|
local tid = tonumber(fields.sfinv_nav_tabs)
|
||||||
if tid and tid > 0 then
|
if tid and tid > 0 then
|
||||||
local id = context.nav[tid]
|
local id = context.nav[tid]
|
||||||
local page = sfinv.pages[id]
|
local page = sfinv.pages[id]
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
default
|
default
|
||||||
farming
|
|
||||||
|
|
|
@ -22,21 +22,23 @@ local function rotate_and_place(itemstack, placer, pointed_thing)
|
||||||
local p1 = pointed_thing.above
|
local p1 = pointed_thing.above
|
||||||
local param2 = 0
|
local param2 = 0
|
||||||
|
|
||||||
local placer_pos = placer:getpos()
|
if placer then
|
||||||
if placer_pos then
|
local placer_pos = placer:getpos()
|
||||||
param2 = minetest.dir_to_facedir(vector.subtract(p1, placer_pos))
|
if placer_pos then
|
||||||
end
|
param2 = minetest.dir_to_facedir(vector.subtract(p1, placer_pos))
|
||||||
|
end
|
||||||
|
|
||||||
local finepos = minetest.pointed_thing_to_face_pos(placer, pointed_thing)
|
local finepos = minetest.pointed_thing_to_face_pos(placer, pointed_thing)
|
||||||
local fpos = finepos.y % 1
|
local fpos = finepos.y % 1
|
||||||
|
|
||||||
if p0.y - 1 == p1.y or (fpos > 0 and fpos < 0.5)
|
if p0.y - 1 == p1.y or (fpos > 0 and fpos < 0.5)
|
||||||
or (fpos < -0.5 and fpos > -0.999999999) then
|
or (fpos < -0.5 and fpos > -0.999999999) then
|
||||||
param2 = param2 + 20
|
param2 = param2 + 20
|
||||||
if param2 == 21 then
|
if param2 == 21 then
|
||||||
param2 = 23
|
param2 = 23
|
||||||
elseif param2 == 23 then
|
elseif param2 == 23 then
|
||||||
param2 = 21
|
param2 = 21
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
||||||
|
@ -46,16 +48,29 @@ end
|
||||||
-- Node will be called stairs:stair_<subname>
|
-- Node will be called stairs:stair_<subname>
|
||||||
|
|
||||||
function stairs.register_stair(subname, recipeitem, groups, images, description, sounds)
|
function stairs.register_stair(subname, recipeitem, groups, images, description, sounds)
|
||||||
groups.stair = 1
|
local stair_images = {}
|
||||||
|
for i, image in ipairs(images) do
|
||||||
|
if type(image) == "string" then
|
||||||
|
stair_images[i] = {
|
||||||
|
name = image,
|
||||||
|
backface_culling = true,
|
||||||
|
}
|
||||||
|
elseif image.backface_culling == nil then -- override using any other value
|
||||||
|
stair_images[i] = table.copy(image)
|
||||||
|
stair_images[i].backface_culling = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local new_groups = table.copy(groups)
|
||||||
|
new_groups.stair = 1
|
||||||
minetest.register_node(":stairs:stair_" .. subname, {
|
minetest.register_node(":stairs:stair_" .. subname, {
|
||||||
description = description,
|
description = description,
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "stairs_stair.obj",
|
mesh = "stairs_stair.obj",
|
||||||
tiles = images,
|
tiles = stair_images,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = groups,
|
groups = new_groups,
|
||||||
sounds = sounds,
|
sounds = sounds,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
|
@ -89,16 +104,7 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
|
||||||
end
|
end
|
||||||
|
|
||||||
if recipeitem then
|
if recipeitem then
|
||||||
minetest.register_craft({
|
-- Recipe matches appearence in inventory
|
||||||
output = 'stairs:stair_' .. subname .. ' 8',
|
|
||||||
recipe = {
|
|
||||||
{recipeitem, "", ""},
|
|
||||||
{recipeitem, recipeitem, ""},
|
|
||||||
{recipeitem, recipeitem, recipeitem},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Flipped recipe for the silly minecrafters
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'stairs:stair_' .. subname .. ' 8',
|
output = 'stairs:stair_' .. subname .. ' 8',
|
||||||
recipe = {
|
recipe = {
|
||||||
|
@ -132,7 +138,8 @@ local slab_trans_dir = {[0] = 8, 0, 2, 1, 3, 4}
|
||||||
-- Node will be called stairs:slab_<subname>
|
-- Node will be called stairs:slab_<subname>
|
||||||
|
|
||||||
function stairs.register_slab(subname, recipeitem, groups, images, description, sounds)
|
function stairs.register_slab(subname, recipeitem, groups, images, description, sounds)
|
||||||
groups.slab = 1
|
local new_groups = table.copy(groups)
|
||||||
|
new_groups.slab = 1
|
||||||
minetest.register_node(":stairs:slab_" .. subname, {
|
minetest.register_node(":stairs:slab_" .. subname, {
|
||||||
description = description,
|
description = description,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
|
@ -140,7 +147,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = groups,
|
groups = new_groups,
|
||||||
sounds = sounds,
|
sounds = sounds,
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
|
@ -149,8 +156,9 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
local under = minetest.get_node(pointed_thing.under)
|
local under = minetest.get_node(pointed_thing.under)
|
||||||
local wield_item = itemstack:get_name()
|
local wield_item = itemstack:get_name()
|
||||||
|
local player_name = placer and placer:get_player_name() or ""
|
||||||
local creative_enabled = (creative and creative.is_enabled_for
|
local creative_enabled = (creative and creative.is_enabled_for
|
||||||
and creative.is_enabled_for(placer:get_player_name()))
|
and creative.is_enabled_for(player_name))
|
||||||
|
|
||||||
if under and under.name:find("stairs:slab_") then
|
if under and under.name:find("stairs:slab_") then
|
||||||
-- place slab using under node orientation
|
-- place slab using under node orientation
|
||||||
|
@ -166,9 +174,8 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
||||||
if not recipeitem then
|
if not recipeitem then
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
local player_name = placer:get_player_name()
|
|
||||||
if minetest.is_protected(pointed_thing.under, player_name) and not
|
if minetest.is_protected(pointed_thing.under, player_name) and not
|
||||||
minetest.check_player_privs(placer, "protection_bypass") then
|
minetest.check_player_privs(player_name, "protection_bypass") then
|
||||||
minetest.record_protection_violation(pointed_thing.under,
|
minetest.record_protection_violation(pointed_thing.under,
|
||||||
player_name)
|
player_name)
|
||||||
return
|
return
|
||||||
|
@ -538,16 +545,6 @@ stairs.register_stair_and_slab(
|
||||||
default.node_sound_stone_defaults()
|
default.node_sound_stone_defaults()
|
||||||
)
|
)
|
||||||
|
|
||||||
stairs.register_stair_and_slab(
|
|
||||||
"straw",
|
|
||||||
"farming:straw",
|
|
||||||
{snappy = 3, flammable = 4},
|
|
||||||
{"farming_straw.png"},
|
|
||||||
"Straw Stair",
|
|
||||||
"Straw Slab",
|
|
||||||
default.node_sound_leaves_defaults()
|
|
||||||
)
|
|
||||||
|
|
||||||
stairs.register_stair_and_slab(
|
stairs.register_stair_and_slab(
|
||||||
"steelblock",
|
"steelblock",
|
||||||
"default:steelblock",
|
"default:steelblock",
|
||||||
|
|
|
@ -86,8 +86,8 @@ end
|
||||||
local basic_flame_on_construct -- cached value
|
local basic_flame_on_construct -- cached value
|
||||||
local function destroy(drops, npos, cid, c_air, c_fire,
|
local function destroy(drops, npos, cid, c_air, c_fire,
|
||||||
on_blast_queue, on_construct_queue,
|
on_blast_queue, on_construct_queue,
|
||||||
ignore_protection, ignore_on_blast)
|
ignore_protection, ignore_on_blast, owner)
|
||||||
if not ignore_protection and minetest.is_protected(npos, "") then
|
if not ignore_protection and minetest.is_protected(npos, owner) then
|
||||||
return cid
|
return cid
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -208,6 +208,7 @@ local function add_effects(pos, radius, drops)
|
||||||
collisiondetection = false,
|
collisiondetection = false,
|
||||||
vertical = false,
|
vertical = false,
|
||||||
texture = "tnt_boom.png",
|
texture = "tnt_boom.png",
|
||||||
|
glow = 15,
|
||||||
})
|
})
|
||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = 64,
|
amount = 64,
|
||||||
|
@ -266,13 +267,13 @@ function tnt.burn(pos, nodename)
|
||||||
elseif def.on_ignite then
|
elseif def.on_ignite then
|
||||||
def.on_ignite(pos)
|
def.on_ignite(pos)
|
||||||
elseif minetest.get_item_group(name, "tnt") > 0 then
|
elseif minetest.get_item_group(name, "tnt") > 0 then
|
||||||
|
minetest.swap_node(pos, {name = name .. "_burning"})
|
||||||
minetest.sound_play("tnt_ignite", {pos = pos})
|
minetest.sound_play("tnt_ignite", {pos = pos})
|
||||||
minetest.set_node(pos, {name = name .. "_burning"})
|
|
||||||
minetest.get_node_timer(pos):start(1)
|
minetest.get_node_timer(pos):start(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)
|
local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, owner, explode_center)
|
||||||
pos = vector.round(pos)
|
pos = vector.round(pos)
|
||||||
-- scan for adjacent TNT nodes first, and enlarge the explosion
|
-- scan for adjacent TNT nodes first, and enlarge the explosion
|
||||||
local vm1 = VoxelManip()
|
local vm1 = VoxelManip()
|
||||||
|
@ -286,6 +287,10 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)
|
||||||
local c_tnt_burning = minetest.get_content_id("tnt:tnt_burning")
|
local c_tnt_burning = minetest.get_content_id("tnt:tnt_burning")
|
||||||
local c_tnt_boom = minetest.get_content_id("tnt:boom")
|
local c_tnt_boom = minetest.get_content_id("tnt:boom")
|
||||||
local c_air = minetest.get_content_id("air")
|
local c_air = minetest.get_content_id("air")
|
||||||
|
-- make sure we still have explosion even when centre node isnt tnt related
|
||||||
|
if explode_center then
|
||||||
|
count = 1
|
||||||
|
end
|
||||||
|
|
||||||
for z = pos.z - 2, pos.z + 2 do
|
for z = pos.z - 2, pos.z + 2 do
|
||||||
for y = pos.y - 2, pos.y + 2 do
|
for y = pos.y - 2, pos.y + 2 do
|
||||||
|
@ -333,7 +338,7 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)
|
||||||
if cid ~= c_air then
|
if cid ~= c_air then
|
||||||
data[vi] = destroy(drops, p, cid, c_air, c_fire,
|
data[vi] = destroy(drops, p, cid, c_air, c_fire,
|
||||||
on_blast_queue, on_construct_queue,
|
on_blast_queue, on_construct_queue,
|
||||||
ignore_protection, ignore_on_blast)
|
ignore_protection, ignore_on_blast, owner)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
vi = vi + 1
|
vi = vi + 1
|
||||||
|
@ -375,16 +380,26 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)
|
||||||
queued_data.fn(queued_data.pos)
|
queued_data.fn(queued_data.pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.log("action", "TNT owned by " .. owner .. " detonated at " ..
|
||||||
|
minetest.pos_to_string(pos) .. " with radius " .. radius)
|
||||||
|
|
||||||
return drops, radius
|
return drops, radius
|
||||||
end
|
end
|
||||||
|
|
||||||
function tnt.boom(pos, def)
|
function tnt.boom(pos, def)
|
||||||
|
def = def or {}
|
||||||
|
def.radius = def.radius or 1
|
||||||
|
def.damage_radius = def.damage_radius or def.radius * 2
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local owner = meta:get_string("owner")
|
||||||
|
if not def.explode_center then
|
||||||
|
minetest.set_node(pos, {name = "tnt:boom"})
|
||||||
|
end
|
||||||
minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = 2*64})
|
minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = 2*64})
|
||||||
minetest.set_node(pos, {name = "tnt:boom"})
|
|
||||||
local drops, radius = tnt_explode(pos, def.radius, def.ignore_protection,
|
local drops, radius = tnt_explode(pos, def.radius, def.ignore_protection,
|
||||||
def.ignore_on_blast)
|
def.ignore_on_blast, owner, def.explode_center)
|
||||||
-- append entity drops
|
-- append entity drops
|
||||||
local damage_radius = (radius / def.radius) * def.damage_radius
|
local damage_radius = (radius / math.max(1, def.radius)) * def.damage_radius
|
||||||
entity_physics(pos, damage_radius, drops)
|
entity_physics(pos, damage_radius, drops)
|
||||||
if not def.disable_drops then
|
if not def.disable_drops then
|
||||||
eject_drops(drops, pos, radius)
|
eject_drops(drops, pos, radius)
|
||||||
|
@ -400,12 +415,6 @@ minetest.register_node("tnt:boom", {
|
||||||
walkable = false,
|
walkable = false,
|
||||||
drop = "",
|
drop = "",
|
||||||
groups = {dig_immediate = 3},
|
groups = {dig_immediate = 3},
|
||||||
on_construct = function(pos)
|
|
||||||
minetest.get_node_timer(pos):start(0.4)
|
|
||||||
end,
|
|
||||||
on_timer = function(pos, elapsed)
|
|
||||||
minetest.remove_node(pos)
|
|
||||||
end,
|
|
||||||
-- unaffected by explosions
|
-- unaffected by explosions
|
||||||
on_blast = function() end,
|
on_blast = function() end,
|
||||||
})
|
})
|
||||||
|
@ -508,17 +517,17 @@ minetest.register_node("tnt:gunpowder_burning", {
|
||||||
on_timer = function(pos, elapsed)
|
on_timer = function(pos, elapsed)
|
||||||
for dx = -1, 1 do
|
for dx = -1, 1 do
|
||||||
for dz = -1, 1 do
|
for dz = -1, 1 do
|
||||||
for dy = -1, 1 do
|
if math.abs(dx) + math.abs(dz) == 1 then
|
||||||
if not (dx == 0 and dz == 0) then
|
for dy = -1, 1 do
|
||||||
tnt.burn({
|
tnt.burn({
|
||||||
x = pos.x + dx,
|
x = pos.x + dx,
|
||||||
y = pos.y + dy,
|
y = pos.y + dy,
|
||||||
z = pos.z + dz,
|
z = pos.z + dz,
|
||||||
})
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
end,
|
end,
|
||||||
-- unaffected by explosions
|
-- unaffected by explosions
|
||||||
|
@ -579,9 +588,16 @@ function tnt.register_tnt(def)
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = {dig_immediate = 2, mesecon = 2, tnt = 1, flammable = 5},
|
groups = {dig_immediate = 2, mesecon = 2, tnt = 1, flammable = 5},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
after_place_node = function(pos, placer)
|
||||||
|
if placer:is_player() then
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("owner", placer:get_player_name())
|
||||||
|
end
|
||||||
|
end,
|
||||||
on_punch = function(pos, node, puncher)
|
on_punch = function(pos, node, puncher)
|
||||||
if puncher:get_wielded_item():get_name() == "default:torch" then
|
if puncher:get_wielded_item():get_name() == "default:torch" then
|
||||||
minetest.set_node(pos, {name = name .. "_burning"})
|
minetest.swap_node(pos, {name = name .. "_burning"})
|
||||||
|
minetest.registered_nodes[name .. "_burning"].on_construct(pos)
|
||||||
minetest.log("action", puncher:get_player_name() ..
|
minetest.log("action", puncher:get_player_name() ..
|
||||||
" ignites " .. node.name .. " at " ..
|
" ignites " .. node.name .. " at " ..
|
||||||
minetest.pos_to_string(pos))
|
minetest.pos_to_string(pos))
|
||||||
|
@ -600,10 +616,12 @@ function tnt.register_tnt(def)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_burn = function(pos)
|
on_burn = function(pos)
|
||||||
minetest.set_node(pos, {name = name .. "_burning"})
|
minetest.swap_node(pos, {name = name .. "_burning"})
|
||||||
|
minetest.registered_nodes[name .. "_burning"].on_construct(pos)
|
||||||
end,
|
end,
|
||||||
on_ignite = function(pos, igniter)
|
on_ignite = function(pos, igniter)
|
||||||
minetest.set_node(pos, {name = name .. "_burning"})
|
minetest.swap_node(pos, {name = name .. "_burning"})
|
||||||
|
minetest.registered_nodes[name .. "_burning"].on_construct(pos)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|