Make armour HUD always show even if empty, and add game to master
This commit is contained in:
parent
458fa3a678
commit
02848d189e
|
@ -1,46 +1,46 @@
|
||||||
# MultiCraft_game
|
# MultiCraft_game
|
||||||
Subgame for MultiCraft.
|
Subgame for MultiCraft.
|
||||||
|
|
||||||
|
|
||||||
A Minecraft clone game for the MultiCraft game engine.
|
A Minecraft clone game for the MultiCraft game engine.
|
||||||
======================================================================
|
======================================================================
|
||||||
|
|
||||||
License of source code
|
License of source code
|
||||||
----------------------
|
----------------------
|
||||||
Copyright (C) 2013 jojoa1997
|
Copyright (C) 2013 jojoa1997
|
||||||
See README.txt in each mod directory for information about other authors.
|
See README.txt in each mod directory for information about other authors.
|
||||||
|
|
||||||
LGPL v3 see LICENSE.txt
|
LGPL v3 see LICENSE.txt
|
||||||
|
|
||||||
License of media (textures and sounds)
|
License of media (textures and sounds)
|
||||||
--------------------------------------
|
--------------------------------------
|
||||||
Copyright (C) 2013 Vattic
|
Copyright (C) 2013 Vattic
|
||||||
|
|
||||||
http://www.minecraftforum.net/topic/72747-/
|
http://www.minecraftforum.net/topic/72747-/
|
||||||
|
|
||||||
Vattic's Terms:
|
Vattic's Terms:
|
||||||
Things that are fine:
|
Things that are fine:
|
||||||
- Use as placeholders.
|
- Use as placeholders.
|
||||||
- Using as many textures as you've made yourself.
|
- Using as many textures as you've made yourself.
|
||||||
- Using the items or paintings.
|
- Using the items or paintings.
|
||||||
- Use as base for mod textures.
|
- Use as base for mod textures.
|
||||||
|
|
||||||
Requirements:
|
Requirements:
|
||||||
- Give clear credit.
|
- Give clear credit.
|
||||||
- Link back to the Faithful 32x32 thread.
|
- Link back to the Faithful 32x32 thread.
|
||||||
- Be honest about what you are using.
|
- Be honest about what you are using.
|
||||||
- No money making links.
|
- No money making links.
|
||||||
|
|
||||||
On remix/tweaked packs:
|
On remix/tweaked packs:
|
||||||
- Let's Players can share a modified copy with fans.
|
- Let's Players can share a modified copy with fans.
|
||||||
- Adventure map makers can provide modified copy to go along with it.
|
- Adventure map makers can provide modified copy to go along with it.
|
||||||
|
|
||||||
If either of the above apply:
|
If either of the above apply:
|
||||||
- You must distribute through YouTube video descriptions or your series'/map's forum topic and not create a separate thread for the pack.
|
- You must distribute through YouTube video descriptions or your series'/map's forum topic and not create a separate thread for the pack.
|
||||||
- To avoid people uploading a video just so they can upload a copy of the pack Let's Players must have a decent number of videos that use the pack and a decent number of subscribers.
|
- To avoid people uploading a video just so they can upload a copy of the pack Let's Players must have a decent number of videos that use the pack and a decent number of subscribers.
|
||||||
|
|
||||||
Finally:
|
Finally:
|
||||||
- If I decide I don't want you using stuff from the pack then that is final. This will only be the case in unusual circumstances.
|
- If I decide I don't want you using stuff from the pack then that is final. This will only be the case in unusual circumstances.
|
||||||
- These guidelines can be changed at any time.
|
- These guidelines can be changed at any time.
|
||||||
|
|
||||||
See README.txt in each mod directory for information about other authors.
|
See README.txt in each mod directory for information about other authors.
|
File diff suppressed because it is too large
Load Diff
|
@ -1,26 +1,26 @@
|
||||||
multicraft mod "Beds"
|
multicraft mod "Beds"
|
||||||
=======================
|
=======================
|
||||||
version: 1.1
|
version: 1.1
|
||||||
|
|
||||||
|
|
||||||
License of source code: WTFPL
|
License of source code: WTFPL
|
||||||
-----------------------------
|
-----------------------------
|
||||||
author: BlockMen (2013)
|
author: BlockMen (2013)
|
||||||
original author: PilzAdam
|
original author: PilzAdam
|
||||||
|
|
||||||
This program is free software. It comes without any warranty, to
|
This program is free software. It comes without any warranty, to
|
||||||
the extent permitted by applicable law. You can redistribute it
|
the extent permitted by applicable law. You can redistribute it
|
||||||
and/or modify it under the terms of the Do What The Fuck You Want
|
and/or modify it under the terms of the Do What The Fuck You Want
|
||||||
To Public License, Version 2, as published by Sam Hocevar. See
|
To Public License, Version 2, as published by Sam Hocevar. See
|
||||||
http://sam.zoy.org/wtfpl/COPYING for more details.
|
http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||||
|
|
||||||
|
|
||||||
--USING the mod--
|
--USING the mod--
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
This mods implements Beds like known from Minecraft. You can use them to sleep at night to skip the time or to prevent attacks by evil mobs.
|
This mods implements Beds like known from Minecraft. You can use them to sleep at night to skip the time or to prevent attacks by evil mobs.
|
||||||
|
|
||||||
|
|
||||||
To sleep you have to "rightclick" on your bed. You can only sleep at night and get noticed when it is too early.
|
To sleep you have to "rightclick" on your bed. You can only sleep at night and get noticed when it is too early.
|
||||||
|
|
||||||
After dying the player will respawn at the last bed he has slept.
|
After dying the player will respawn at the last bed he has slept.
|
|
@ -1,263 +1,263 @@
|
||||||
if not multicraft.get_modpath("check") then os.exit() end
|
if not multicraft.get_modpath("check") then os.exit() end
|
||||||
if not default.multicraft_is_variable_is_a_part_of_multicraft_subgame_and_copying_it_means_you_use_our_code_so_we_become_contributors_of_your_project then exit() end
|
if not default.multicraft_is_variable_is_a_part_of_multicraft_subgame_and_copying_it_means_you_use_our_code_so_we_become_contributors_of_your_project then exit() end
|
||||||
local player_in_bed = 0
|
local player_in_bed = 0
|
||||||
local guy
|
local guy
|
||||||
local hand
|
local hand
|
||||||
local old_yaw = 0
|
local old_yaw = 0
|
||||||
|
|
||||||
local function get_dir(pos)
|
local function get_dir(pos)
|
||||||
local btop = "beds:bed_top"
|
local btop = "beds:bed_top"
|
||||||
if multicraft.get_node({x=pos.x+1,y=pos.y,z=pos.z}).name == btop then
|
if multicraft.get_node({x=pos.x+1,y=pos.y,z=pos.z}).name == btop then
|
||||||
return 7.9
|
return 7.9
|
||||||
elseif multicraft.get_node({x=pos.x-1,y=pos.y,z=pos.z}).name == btop then
|
elseif multicraft.get_node({x=pos.x-1,y=pos.y,z=pos.z}).name == btop then
|
||||||
return 4.75
|
return 4.75
|
||||||
elseif multicraft.get_node({x=pos.x,y=pos.y,z=pos.z+1}).name == btop then
|
elseif multicraft.get_node({x=pos.x,y=pos.y,z=pos.z+1}).name == btop then
|
||||||
return 3.15
|
return 3.15
|
||||||
elseif multicraft.get_node({x=pos.x,y=pos.y,z=pos.z-1}).name == btop then
|
elseif multicraft.get_node({x=pos.x,y=pos.y,z=pos.z-1}).name == btop then
|
||||||
return 6.28
|
return 6.28
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function plock(start, max, tick, player, yaw)
|
function plock(start, max, tick, player, yaw)
|
||||||
if start+tick < max then
|
if start+tick < max then
|
||||||
player:set_look_pitch(-1.2)
|
player:set_look_pitch(-1.2)
|
||||||
player:set_look_yaw(yaw)
|
player:set_look_yaw(yaw)
|
||||||
multicraft.after(tick, plock, start+tick, max, tick, player, yaw)
|
multicraft.after(tick, plock, start+tick, max, tick, player, yaw)
|
||||||
else
|
else
|
||||||
player:set_look_pitch(0)
|
player:set_look_pitch(0)
|
||||||
if old_yaw ~= 0 then multicraft.after(0.1+tick, function() player:set_look_yaw(old_yaw) end) end
|
if old_yaw ~= 0 then multicraft.after(0.1+tick, function() player:set_look_yaw(old_yaw) end) end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function exit(pos)
|
function exit(pos)
|
||||||
local npos = multicraft.find_node_near(pos, 1, "beds:bed_bottom")
|
local npos = multicraft.find_node_near(pos, 1, "beds:bed_bottom")
|
||||||
if npos ~= nil then pos = npos end
|
if npos ~= nil then pos = npos end
|
||||||
if multicraft.get_node({x=pos.x+1,y=pos.y,z=pos.z}).name == "air" then
|
if multicraft.get_node({x=pos.x+1,y=pos.y,z=pos.z}).name == "air" then
|
||||||
return {x=pos.x+1,y=pos.y,z=pos.z}
|
return {x=pos.x+1,y=pos.y,z=pos.z}
|
||||||
elseif multicraft.get_node({x=pos.x-1,y=pos.y,z=pos.z}).name == "air" then
|
elseif multicraft.get_node({x=pos.x-1,y=pos.y,z=pos.z}).name == "air" then
|
||||||
return {x=pos.x-1,y=pos.y,z=pos.z}
|
return {x=pos.x-1,y=pos.y,z=pos.z}
|
||||||
elseif multicraft.get_node({x=pos.x,y=pos.y,z=pos.z+1}).name == "air" then
|
elseif multicraft.get_node({x=pos.x,y=pos.y,z=pos.z+1}).name == "air" then
|
||||||
return {x=pos.x,y=pos.y,z=pos.z+1}
|
return {x=pos.x,y=pos.y,z=pos.z+1}
|
||||||
elseif multicraft.get_node({x=pos.x,y=pos.y,z=pos.z-1}).name == "air" then
|
elseif multicraft.get_node({x=pos.x,y=pos.y,z=pos.z-1}).name == "air" then
|
||||||
return {x=pos.x,y=pos.y,z=pos.z-1}
|
return {x=pos.x,y=pos.y,z=pos.z-1}
|
||||||
else
|
else
|
||||||
return {x=pos.x,y=pos.y,z=pos.z}
|
return {x=pos.x,y=pos.y,z=pos.z}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
multicraft.register_node("beds:bed_bottom", {
|
multicraft.register_node("beds:bed_bottom", {
|
||||||
description = "Bed",
|
description = "Bed",
|
||||||
inventory_image = "beds_bed.png",
|
inventory_image = "beds_bed.png",
|
||||||
wield_image = "beds_bed.png",
|
wield_image = "beds_bed.png",
|
||||||
wield_scale = {x=0.8,y=2.5,z=1.3},
|
wield_scale = {x=0.8,y=2.5,z=1.3},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
tiles = {"beds_bed_top_bottom.png^[transformR90", "default_wood.png", "beds_bed_side_bottom_r.png", "beds_bed_side_bottom_r.png^[transformfx", "beds_bed_leer.png", "beds_bed_side_bottom.png"},
|
tiles = {"beds_bed_top_bottom.png^[transformR90", "default_wood.png", "beds_bed_side_bottom_r.png", "beds_bed_side_bottom_r.png^[transformfx", "beds_bed_leer.png", "beds_bed_side_bottom.png"},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3, decorative = 1},
|
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3, decorative = 1},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
|
fixed = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
|
||||||
},
|
},
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
|
fixed = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
after_place_node = function(pos, placer, itemstack)
|
after_place_node = function(pos, placer, itemstack)
|
||||||
local node = multicraft.get_node(pos)
|
local node = multicraft.get_node(pos)
|
||||||
local param2 = node.param2
|
local param2 = node.param2
|
||||||
local npos = {x=pos.x, y=pos.y, z=pos.z}
|
local npos = {x=pos.x, y=pos.y, z=pos.z}
|
||||||
if param2 == 0 then
|
if param2 == 0 then
|
||||||
npos.z = npos.z+1
|
npos.z = npos.z+1
|
||||||
elseif param2 == 1 then
|
elseif param2 == 1 then
|
||||||
npos.x = npos.x+1
|
npos.x = npos.x+1
|
||||||
elseif param2 == 2 then
|
elseif param2 == 2 then
|
||||||
npos.z = npos.z-1
|
npos.z = npos.z-1
|
||||||
elseif param2 == 3 then
|
elseif param2 == 3 then
|
||||||
npos.x = npos.x-1
|
npos.x = npos.x-1
|
||||||
end
|
end
|
||||||
if multicraft.registered_nodes[multicraft.get_node(npos).name].buildable_to == true and multicraft.get_node({x=npos.x, y=npos.y-1, z=npos.z}).name ~= "air" then
|
if multicraft.registered_nodes[multicraft.get_node(npos).name].buildable_to == true and multicraft.get_node({x=npos.x, y=npos.y-1, z=npos.z}).name ~= "air" then
|
||||||
multicraft.set_node(npos, {name="beds:bed_top", param2 = param2})
|
multicraft.set_node(npos, {name="beds:bed_top", param2 = param2})
|
||||||
else
|
else
|
||||||
multicraft.dig_node(pos)
|
multicraft.dig_node(pos)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_destruct = function(pos)
|
on_destruct = function(pos)
|
||||||
pos = multicraft.find_node_near(pos, 1, "beds:bed_top")
|
pos = multicraft.find_node_near(pos, 1, "beds:bed_top")
|
||||||
if pos ~= nil then multicraft.remove_node(pos) end
|
if pos ~= nil then multicraft.remove_node(pos) end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
if not clicker:is_player() then
|
if not clicker:is_player() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if multicraft.get_timeofday() > 0.2 and multicraft.get_timeofday() < 0.805 then
|
if multicraft.get_timeofday() > 0.2 and multicraft.get_timeofday() < 0.805 then
|
||||||
multicraft.chat_send_all("You can only sleep at night")
|
multicraft.chat_send_all("You can only sleep at night")
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
clicker:set_physics_override(0,0,0)
|
clicker:set_physics_override(0,0,0)
|
||||||
old_yaw = clicker:get_look_yaw()
|
old_yaw = clicker:get_look_yaw()
|
||||||
guy = clicker
|
guy = clicker
|
||||||
clicker:set_look_yaw(get_dir(pos))
|
clicker:set_look_yaw(get_dir(pos))
|
||||||
multicraft.chat_send_all("Good night")
|
multicraft.chat_send_all("Good night")
|
||||||
plock(0,2,0.1,clicker, get_dir(pos))
|
plock(0,2,0.1,clicker, get_dir(pos))
|
||||||
end
|
end
|
||||||
|
|
||||||
if not clicker:get_player_control().sneak then
|
if not clicker:get_player_control().sneak then
|
||||||
local meta = multicraft.get_meta(pos)
|
local meta = multicraft.get_meta(pos)
|
||||||
local param2 = node.param2
|
local param2 = node.param2
|
||||||
if param2 == 0 then
|
if param2 == 0 then
|
||||||
pos.z = pos.z+1
|
pos.z = pos.z+1
|
||||||
elseif param2 == 1 then
|
elseif param2 == 1 then
|
||||||
pos.x = pos.x+1
|
pos.x = pos.x+1
|
||||||
elseif param2 == 2 then
|
elseif param2 == 2 then
|
||||||
pos.z = pos.z-1
|
pos.z = pos.z-1
|
||||||
elseif param2 == 3 then
|
elseif param2 == 3 then
|
||||||
pos.x = pos.x-1
|
pos.x = pos.x-1
|
||||||
end
|
end
|
||||||
if clicker:get_player_name() == meta:get_string("player") then
|
if clicker:get_player_name() == meta:get_string("player") then
|
||||||
if param2 == 0 then
|
if param2 == 0 then
|
||||||
pos.x = pos.x-1
|
pos.x = pos.x-1
|
||||||
elseif param2 == 1 then
|
elseif param2 == 1 then
|
||||||
pos.z = pos.z+1
|
pos.z = pos.z+1
|
||||||
elseif param2 == 2 then
|
elseif param2 == 2 then
|
||||||
pos.x = pos.x+1
|
pos.x = pos.x+1
|
||||||
elseif param2 == 3 then
|
elseif param2 == 3 then
|
||||||
pos.z = pos.z-1
|
pos.z = pos.z-1
|
||||||
end
|
end
|
||||||
pos.y = pos.y-0.5
|
pos.y = pos.y-0.5
|
||||||
clicker:setpos(pos)
|
clicker:setpos(pos)
|
||||||
meta:set_string("player", "")
|
meta:set_string("player", "")
|
||||||
player_in_bed = player_in_bed-1
|
player_in_bed = player_in_bed-1
|
||||||
elseif meta:get_string("player") == "" then
|
elseif meta:get_string("player") == "" then
|
||||||
pos.y = pos.y-0.5
|
pos.y = pos.y-0.5
|
||||||
clicker:setpos(pos)
|
clicker:setpos(pos)
|
||||||
meta:set_string("player", clicker:get_player_name())
|
meta:set_string("player", clicker:get_player_name())
|
||||||
player_in_bed = player_in_bed+1
|
player_in_bed = player_in_bed+1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
multicraft.register_node("beds:bed_top", {
|
multicraft.register_node("beds:bed_top", {
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
tiles = {"beds_bed_top_top.png^[transformR90", "beds_bed_leer.png", "beds_bed_side_top_r.png", "beds_bed_side_top_r.png^[transformfx", "beds_bed_side_top.png", "beds_bed_leer.png"},
|
tiles = {"beds_bed_top_top.png^[transformR90", "beds_bed_leer.png", "beds_bed_side_top_r.png", "beds_bed_side_top_r.png^[transformfx", "beds_bed_side_top.png", "beds_bed_leer.png"},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
|
fixed = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
|
||||||
},
|
},
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {0, 0, 0, 0, 0, 0},
|
fixed = {0, 0, 0, 0, 0, 0},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
multicraft.register_alias("beds:bed", "beds:bed_bottom")
|
multicraft.register_alias("beds:bed", "beds:bed_bottom")
|
||||||
|
|
||||||
multicraft.register_craft({
|
multicraft.register_craft({
|
||||||
output = "beds:bed",
|
output = "beds:bed",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"group:wool", "group:wool", "group:wool", },
|
{"group:wool", "group:wool", "group:wool", },
|
||||||
{"group:wood", "group:wood", "group:wood", }
|
{"group:wood", "group:wood", "group:wood", }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
beds_player_spawns = {}
|
beds_player_spawns = {}
|
||||||
local file = io.open(multicraft.get_worldpath().."/beds_player_spawns", "r")
|
local file = io.open(multicraft.get_worldpath().."/beds_player_spawns", "r")
|
||||||
if file then
|
if file then
|
||||||
beds_player_spawns = multicraft.deserialize(file:read("*all"))
|
beds_player_spawns = multicraft.deserialize(file:read("*all"))
|
||||||
file:close()
|
file:close()
|
||||||
end
|
end
|
||||||
|
|
||||||
local timer = 0
|
local timer = 0
|
||||||
local wait = false
|
local wait = false
|
||||||
multicraft.register_globalstep(function(dtime)
|
multicraft.register_globalstep(function(dtime)
|
||||||
if timer<2 then
|
if timer<2 then
|
||||||
timer = timer+dtime
|
timer = timer+dtime
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
timer = 0
|
timer = 0
|
||||||
|
|
||||||
local players = #multicraft.get_connected_players()
|
local players = #multicraft.get_connected_players()
|
||||||
if players == player_in_bed and players ~= 0 then
|
if players == player_in_bed and players ~= 0 then
|
||||||
if multicraft.get_timeofday() < 0.2 or multicraft.get_timeofday() > 0.805 then
|
if multicraft.get_timeofday() < 0.2 or multicraft.get_timeofday() > 0.805 then
|
||||||
if not wait then
|
if not wait then
|
||||||
multicraft.after(2, function()
|
multicraft.after(2, function()
|
||||||
multicraft.set_timeofday(0.23)
|
multicraft.set_timeofday(0.23)
|
||||||
wait = false
|
wait = false
|
||||||
guy:set_physics_override(1,1,1)
|
guy:set_physics_override(1,1,1)
|
||||||
guy:setpos(exit(guy:getpos()))
|
guy:setpos(exit(guy:getpos()))
|
||||||
|
|
||||||
end)
|
end)
|
||||||
wait = true
|
wait = true
|
||||||
for _,player in ipairs(multicraft.get_connected_players()) do
|
for _,player in ipairs(multicraft.get_connected_players()) do
|
||||||
beds_player_spawns[player:get_player_name()] = player:getpos()
|
beds_player_spawns[player:get_player_name()] = player:getpos()
|
||||||
end
|
end
|
||||||
local file = io.open(multicraft.get_worldpath().."/beds_player_spawns", "w")
|
local file = io.open(multicraft.get_worldpath().."/beds_player_spawns", "w")
|
||||||
if file then
|
if file then
|
||||||
file:write(multicraft.serialize(beds_player_spawns))
|
file:write(multicraft.serialize(beds_player_spawns))
|
||||||
file:close()
|
file:close()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
multicraft.register_on_respawnplayer(function(player)
|
multicraft.register_on_respawnplayer(function(player)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if beds_player_spawns[name] then
|
if beds_player_spawns[name] then
|
||||||
player:setpos(beds_player_spawns[name])
|
player:setpos(beds_player_spawns[name])
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
multicraft.register_abm({
|
multicraft.register_abm({
|
||||||
nodenames = {"beds:bed_bottom"},
|
nodenames = {"beds:bed_bottom"},
|
||||||
interval = 1,
|
interval = 1,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
local meta = multicraft.get_meta(pos)
|
local meta = multicraft.get_meta(pos)
|
||||||
if meta:get_string("player") ~= "" then
|
if meta:get_string("player") ~= "" then
|
||||||
local param2 = node.param2
|
local param2 = node.param2
|
||||||
if param2 == 0 then
|
if param2 == 0 then
|
||||||
pos.z = pos.z+1
|
pos.z = pos.z+1
|
||||||
elseif param2 == 1 then
|
elseif param2 == 1 then
|
||||||
pos.x = pos.x+1
|
pos.x = pos.x+1
|
||||||
elseif param2 == 2 then
|
elseif param2 == 2 then
|
||||||
pos.z = pos.z-1
|
pos.z = pos.z-1
|
||||||
elseif param2 == 3 then
|
elseif param2 == 3 then
|
||||||
pos.x = pos.x-1
|
pos.x = pos.x-1
|
||||||
end
|
end
|
||||||
local player = multicraft.get_player_by_name(meta:get_string("player"))
|
local player = multicraft.get_player_by_name(meta:get_string("player"))
|
||||||
if player == nil then
|
if player == nil then
|
||||||
meta:set_string("player", "")
|
meta:set_string("player", "")
|
||||||
player_in_bed = player_in_bed-1
|
player_in_bed = player_in_bed-1
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local player_pos = player:getpos()
|
local player_pos = player:getpos()
|
||||||
player_pos.x = math.floor(0.5+player_pos.x)
|
player_pos.x = math.floor(0.5+player_pos.x)
|
||||||
player_pos.y = math.floor(0.5+player_pos.y)
|
player_pos.y = math.floor(0.5+player_pos.y)
|
||||||
player_pos.z = math.floor(0.5+player_pos.z)
|
player_pos.z = math.floor(0.5+player_pos.z)
|
||||||
if pos.x ~= player_pos.x or pos.y ~= player_pos.y or pos.z ~= player_pos.z then
|
if pos.x ~= player_pos.x or pos.y ~= player_pos.y or pos.z ~= player_pos.z then
|
||||||
meta:set_string("player", "")
|
meta:set_string("player", "")
|
||||||
player_in_bed = player_in_bed-1
|
player_in_bed = player_in_bed-1
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
if multicraft.setting_get("log_mods") then
|
if multicraft.setting_get("log_mods") then
|
||||||
multicraft.log("action", "beds loaded")
|
multicraft.log("action", "beds loaded")
|
||||||
end
|
end
|
|
@ -1,170 +1,170 @@
|
||||||
if not multicraft.get_modpath("check") then os.exit() end
|
if not multicraft.get_modpath("check") then os.exit() end
|
||||||
if not default.multicraft_is_variable_is_a_part_of_multicraft_subgame_and_copying_it_means_you_use_our_code_so_we_become_contributors_of_your_project then exit() end
|
if not default.multicraft_is_variable_is_a_part_of_multicraft_subgame_and_copying_it_means_you_use_our_code_so_we_become_contributors_of_your_project then exit() end
|
||||||
--[[
|
--[[
|
||||||
#!#!#!#Cake mod created by Jordan4ibanez#!#!#
|
#!#!#!#Cake mod created by Jordan4ibanez#!#!#
|
||||||
#!#!#!#Released under CC Attribution-ShareAlike 3.0 Unported #!#!#
|
#!#!#!#Released under CC Attribution-ShareAlike 3.0 Unported #!#!#
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
cake_texture = {"cake_top.png","cake_bottom.png","cake_inner.png","cake_side.png","cake_side.png","cake_side.png"}
|
cake_texture = {"cake_top.png","cake_bottom.png","cake_inner.png","cake_side.png","cake_side.png","cake_side.png"}
|
||||||
slice_1 = { -7/16, -8/16, -7/16, -5/16, 0/16, 7/16}
|
slice_1 = { -7/16, -8/16, -7/16, -5/16, 0/16, 7/16}
|
||||||
slice_2 = { -7/16, -8/16, -7/16, -2/16, 0/16, 7/16}
|
slice_2 = { -7/16, -8/16, -7/16, -2/16, 0/16, 7/16}
|
||||||
slice_3 = { -7/16, -8/16, -7/16, 1/16, 0/16, 7/16}
|
slice_3 = { -7/16, -8/16, -7/16, 1/16, 0/16, 7/16}
|
||||||
slice_4 = { -7/16, -8/16, -7/16, 3/16, 0/16, 7/16}
|
slice_4 = { -7/16, -8/16, -7/16, 3/16, 0/16, 7/16}
|
||||||
slice_5 = { -7/16, -8/16, -7/16, 5/16, 0/16, 7/16}
|
slice_5 = { -7/16, -8/16, -7/16, 5/16, 0/16, 7/16}
|
||||||
slice_6 = { -7/16, -8/16, -7/16, 7/16, 0/16, 7/16}
|
slice_6 = { -7/16, -8/16, -7/16, 7/16, 0/16, 7/16}
|
||||||
|
|
||||||
multicraft.register_craft({
|
multicraft.register_craft({
|
||||||
output = "cake:cake",
|
output = "cake:cake",
|
||||||
recipe = {
|
recipe = {
|
||||||
{'bucket:bucket_water', 'bucket:bucket_water', 'bucket:bucket_water'},
|
{'bucket:bucket_water', 'bucket:bucket_water', 'bucket:bucket_water'},
|
||||||
{'default:sugar', 'default:leaves', 'default:sugar'},
|
{'default:sugar', 'default:leaves', 'default:sugar'},
|
||||||
{'farming:wheat_harvested', 'farming:wheat_harvested', 'farming:wheat_harvested'},
|
{'farming:wheat_harvested', 'farming:wheat_harvested', 'farming:wheat_harvested'},
|
||||||
},
|
},
|
||||||
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}},
|
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}},
|
||||||
})
|
})
|
||||||
|
|
||||||
multicraft.register_node("cake:cake", {
|
multicraft.register_node("cake:cake", {
|
||||||
description = "Cake",
|
description = "Cake",
|
||||||
tiles = {"cake_top.png","cake_bottom.png","cake_side.png","cake_side.png","cake_side.png","cake_side.png"},
|
tiles = {"cake_top.png","cake_bottom.png","cake_side.png","cake_side.png","cake_side.png","cake_side.png"},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = slice_6
|
fixed = slice_6
|
||||||
},
|
},
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = slice_6
|
fixed = slice_6
|
||||||
},
|
},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
groups = {crumbly=3,falling_node=1, foodstuffs = 1},
|
groups = {crumbly=3,falling_node=1, foodstuffs = 1},
|
||||||
drop = '',
|
drop = '',
|
||||||
--legacy_mineral = true,
|
--legacy_mineral = true,
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
if clicker:get_hp() < 20 then
|
if clicker:get_hp() < 20 then
|
||||||
clicker:set_hp(clicker:get_hp()+2)
|
clicker:set_hp(clicker:get_hp()+2)
|
||||||
multicraft.add_node(pos,{type="node",name="cake:cake_5",param2=param2})
|
multicraft.add_node(pos,{type="node",name="cake:cake_5",param2=param2})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
multicraft.register_node("cake:cake_5", {
|
multicraft.register_node("cake:cake_5", {
|
||||||
description = "Cake [5 Slices Left]",
|
description = "Cake [5 Slices Left]",
|
||||||
tiles = cake_texture,
|
tiles = cake_texture,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = slice_5
|
fixed = slice_5
|
||||||
},
|
},
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = slice_5
|
fixed = slice_5
|
||||||
},
|
},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
|
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
|
||||||
drop = '',
|
drop = '',
|
||||||
--legacy_mineral = true,
|
--legacy_mineral = true,
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
if clicker:get_hp() < 20 then
|
if clicker:get_hp() < 20 then
|
||||||
clicker:set_hp(clicker:get_hp()+2)
|
clicker:set_hp(clicker:get_hp()+2)
|
||||||
multicraft.add_node(pos,{type="node",name="cake:cake_4",param2=param2})
|
multicraft.add_node(pos,{type="node",name="cake:cake_4",param2=param2})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
multicraft.register_node("cake:cake_4", {
|
multicraft.register_node("cake:cake_4", {
|
||||||
description = "Cake [4 Slices Left]",
|
description = "Cake [4 Slices Left]",
|
||||||
tiles = cake_texture,
|
tiles = cake_texture,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = slice_4
|
fixed = slice_4
|
||||||
},
|
},
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = slice_4
|
fixed = slice_4
|
||||||
},
|
},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
|
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
|
||||||
drop = '',
|
drop = '',
|
||||||
--legacy_mineral = true,
|
--legacy_mineral = true,
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
if clicker:get_hp() < 20 then
|
if clicker:get_hp() < 20 then
|
||||||
clicker:set_hp(clicker:get_hp()+2)
|
clicker:set_hp(clicker:get_hp()+2)
|
||||||
multicraft.add_node(pos,{type="node",name="cake:cake_3",param2=param2})
|
multicraft.add_node(pos,{type="node",name="cake:cake_3",param2=param2})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
multicraft.register_node("cake:cake_3", {
|
multicraft.register_node("cake:cake_3", {
|
||||||
description = "Cake [3 Slices Left]",
|
description = "Cake [3 Slices Left]",
|
||||||
tiles = cake_texture,
|
tiles = cake_texture,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = slice_3
|
fixed = slice_3
|
||||||
},
|
},
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = slice_3
|
fixed = slice_3
|
||||||
},
|
},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
|
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
|
||||||
drop = '',
|
drop = '',
|
||||||
--legacy_mineral = true,
|
--legacy_mineral = true,
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
if clicker:get_hp() < 20 then
|
if clicker:get_hp() < 20 then
|
||||||
clicker:set_hp(clicker:get_hp()+2)
|
clicker:set_hp(clicker:get_hp()+2)
|
||||||
multicraft.add_node(pos,{type="node",name="cake:cake_2",param2=param2})
|
multicraft.add_node(pos,{type="node",name="cake:cake_2",param2=param2})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
multicraft.register_node("cake:cake_2", {
|
multicraft.register_node("cake:cake_2", {
|
||||||
description = "Cake [2 Slices Left]",
|
description = "Cake [2 Slices Left]",
|
||||||
tiles = cake_texture,
|
tiles = cake_texture,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = slice_2
|
fixed = slice_2
|
||||||
},
|
},
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = slice_2
|
fixed = slice_2
|
||||||
},
|
},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
|
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
|
||||||
drop = '',
|
drop = '',
|
||||||
--legacy_mineral = true,
|
--legacy_mineral = true,
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
if clicker:get_hp() < 20 then
|
if clicker:get_hp() < 20 then
|
||||||
clicker:set_hp(clicker:get_hp()+2)
|
clicker:set_hp(clicker:get_hp()+2)
|
||||||
multicraft.add_node(pos,{type="node",name="cake:cake_1",param2=param2})
|
multicraft.add_node(pos,{type="node",name="cake:cake_1",param2=param2})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
multicraft.register_node("cake:cake_1", {
|
multicraft.register_node("cake:cake_1", {
|
||||||
description = "Cake [1 Slice Left]",
|
description = "Cake [1 Slice Left]",
|
||||||
tiles = cake_texture,
|
tiles = cake_texture,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = slice_1
|
fixed = slice_1
|
||||||
},
|
},
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = slice_1
|
fixed = slice_1
|
||||||
},
|
},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
|
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
|
||||||
drop = '',
|
drop = '',
|
||||||
--legacy_mineral = true,
|
--legacy_mineral = true,
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
if clicker:get_hp() < 20 then
|
if clicker:get_hp() < 20 then
|
||||||
clicker:set_hp(clicker:get_hp()+2)
|
clicker:set_hp(clicker:get_hp()+2)
|
||||||
multicraft.remove_node(pos)
|
multicraft.remove_node(pos)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
|
@ -1,24 +1,24 @@
|
||||||
INFO_BLANK = "To find out more about certain items type the command '/info' with the params 'update', 'version', 'creative', 'suprise'"
|
INFO_BLANK = "To find out more about certain items type the command '/info' with the params 'update', 'version', 'creative', 'suprise'"
|
||||||
INFO_VERSION = "0.1"
|
INFO_VERSION = "0.1"
|
||||||
INFO_UPDATE = "I think nether ... but lot of monster before"
|
INFO_UPDATE = "I think nether ... but lot of monster before"
|
||||||
INFO_CREATIVE = "Type the command '/gamemode ' and use the params '0' or 's' for survival and '1' or 'c' for creative"
|
INFO_CREATIVE = "Type the command '/gamemode ' and use the params '0' or 's' for survival and '1' or 'c' for creative"
|
||||||
|
|
||||||
|
|
||||||
multicraft.register_chatcommand("info", {
|
multicraft.register_chatcommand("info", {
|
||||||
params = "(blank) | update | version | creative",
|
params = "(blank) | update | version | creative",
|
||||||
description = "To get info on stuff.",
|
description = "To get info on stuff.",
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
if param == "" then
|
if param == "" then
|
||||||
multicraft.chat_send_player(name, INFO_BLANK)
|
multicraft.chat_send_player(name, INFO_BLANK)
|
||||||
end
|
end
|
||||||
if param == "update" then
|
if param == "update" then
|
||||||
multicraft.chat_send_player(name, INFO_UPDATE)
|
multicraft.chat_send_player(name, INFO_UPDATE)
|
||||||
end
|
end
|
||||||
if param == "version" then
|
if param == "version" then
|
||||||
multicraft.chat_send_player(name, INFO_VERSION)
|
multicraft.chat_send_player(name, INFO_VERSION)
|
||||||
end
|
end
|
||||||
if param == "creative" then
|
if param == "creative" then
|
||||||
multicraft.chat_send_player(name, INFO_CREATIVE)
|
multicraft.chat_send_player(name, INFO_CREATIVE)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
|
@ -1,26 +1,26 @@
|
||||||
multicraft.register_chatcommand("kit", {
|
multicraft.register_chatcommand("kit", {
|
||||||
params = "",
|
params = "",
|
||||||
description = "Add a Kit to player",
|
description = "Add a Kit to player",
|
||||||
privs = {},
|
privs = {},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
if param == "" then
|
if param == "" then
|
||||||
multicraft.chat_send_player(name, "No kit selected use ... Aviable : noob , pvp")
|
multicraft.chat_send_player(name, "No kit selected use ... Aviable : noob , pvp")
|
||||||
end
|
end
|
||||||
local receiverref = core.get_player_by_name(name)
|
local receiverref = core.get_player_by_name(name)
|
||||||
if param == "noob" then
|
if param == "noob" then
|
||||||
receiverref:get_inventory():add_item('main', 'default:pick_steel')
|
receiverref:get_inventory():add_item('main', 'default:pick_steel')
|
||||||
receiverref:get_inventory():add_item('main', 'default:shovel_steel')
|
receiverref:get_inventory():add_item('main', 'default:shovel_steel')
|
||||||
receiverref:get_inventory():add_item('main', 'default:torch 16')
|
receiverref:get_inventory():add_item('main', 'default:torch 16')
|
||||||
receiverref:get_inventory():add_item('main', 'default:axe_steel')
|
receiverref:get_inventory():add_item('main', 'default:axe_steel')
|
||||||
receiverref:get_inventory():add_item('main', 'default:cobble 64')
|
receiverref:get_inventory():add_item('main', 'default:cobble 64')
|
||||||
end
|
end
|
||||||
if param == "pvp" then
|
if param == "pvp" then
|
||||||
receiverref:get_inventory():add_item('main', 'default:sword_diamond')
|
receiverref:get_inventory():add_item('main', 'default:sword_diamond')
|
||||||
receiverref:get_inventory():add_item('main', 'default:apple_gold 64')
|
receiverref:get_inventory():add_item('main', 'default:apple_gold 64')
|
||||||
receiverref:get_inventory():add_item('main', '3d_armor:helmet_diamond')
|
receiverref:get_inventory():add_item('main', '3d_armor:helmet_diamond')
|
||||||
receiverref:get_inventory():add_item('main', '3d_armor:chestplate_diamond')
|
receiverref:get_inventory():add_item('main', '3d_armor:chestplate_diamond')
|
||||||
receiverref:get_inventory():add_item('main', '3d_armor:leggings_diamond')
|
receiverref:get_inventory():add_item('main', '3d_armor:leggings_diamond')
|
||||||
receiverref:get_inventory():add_item('main', '3d_armor:boots_diamond')
|
receiverref:get_inventory():add_item('main', '3d_armor:boots_diamond')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
|
@ -1,28 +1,28 @@
|
||||||
|
|
||||||
multicraft.register_chatcommand("night", {
|
multicraft.register_chatcommand("night", {
|
||||||
params = "",
|
params = "",
|
||||||
description = "Make the night",
|
description = "Make the night",
|
||||||
privs = {settime = true},
|
privs = {settime = true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local player = multicraft.get_player_by_name(name)
|
local player = multicraft.get_player_by_name(name)
|
||||||
if not player then
|
if not player then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
multicraft.set_timeofday(0.22)
|
multicraft.set_timeofday(0.22)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
multicraft.register_chatcommand("day", {
|
multicraft.register_chatcommand("day", {
|
||||||
params = "",
|
params = "",
|
||||||
description = "Make the day wakeup",
|
description = "Make the day wakeup",
|
||||||
privs = {settime = true},
|
privs = {settime = true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local player = multicraft.get_player_by_name(name)
|
local player = multicraft.get_player_by_name(name)
|
||||||
if not player then
|
if not player then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
multicraft.set_timeofday(0.6)
|
multicraft.set_timeofday(0.6)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
vanished_players = {}
|
vanished_players = {}
|
||||||
|
|
||||||
multicraft.register_privilege("vanish", "Allow to use /vanish command")
|
multicraft.register_privilege("vanish", "Allow to use /vanish command")
|
||||||
|
|
||||||
multicraft.register_chatcommand("vanish", {
|
multicraft.register_chatcommand("vanish", {
|
||||||
params = "",
|
params = "",
|
||||||
description = "Make user invisible at eye of all",
|
description = "Make user invisible at eye of all",
|
||||||
privs = {vanish = true},
|
privs = {vanish = true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local prop
|
local prop
|
||||||
vanished_players[name] = not vanished_players[name]
|
vanished_players[name] = not vanished_players[name]
|
||||||
|
|
||||||
if vanished_players[name] then
|
if vanished_players[name] then
|
||||||
prop = {visual_size = {x=0, y=0}, collisionbox = {0,0,0,0,0,0}}
|
prop = {visual_size = {x=0, y=0}, collisionbox = {0,0,0,0,0,0}}
|
||||||
else
|
else
|
||||||
-- default player size
|
-- default player size
|
||||||
prop = {visual_size = {x=1, y=1},
|
prop = {visual_size = {x=1, y=1},
|
||||||
collisionbox = {-0.35, -1, -0.35, 0.35, 1, 0.35}}
|
collisionbox = {-0.35, -1, -0.35, 0.35, 1, 0.35}}
|
||||||
end
|
end
|
||||||
|
|
||||||
multicraft.get_player_by_name(name):set_properties(prop)
|
multicraft.get_player_by_name(name):set_properties(prop)
|
||||||
end
|
end
|
||||||
})
|
})
|
|
@ -1,31 +1,31 @@
|
||||||
multicraft mod "Crafting"
|
multicraft mod "Crafting"
|
||||||
=======================
|
=======================
|
||||||
version: 2.0.1
|
version: 2.0.1
|
||||||
|
|
||||||
License of source code and Textures: WTFPL
|
License of source code and Textures: WTFPL
|
||||||
------------------------------------
|
------------------------------------
|
||||||
Copyright (c) 2013-2014 BlockMen
|
Copyright (c) 2013-2014 BlockMen
|
||||||
|
|
||||||
This program is free software. It comes without any warranty, to
|
This program is free software. It comes without any warranty, to
|
||||||
the extent permitted by applicable law. You can redistribute it
|
the extent permitted by applicable law. You can redistribute it
|
||||||
and/or modify it under the terms of the Do What The Fuck You Want
|
and/or modify it under the terms of the Do What The Fuck You Want
|
||||||
To Public License, Version 2, as published by Sam Hocevar. See
|
To Public License, Version 2, as published by Sam Hocevar. See
|
||||||
http://sam.zoy.org/wtfpl/COPYING for more details.
|
http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||||
|
|
||||||
|
|
||||||
--USING the mod--
|
--USING the mod--
|
||||||
=================
|
=================
|
||||||
This mod changes the players inventory (survival and creative) with more slots (9*4 instead of 8*4)
|
This mod changes the players inventory (survival and creative) with more slots (9*4 instead of 8*4)
|
||||||
Like known from Minecraft you have a 2x2 crafting grid at inventory now. Furthermore a categorized creative
|
Like known from Minecraft you have a 2x2 crafting grid at inventory now. Furthermore a categorized creative
|
||||||
inventory and a support for stu's 3d armor mod (To use the armor and a preview of player).
|
inventory and a support for stu's 3d armor mod (To use the armor and a preview of player).
|
||||||
|
|
||||||
Left items in the crafting slots are dropped infront of you.
|
Left items in the crafting slots are dropped infront of you.
|
||||||
|
|
||||||
Workbench
|
Workbench
|
||||||
=========
|
=========
|
||||||
With following recipe you craft a workbench (aka crafting table):
|
With following recipe you craft a workbench (aka crafting table):
|
||||||
|
|
||||||
wood wood
|
wood wood
|
||||||
wood wood
|
wood wood
|
||||||
|
|
||||||
The workbench has a 3x3 crafting grid, that allows to use all recipes.
|
The workbench has a 3x3 crafting grid, that allows to use all recipes.
|
|
@ -1,34 +1,34 @@
|
||||||
multicraft mod "Crafting"
|
multicraft mod "Crafting"
|
||||||
=======================
|
=======================
|
||||||
Version: 2.0.1
|
Version: 2.0.1
|
||||||
|
|
||||||
License of source code and Textures: WTFPL
|
License of source code and Textures: WTFPL
|
||||||
------------------------------------
|
------------------------------------
|
||||||
copyright (c) 2013-2014 by BlockMen
|
copyright (c) 2013-2014 by BlockMen
|
||||||
|
|
||||||
This program is free software. It comes without any warranty, to
|
This program is free software. It comes without any warranty, to
|
||||||
the extent permitted by applicable law. You can redistribute it
|
the extent permitted by applicable law. You can redistribute it
|
||||||
and/or modify it under the terms of the Do What The Fuck You Want
|
and/or modify it under the terms of the Do What The Fuck You Want
|
||||||
To Public License, Version 2, as published by Sam Hocevar. See
|
To Public License, Version 2, as published by Sam Hocevar. See
|
||||||
http://sam.zoy.org/wtfpl/COPYING for more details.
|
http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||||
|
|
||||||
|
|
||||||
--USING the mod--
|
--USING the mod--
|
||||||
=================
|
=================
|
||||||
|
|
||||||
This mod changes the players inventory (survival and creative) with more slots (9*4 instead of 8*4)
|
This mod changes the players inventory (survival and creative) with more slots (9*4 instead of 8*4)
|
||||||
Like known from Minecraft you have a 2x2 crafting grid at inventory now. Furthermore a categorized creative
|
Like known from Minecraft you have a 2x2 crafting grid at inventory now. Furthermore a categorized creative
|
||||||
inventory and a support for stu's 3d armor mod (To use the armor and a preview of player).
|
inventory and a support for stu's 3d armor mod (To use the armor and a preview of player).
|
||||||
|
|
||||||
Left items in the crafting slots are dropped infront of you.
|
Left items in the crafting slots are dropped infront of you.
|
||||||
|
|
||||||
|
|
||||||
Workbench
|
Workbench
|
||||||
_________
|
_________
|
||||||
|
|
||||||
With following recipe you craft a workbench (aka crafting table):
|
With following recipe you craft a workbench (aka crafting table):
|
||||||
|
|
||||||
wood wood
|
wood wood
|
||||||
wood wood
|
wood wood
|
||||||
|
|
||||||
The workbench has a 3x3 crafting grid, that allows to use all recipes.
|
The workbench has a 3x3 crafting grid, that allows to use all recipes.
|
|
@ -1,397 +1,397 @@
|
||||||
crafting = {}
|
crafting = {}
|
||||||
crafting.creative_inventory_size = 0
|
crafting.creative_inventory_size = 0
|
||||||
crafting.start_is = {}
|
crafting.start_is = {}
|
||||||
crafting.pages = {}
|
crafting.pages = {}
|
||||||
|
|
||||||
function init()
|
function init()
|
||||||
local inv = multicraft.create_detached_inventory("creative", {
|
local inv = multicraft.create_detached_inventory("creative", {
|
||||||
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||||
if multicraft.setting_getbool("creative_mode") then
|
if multicraft.setting_getbool("creative_mode") then
|
||||||
return count
|
return count
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
allow_put = function(inv, listname, index, stack, player)
|
allow_put = function(inv, listname, index, stack, player)
|
||||||
return 0
|
return 0
|
||||||
end,
|
end,
|
||||||
allow_take = function(inv, listname, index, stack, player)
|
allow_take = function(inv, listname, index, stack, player)
|
||||||
if multicraft.setting_getbool("creative_mode") then
|
if multicraft.setting_getbool("creative_mode") then
|
||||||
return -1
|
return -1
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||||
end,
|
end,
|
||||||
on_put = function(inv, listname, index, stack, player)
|
on_put = function(inv, listname, index, stack, player)
|
||||||
end,
|
end,
|
||||||
on_take = function(inv, listname, index, stack, player)
|
on_take = function(inv, listname, index, stack, player)
|
||||||
print(player:get_player_name().." takes item from creative inventory; listname="..dump(listname)..", index="..dump(index)..", stack="..dump(stack))
|
print(player:get_player_name().." takes item from creative inventory; listname="..dump(listname)..", index="..dump(index)..", stack="..dump(stack))
|
||||||
if stack then
|
if stack then
|
||||||
print("stack:get_name()="..dump(stack:get_name())..", stack:get_count()="..dump(stack:get_count()))
|
print("stack:get_name()="..dump(stack:get_name())..", stack:get_count()="..dump(stack:get_count()))
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
set_inv("all")
|
set_inv("all")
|
||||||
end
|
end
|
||||||
|
|
||||||
function set_inv(filter, player)
|
function set_inv(filter, player)
|
||||||
local inv = multicraft.get_inventory({type="detached", name="creative"})
|
local inv = multicraft.get_inventory({type="detached", name="creative"})
|
||||||
inv:set_size("main", 0)
|
inv:set_size("main", 0)
|
||||||
local creative_list = {}
|
local creative_list = {}
|
||||||
for name,def in pairs(multicraft.registered_items) do
|
for name,def in pairs(multicraft.registered_items) do
|
||||||
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0) and def.description and def.description ~= "" then
|
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0) and def.description and def.description ~= "" then
|
||||||
if filter ~= "" then
|
if filter ~= "" then
|
||||||
if filter == "#blocks" then
|
if filter == "#blocks" then
|
||||||
if multicraft.registered_items[def.name]
|
if multicraft.registered_items[def.name]
|
||||||
and multicraft.registered_items[def.name].groups
|
and multicraft.registered_items[def.name].groups
|
||||||
and multicraft.registered_items[def.name].groups.building
|
and multicraft.registered_items[def.name].groups.building
|
||||||
then
|
then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "#deco" then
|
elseif filter == "#deco" then
|
||||||
if multicraft.registered_items[def.name]
|
if multicraft.registered_items[def.name]
|
||||||
and multicraft.registered_items[def.name].groups
|
and multicraft.registered_items[def.name].groups
|
||||||
and multicraft.registered_items[def.name].groups.decorative
|
and multicraft.registered_items[def.name].groups.decorative
|
||||||
then
|
then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "#mese" then
|
elseif filter == "#mese" then
|
||||||
if multicraft.registered_items[def.name]
|
if multicraft.registered_items[def.name]
|
||||||
and multicraft.registered_items[def.name].groups
|
and multicraft.registered_items[def.name].groups
|
||||||
and multicraft.registered_items[def.name].groups.mese
|
and multicraft.registered_items[def.name].groups.mese
|
||||||
then
|
then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "#rail" then
|
elseif filter == "#rail" then
|
||||||
if multicraft.registered_items[def.name]
|
if multicraft.registered_items[def.name]
|
||||||
and multicraft.registered_items[def.name].groups
|
and multicraft.registered_items[def.name].groups
|
||||||
and multicraft.registered_items[def.name].groups.rail
|
and multicraft.registered_items[def.name].groups.rail
|
||||||
then
|
then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "#misc" then
|
elseif filter == "#misc" then
|
||||||
if multicraft.registered_items[def.name]
|
if multicraft.registered_items[def.name]
|
||||||
and multicraft.registered_items[def.name].groups
|
and multicraft.registered_items[def.name].groups
|
||||||
and multicraft.registered_items[def.name].groups.misc
|
and multicraft.registered_items[def.name].groups.misc
|
||||||
then
|
then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "#food" then
|
elseif filter == "#food" then
|
||||||
if multicraft.registered_items[def.name]
|
if multicraft.registered_items[def.name]
|
||||||
and multicraft.registered_items[def.name].groups
|
and multicraft.registered_items[def.name].groups
|
||||||
and multicraft.registered_items[def.name].groups.foodstuffs
|
and multicraft.registered_items[def.name].groups.foodstuffs
|
||||||
then
|
then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "#tools" then
|
elseif filter == "#tools" then
|
||||||
if multicraft.registered_items[def.name]
|
if multicraft.registered_items[def.name]
|
||||||
and multicraft.registered_items[def.name].groups
|
and multicraft.registered_items[def.name].groups
|
||||||
and multicraft.registered_items[def.name].groups.tools
|
and multicraft.registered_items[def.name].groups.tools
|
||||||
then
|
then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "#combat" then
|
elseif filter == "#combat" then
|
||||||
if multicraft.registered_items[def.name]
|
if multicraft.registered_items[def.name]
|
||||||
and multicraft.registered_items[def.name].groups
|
and multicraft.registered_items[def.name].groups
|
||||||
and multicraft.registered_items[def.name].groups.combat
|
and multicraft.registered_items[def.name].groups.combat
|
||||||
then
|
then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "#matr" then
|
elseif filter == "#matr" then
|
||||||
if multicraft.registered_items[def.name]
|
if multicraft.registered_items[def.name]
|
||||||
and multicraft.registered_items[def.name].groups
|
and multicraft.registered_items[def.name].groups
|
||||||
and multicraft.registered_items[def.name].groups.materials
|
and multicraft.registered_items[def.name].groups.materials
|
||||||
then
|
then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "#brew" then
|
elseif filter == "#brew" then
|
||||||
if multicraft.registered_items[def.name]
|
if multicraft.registered_items[def.name]
|
||||||
and multicraft.registered_items[def.name].groups
|
and multicraft.registered_items[def.name].groups
|
||||||
and multicraft.registered_items[def.name].groups.brewing
|
and multicraft.registered_items[def.name].groups.brewing
|
||||||
then
|
then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
elseif filter == "all" then
|
elseif filter == "all" then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
else --for all other
|
else --for all other
|
||||||
if string.find(string.lower(def.name), filter) or string.find(string.lower(def.description), filter) then
|
if string.find(string.lower(def.name), filter) or string.find(string.lower(def.description), filter) then
|
||||||
table.insert(creative_list, name)
|
table.insert(creative_list, name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.sort(creative_list)
|
table.sort(creative_list)
|
||||||
inv:set_size("main", #creative_list)
|
inv:set_size("main", #creative_list)
|
||||||
for _,itemstring in ipairs(creative_list) do
|
for _,itemstring in ipairs(creative_list) do
|
||||||
inv:add_item("main", ItemStack(itemstring))
|
inv:add_item("main", ItemStack(itemstring))
|
||||||
end
|
end
|
||||||
crafting.creative_inventory_size = #creative_list
|
crafting.creative_inventory_size = #creative_list
|
||||||
--print("creative inventory size: "..dump(crafting.creative_inventory_size))
|
--print("creative inventory size: "..dump(crafting.creative_inventory_size))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Create the trash field
|
-- Create the trash field
|
||||||
local trash = multicraft.create_detached_inventory("creative_trash", {
|
local trash = multicraft.create_detached_inventory("creative_trash", {
|
||||||
allow_put = function(inv, listname, index, stack, player)
|
allow_put = function(inv, listname, index, stack, player)
|
||||||
if multicraft.setting_getbool("creative_mode") then
|
if multicraft.setting_getbool("creative_mode") then
|
||||||
return stack:get_count()
|
return stack:get_count()
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_put = function(inv, listname, index, stack, player)
|
on_put = function(inv, listname, index, stack, player)
|
||||||
inv:set_stack(listname, index, "")
|
inv:set_stack(listname, index, "")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
trash:set_size("main", 1)
|
trash:set_size("main", 1)
|
||||||
|
|
||||||
|
|
||||||
-- Create detached creative inventory after loading all mods
|
-- Create detached creative inventory after loading all mods
|
||||||
multicraft.after(0, init)
|
multicraft.after(0, init)
|
||||||
|
|
||||||
local offset = {}
|
local offset = {}
|
||||||
local hoch = {}
|
local hoch = {}
|
||||||
local bg = {}
|
local bg = {}
|
||||||
offset["blocks"] = "-0.29,-0.25"
|
offset["blocks"] = "-0.29,-0.25"
|
||||||
offset["deco"] = "0.98,-0.25"
|
offset["deco"] = "0.98,-0.25"
|
||||||
offset["mese"] = "2.23,-0.25"
|
offset["mese"] = "2.23,-0.25"
|
||||||
offset["rail"] = "3.495,-0.25"
|
offset["rail"] = "3.495,-0.25"
|
||||||
offset["misc"] = "4.75,-0.25"
|
offset["misc"] = "4.75,-0.25"
|
||||||
offset["nix"] = "8.99,-0.25"
|
offset["nix"] = "8.99,-0.25"
|
||||||
offset["food"] = "-0.29,8.12"
|
offset["food"] = "-0.29,8.12"
|
||||||
offset["tools"] = "0.98,8.12"
|
offset["tools"] = "0.98,8.12"
|
||||||
offset["combat"] = "2.23,8.12"
|
offset["combat"] = "2.23,8.12"
|
||||||
offset["brew"] = "4.78,8.12"
|
offset["brew"] = "4.78,8.12"
|
||||||
offset["matr"] = "3.495,8.12"
|
offset["matr"] = "3.495,8.12"
|
||||||
offset["inv"] = "8.99,8.12"
|
offset["inv"] = "8.99,8.12"
|
||||||
|
|
||||||
hoch["blocks"] = ""
|
hoch["blocks"] = ""
|
||||||
hoch["deco"] = ""
|
hoch["deco"] = ""
|
||||||
hoch["mese"] = ""
|
hoch["mese"] = ""
|
||||||
hoch["rail"] = ""
|
hoch["rail"] = ""
|
||||||
hoch["misc"] = ""
|
hoch["misc"] = ""
|
||||||
hoch["nix"] = ""
|
hoch["nix"] = ""
|
||||||
hoch["food"] = "^[transformfy"
|
hoch["food"] = "^[transformfy"
|
||||||
hoch["tools"] = "^[transformfy"
|
hoch["tools"] = "^[transformfy"
|
||||||
hoch["combat"] = "^[transformfy"
|
hoch["combat"] = "^[transformfy"
|
||||||
hoch["brew"] = "^[transformfy"
|
hoch["brew"] = "^[transformfy"
|
||||||
hoch["matr"] = "^[transformfy"
|
hoch["matr"] = "^[transformfy"
|
||||||
hoch["inv"] = "^[transformfy"
|
hoch["inv"] = "^[transformfy"
|
||||||
|
|
||||||
local dark_bg = "crafting_creative_bg_dark.png"
|
local dark_bg = "crafting_creative_bg_dark.png"
|
||||||
|
|
||||||
local function reset_menu_item_bg()
|
local function reset_menu_item_bg()
|
||||||
bg["blocks"] = dark_bg
|
bg["blocks"] = dark_bg
|
||||||
bg["deco"] = dark_bg
|
bg["deco"] = dark_bg
|
||||||
bg["mese"] = dark_bg
|
bg["mese"] = dark_bg
|
||||||
bg["rail"] = dark_bg
|
bg["rail"] = dark_bg
|
||||||
bg["misc"] = dark_bg
|
bg["misc"] = dark_bg
|
||||||
bg["nix"] = dark_bg
|
bg["nix"] = dark_bg
|
||||||
bg["food"] = dark_bg
|
bg["food"] = dark_bg
|
||||||
bg["tools"] = dark_bg
|
bg["tools"] = dark_bg
|
||||||
bg["combat"] = dark_bg
|
bg["combat"] = dark_bg
|
||||||
bg["brew"] = dark_bg
|
bg["brew"] = dark_bg
|
||||||
bg["matr"] = dark_bg
|
bg["matr"] = dark_bg
|
||||||
bg["inv"] = dark_bg
|
bg["inv"] = dark_bg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
crafting.set_creative_formspec = function(player, start_i, pagenum, show, page, scroll)
|
crafting.set_creative_formspec = function(player, start_i, pagenum, show, page, scroll)
|
||||||
reset_menu_item_bg()
|
reset_menu_item_bg()
|
||||||
pagenum = math.floor(pagenum) or 1
|
pagenum = math.floor(pagenum) or 1
|
||||||
local pagemax = math.floor((crafting.creative_inventory_size) / (9*5) + 1)
|
local pagemax = math.floor((crafting.creative_inventory_size) / (9*5) + 1)
|
||||||
local slider_height = 4/pagemax
|
local slider_height = 4/pagemax
|
||||||
local slider_pos = slider_height*(pagenum-1)+2.25
|
local slider_pos = slider_height*(pagenum-1)+2.25
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
crafting.start_is[player_name] = start_i
|
crafting.start_is[player_name] = start_i
|
||||||
crafting.pages[player_name] = page
|
crafting.pages[player_name] = page
|
||||||
local formspec = ""
|
local formspec = ""
|
||||||
local main_list = "list[detached:creative;main;0,1.75;9,5;"..tostring(start_i).."]"
|
local main_list = "list[detached:creative;main;0,1.75;9,5;"..tostring(start_i).."]"
|
||||||
local name = "nix"
|
local name = "nix"
|
||||||
if page ~= nil then name = page end
|
if page ~= nil then name = page end
|
||||||
bg[name] = "crafting_creative_bg.png"
|
bg[name] = "crafting_creative_bg.png"
|
||||||
if name == "inv" then
|
if name == "inv" then
|
||||||
main_list = "image[-0.2,1.7;11.35,2.33;crafting_creative_bg.png]"..
|
main_list = "image[-0.2,1.7;11.35,2.33;crafting_creative_bg.png]"..
|
||||||
"image[-0.3,0.15;3,4;crafting_inventory_armor2.png]"..
|
"image[-0.3,0.15;3,4;crafting_inventory_armor2.png]"..
|
||||||
"list[current_player;main;0,3.75;9,3;9]"..
|
"list[current_player;main;0,3.75;9,3;9]"..
|
||||||
|
|
||||||
"list[detached:"..player_name.."_armor;armor;0,1.55;1,1;]"..
|
"list[detached:"..player_name.."_armor;armor;0,1.55;1,1;]"..
|
||||||
"list[detached:"..player_name.."_armor;armor;0,2.55;1,1;1]"..
|
"list[detached:"..player_name.."_armor;armor;0,2.55;1,1;1]"..
|
||||||
"list[detached:"..player_name.."_armor;armor;1,1.55;1,1;2]"..
|
"list[detached:"..player_name.."_armor;armor;1,1.55;1,1;2]"..
|
||||||
"list[detached:"..player_name.."_armor;armor;1,2.55;1,1;3]"
|
"list[detached:"..player_name.."_armor;armor;1,2.55;1,1;3]"
|
||||||
end
|
end
|
||||||
formspec = "size[10,9.3]"..
|
formspec = "size[10,9.3]"..
|
||||||
"background[-0.19,-0.25;10.5,9.87;crafting_inventory_creative.png]"..
|
"background[-0.19,-0.25;10.5,9.87;crafting_inventory_creative.png]"..
|
||||||
"bgcolor[#080808BB;true]"..
|
"bgcolor[#080808BB;true]"..
|
||||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
||||||
"label[-5,-5;"..name.."]"..
|
"label[-5,-5;"..name.."]"..
|
||||||
"image[" .. offset[name] .. ";1.5,1.44;crafting_creative_active.png"..hoch[name].."]"..
|
"image[" .. offset[name] .. ";1.5,1.44;crafting_creative_active.png"..hoch[name].."]"..
|
||||||
"image_button[-0.1,0;1,1;"..bg["blocks"].."^crafting_creative_build.png;build;]".. --build blocks
|
"image_button[-0.1,0;1,1;"..bg["blocks"].."^crafting_creative_build.png;build;]".. --build blocks
|
||||||
"image_button[1.15,0;1,1;"..bg["deco"].."^crafting_creative_deko.png;deco;]".. --decoration blocks
|
"image_button[1.15,0;1,1;"..bg["deco"].."^crafting_creative_deko.png;deco;]".. --decoration blocks
|
||||||
"image_button[2.415,0;1,1;"..bg["mese"].."^crafting_creative_mese.png;mese;]".. --redstone
|
"image_button[2.415,0;1,1;"..bg["mese"].."^crafting_creative_mese.png;mese;]".. --redstone
|
||||||
"image_button[3.693,0;1,1;"..bg["rail"].."^crafting_creative_rail.png;rail;]".. --transportation
|
"image_button[3.693,0;1,1;"..bg["rail"].."^crafting_creative_rail.png;rail;]".. --transportation
|
||||||
"image_button[4.93,0;1,1;"..bg["misc"].."^crafting_creative_misc.png;misc;]".. --miscellaneous
|
"image_button[4.93,0;1,1;"..bg["misc"].."^crafting_creative_misc.png;misc;]".. --miscellaneous
|
||||||
"image_button[9.19,0;1,1;"..bg["nix"].."^crafting_creative_all.png;default;]".. --search
|
"image_button[9.19,0;1,1;"..bg["nix"].."^crafting_creative_all.png;default;]".. --search
|
||||||
"image[0,1;5,0.75;fnt_"..name..".png]"..
|
"image[0,1;5,0.75;fnt_"..name..".png]"..
|
||||||
"list[current_player;main;0,7;9,1;]"..
|
"list[current_player;main;0,7;9,1;]"..
|
||||||
main_list..
|
main_list..
|
||||||
"image_button[9.03,1.74;0.85,0.6;crafting_creative_up.png;creative_prev;]"..
|
"image_button[9.03,1.74;0.85,0.6;crafting_creative_up.png;creative_prev;]"..
|
||||||
"image_button[9.03,6.15;0.85,0.6;crafting_creative_down.png;creative_next;]"..
|
"image_button[9.03,6.15;0.85,0.6;crafting_creative_down.png;creative_next;]"..
|
||||||
"image_button[-0.1,8.28;1,1;"..bg["food"].."^crafting_food.png;food;]".. --foodstuff
|
"image_button[-0.1,8.28;1,1;"..bg["food"].."^crafting_food.png;food;]".. --foodstuff
|
||||||
"image_button[1.15,8.28;1,1;"..bg["tools"].."^crafting_creative_tool.png;tools;]".. --tools
|
"image_button[1.15,8.28;1,1;"..bg["tools"].."^crafting_creative_tool.png;tools;]".. --tools
|
||||||
"image_button[2.415,8.28;1,1;"..bg["combat"].."^crafting_creative_sword.png;combat;]".. --combat
|
"image_button[2.415,8.28;1,1;"..bg["combat"].."^crafting_creative_sword.png;combat;]".. --combat
|
||||||
"image_button[3.693,8.28;1,1;"..bg["matr"].."^crafting_creative_matr.png;matr;]".. --brewing
|
"image_button[3.693,8.28;1,1;"..bg["matr"].."^crafting_creative_matr.png;matr;]".. --brewing
|
||||||
"image_button[4.93,8.28;1,1;"..bg["brew"].."^crafting_inventory_brew.png;brew;]".. --materials^
|
"image_button[4.93,8.28;1,1;"..bg["brew"].."^crafting_inventory_brew.png;brew;]".. --materials^
|
||||||
"image_button[9.19,8.28;1,1;"..bg["inv"].."^crafting_creative_inv.png;inv;]".. --inventory
|
"image_button[9.19,8.28;1,1;"..bg["inv"].."^crafting_creative_inv.png;inv;]".. --inventory
|
||||||
"list[detached:creative_trash;main;9,7;1,1;]"..
|
"list[detached:creative_trash;main;9,7;1,1;]"..
|
||||||
"image[9,7;1,1;crafting_creative_trash.png]"..
|
"image[9,7;1,1;crafting_creative_trash.png]"..
|
||||||
|
|
||||||
"image[9.04," .. tostring(slider_pos) .. ";0.75,"..tostring(slider_height) .. ";crafting_slider.png]"
|
"image[9.04," .. tostring(slider_pos) .. ";0.75,"..tostring(slider_height) .. ";crafting_slider.png]"
|
||||||
|
|
||||||
if name == "nix" then formspec = formspec .. "field[5.3,1.3;4,0.75;suche;;]" end
|
if name == "nix" then formspec = formspec .. "field[5.3,1.3;4,0.75;suche;;]" end
|
||||||
if pagenum ~= nil then formspec = formspec .. "p"..tostring(pagenum) end
|
if pagenum ~= nil then formspec = formspec .. "p"..tostring(pagenum) end
|
||||||
|
|
||||||
player:set_inventory_formspec(formspec)
|
player:set_inventory_formspec(formspec)
|
||||||
end
|
end
|
||||||
|
|
||||||
multicraft.register_on_player_receive_fields(function(player, formname, fields)
|
multicraft.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
local page = nil
|
local page = nil
|
||||||
if not multicraft.setting_getbool("creative_mode") then
|
if not multicraft.setting_getbool("creative_mode") then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if fields.bgcolor then
|
if fields.bgcolor then
|
||||||
-- multicraft.chat_send_all("jupp")
|
-- multicraft.chat_send_all("jupp")
|
||||||
end
|
end
|
||||||
if fields.suche ~= nil and fields.suche ~= "" then
|
if fields.suche ~= nil and fields.suche ~= "" then
|
||||||
set_inv(string.lower(fields.suche))
|
set_inv(string.lower(fields.suche))
|
||||||
multicraft.after(0, function()
|
multicraft.after(0, function()
|
||||||
multicraft.show_formspec(player:get_player_name(), "detached:creative", player:get_inventory_formspec())
|
multicraft.show_formspec(player:get_player_name(), "detached:creative", player:get_inventory_formspec())
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
if fields.build then
|
if fields.build then
|
||||||
set_inv("#blocks",player)
|
set_inv("#blocks",player)
|
||||||
page = "blocks"
|
page = "blocks"
|
||||||
end
|
end
|
||||||
if fields.deco then
|
if fields.deco then
|
||||||
set_inv("#deco",player)
|
set_inv("#deco",player)
|
||||||
page = "deco"
|
page = "deco"
|
||||||
end
|
end
|
||||||
if fields.mese then
|
if fields.mese then
|
||||||
set_inv("#mese",player)
|
set_inv("#mese",player)
|
||||||
page = "mese"
|
page = "mese"
|
||||||
end
|
end
|
||||||
if fields.rail then
|
if fields.rail then
|
||||||
set_inv("#rail",player)
|
set_inv("#rail",player)
|
||||||
page = "rail"
|
page = "rail"
|
||||||
end
|
end
|
||||||
if fields.misc then
|
if fields.misc then
|
||||||
set_inv("#misc",player)
|
set_inv("#misc",player)
|
||||||
page = "misc"
|
page = "misc"
|
||||||
end
|
end
|
||||||
if fields.default then
|
if fields.default then
|
||||||
set_inv("all")
|
set_inv("all")
|
||||||
page = 'nix'
|
page = 'nix'
|
||||||
end
|
end
|
||||||
if fields.food then
|
if fields.food then
|
||||||
set_inv("#food")
|
set_inv("#food")
|
||||||
page = "food"
|
page = "food"
|
||||||
end
|
end
|
||||||
if fields.tools then
|
if fields.tools then
|
||||||
set_inv("#tools")
|
set_inv("#tools")
|
||||||
page = "tools"
|
page = "tools"
|
||||||
end
|
end
|
||||||
if fields.combat then
|
if fields.combat then
|
||||||
set_inv("#combat")
|
set_inv("#combat")
|
||||||
page = "combat"
|
page = "combat"
|
||||||
end
|
end
|
||||||
if fields.matr then
|
if fields.matr then
|
||||||
set_inv("#matr")
|
set_inv("#matr")
|
||||||
page = "matr"
|
page = "matr"
|
||||||
end
|
end
|
||||||
if fields.inv then
|
if fields.inv then
|
||||||
page = "inv"
|
page = "inv"
|
||||||
end
|
end
|
||||||
if fields.brew then
|
if fields.brew then
|
||||||
set_inv("#brew")
|
set_inv("#brew")
|
||||||
page = "brew"
|
page = "brew"
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Figure out current page from formspec
|
-- Figure out current page from formspec
|
||||||
local current_page = 0
|
local current_page = 0
|
||||||
local formspec = player:get_inventory_formspec()
|
local formspec = player:get_inventory_formspec()
|
||||||
|
|
||||||
local size = string.len(formspec)
|
local size = string.len(formspec)
|
||||||
local marker = string.sub(formspec,size-1)
|
local marker = string.sub(formspec,size-1)
|
||||||
marker = string.sub(marker,1,1)
|
marker = string.sub(marker,1,1)
|
||||||
|
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
local start_i = crafting.start_is[player_name]
|
local start_i = crafting.start_is[player_name]
|
||||||
if not page then page = crafting.pages[player_name] end
|
if not page then page = crafting.pages[player_name] end
|
||||||
if page ~= crafting.pages[player_name] then
|
if page ~= crafting.pages[player_name] then
|
||||||
start_i = 0
|
start_i = 0
|
||||||
end
|
end
|
||||||
--if marker ~= nil and marker == "p" then
|
--if marker ~= nil and marker == "p" then
|
||||||
--local ppage = string.sub(formspec,size)
|
--local ppage = string.sub(formspec,size)
|
||||||
-- print('ppage ' .. (ppage or 'nope'))
|
-- print('ppage ' .. (ppage or 'nope'))
|
||||||
--multicraft.chat_send_all(page)
|
--multicraft.chat_send_all(page)
|
||||||
--start_i = ppage - 1
|
--start_i = ppage - 1
|
||||||
--end
|
--end
|
||||||
--start_i = tonumber(start_i) or 0
|
--start_i = tonumber(start_i) or 0
|
||||||
|
|
||||||
if fields.creative_prev then
|
if fields.creative_prev then
|
||||||
start_i = start_i - 9*5
|
start_i = start_i - 9*5
|
||||||
end
|
end
|
||||||
if fields.creative_next
|
if fields.creative_next
|
||||||
and start_i + 9*5 <= crafting.creative_inventory_size+1 then
|
and start_i + 9*5 <= crafting.creative_inventory_size+1 then
|
||||||
start_i = start_i + 9*5
|
start_i = start_i + 9*5
|
||||||
end
|
end
|
||||||
if start_i < 0 then
|
if start_i < 0 then
|
||||||
start_i = 0
|
start_i = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
crafting.set_creative_formspec(player, start_i, start_i/(9*5) +1, false, page)
|
crafting.set_creative_formspec(player, start_i, start_i/(9*5) +1, false, page)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
if multicraft.setting_getbool("creative_mode") then
|
if multicraft.setting_getbool("creative_mode") then
|
||||||
multicraft.register_item(":", {
|
multicraft.register_item(":", {
|
||||||
type = "none",
|
type = "none",
|
||||||
wield_image = "wieldhand.png",
|
wield_image = "wieldhand.png",
|
||||||
wield_scale = {x=1,y=1,z=2.5},
|
wield_scale = {x=1,y=1,z=2.5},
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
full_punch_interval = 0.5,
|
full_punch_interval = 0.5,
|
||||||
max_drop_level = 3,
|
max_drop_level = 3,
|
||||||
groupcaps = {
|
groupcaps = {
|
||||||
crumbly = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
crumbly = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
||||||
cracky = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
cracky = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
||||||
snappy = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
snappy = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
||||||
choppy = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
choppy = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
||||||
oddly_breakable_by_hand = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
oddly_breakable_by_hand = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
multicraft.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
|
multicraft.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
|
||||||
return true
|
return true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function multicraft.handle_node_drops(pos, drops, digger)
|
function multicraft.handle_node_drops(pos, drops, digger)
|
||||||
if not digger or not digger:is_player() then
|
if not digger or not digger:is_player() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local inv = digger:get_inventory()
|
local inv = digger:get_inventory()
|
||||||
if inv then
|
if inv then
|
||||||
for _,item in ipairs(drops) do
|
for _,item in ipairs(drops) do
|
||||||
item = ItemStack(item):get_name()
|
item = ItemStack(item):get_name()
|
||||||
if not inv:contains_item("main", item) then
|
if not inv:contains_item("main", item) then
|
||||||
inv:add_item("main", item)
|
inv:add_item("main", item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -1,79 +1,79 @@
|
||||||
default.furnace_inactive_formspec =
|
default.furnace_inactive_formspec =
|
||||||
"size[9,8.75]"..
|
"size[9,8.75]"..
|
||||||
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory_furnace.png]"..
|
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory_furnace.png]"..
|
||||||
"bgcolor[#080808BB;true]"..
|
"bgcolor[#080808BB;true]"..
|
||||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
||||||
"list[current_player;main;0,4.5;9,3;9]"..
|
"list[current_player;main;0,4.5;9,3;9]"..
|
||||||
"list[current_player;main;0,7.74;9,1;]"..
|
"list[current_player;main;0,7.74;9,1;]"..
|
||||||
"list[current_name;src;2.75,0.5;1,1;]"..
|
"list[current_name;src;2.75,0.5;1,1;]"..
|
||||||
"list[current_name;fuel;2.75,2.5;1,1;]"..
|
"list[current_name;fuel;2.75,2.5;1,1;]"..
|
||||||
"list[current_name;dst;5.75,1.5;1,1;]"..
|
"list[current_name;dst;5.75,1.5;1,1;]"..
|
||||||
"image[2.75,1.5;1,1;crafting_furnace_fire_bg.png"
|
"image[2.75,1.5;1,1;crafting_furnace_fire_bg.png"
|
||||||
|
|
||||||
function default.get_furnace_active_formspec(pos, percent)
|
function default.get_furnace_active_formspec(pos, percent)
|
||||||
local formspec =
|
local formspec =
|
||||||
"size[9,8.75]"..
|
"size[9,8.75]"..
|
||||||
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory_furnace.png]"..
|
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory_furnace.png]"..
|
||||||
"bgcolor[#080808BB;true]"..
|
"bgcolor[#080808BB;true]"..
|
||||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
||||||
"list[current_player;main;0,4.5;9,3;9]"..
|
"list[current_player;main;0,4.5;9,3;9]"..
|
||||||
"list[current_player;main;0,7.74;9,1;]"..
|
"list[current_player;main;0,7.74;9,1;]"..
|
||||||
"list[current_name;src;2.75,0.5;1,1;]"..
|
"list[current_name;src;2.75,0.5;1,1;]"..
|
||||||
"list[current_name;fuel;2.75,2.5;1,1;]"..
|
"list[current_name;fuel;2.75,2.5;1,1;]"..
|
||||||
"list[current_name;dst;5.75,1.5;1,1;]"..
|
"list[current_name;dst;5.75,1.5;1,1;]"..
|
||||||
"image[2.75,1.5;1,1;crafting_furnace_fire_bg.png^[lowpart:"..
|
"image[2.75,1.5;1,1;crafting_furnace_fire_bg.png^[lowpart:"..
|
||||||
(100-percent)..":default_furnace_fire_fg.png]"
|
(100-percent)..":default_furnace_fire_fg.png]"
|
||||||
|
|
||||||
local meta = multicraft.get_meta(pos)
|
local meta = multicraft.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("dst",1)
|
inv:set_size("dst",1)
|
||||||
|
|
||||||
return formspec
|
return formspec
|
||||||
end
|
end
|
||||||
|
|
||||||
default.chest_formspec =
|
default.chest_formspec =
|
||||||
"size[9,9.75]"..
|
"size[9,9.75]"..
|
||||||
"background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]"..
|
"background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]"..
|
||||||
"bgcolor[#080808BB;true]"..
|
"bgcolor[#080808BB;true]"..
|
||||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
||||||
"list[current_name;main;0,0.5;9,4;]"..
|
"list[current_name;main;0,0.5;9,4;]"..
|
||||||
"list[current_player;main;0,5.5;9,3;9]"..
|
"list[current_player;main;0,5.5;9,3;9]"..
|
||||||
"list[current_player;main;0,8.74;9,1;]"
|
"list[current_player;main;0,8.74;9,1;]"
|
||||||
|
|
||||||
local chest_inv_size = 4*9
|
local chest_inv_size = 4*9
|
||||||
local chest_inv_vers = 2
|
local chest_inv_vers = 2
|
||||||
|
|
||||||
function default.get_locked_chest_formspec(pos)
|
function default.get_locked_chest_formspec(pos)
|
||||||
local meta = multicraft.get_meta(pos)
|
local meta = multicraft.get_meta(pos)
|
||||||
local inv_v = meta:get_int("chest_inv_ver")
|
local inv_v = meta:get_int("chest_inv_ver")
|
||||||
if inv_v and inv_v < chest_inv_vers then
|
if inv_v and inv_v < chest_inv_vers then
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("main",chest_inv_size)
|
inv:set_size("main",chest_inv_size)
|
||||||
meta:set_int("chest_inv_ver",chest_inv_vers)
|
meta:set_int("chest_inv_ver",chest_inv_vers)
|
||||||
end
|
end
|
||||||
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
|
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
|
||||||
local formspec =
|
local formspec =
|
||||||
"size[9,9.75]"..
|
"size[9,9.75]"..
|
||||||
"background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]"..
|
"background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]"..
|
||||||
"bgcolor[#080808BB;true]"..
|
"bgcolor[#080808BB;true]"..
|
||||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
||||||
"list[nodemeta:".. spos .. ";main;0,0.5;9,4;]"..
|
"list[nodemeta:".. spos .. ";main;0,0.5;9,4;]"..
|
||||||
"list[current_player;main;0,5.5;9,3;9]"..
|
"list[current_player;main;0,5.5;9,3;9]"..
|
||||||
"list[current_player;main;0,8.74;9,1;]"
|
"list[current_player;main;0,8.74;9,1;]"
|
||||||
return formspec
|
return formspec
|
||||||
end
|
end
|
||||||
|
|
||||||
multicraft.register_abm({
|
multicraft.register_abm({
|
||||||
nodenames = {"default:chest"},
|
nodenames = {"default:chest"},
|
||||||
interval = 1,
|
interval = 1,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
local meta = multicraft.get_meta(pos)
|
local meta = multicraft.get_meta(pos)
|
||||||
local inv_v = meta:get_int("chest_inv_ver")
|
local inv_v = meta:get_int("chest_inv_ver")
|
||||||
if inv_v and inv_v < chest_inv_vers then
|
if inv_v and inv_v < chest_inv_vers then
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("main",chest_inv_size)
|
inv:set_size("main",chest_inv_size)
|
||||||
meta:set_int("chest_inv_ver",chest_inv_vers)
|
meta:set_int("chest_inv_ver",chest_inv_vers)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
|
@ -1,198 +1,198 @@
|
||||||
if not multicraft.get_modpath("check") then os.exit() end
|
if not multicraft.get_modpath("check") then os.exit() end
|
||||||
if not default.multicraft_is_variable_is_a_part_of_multicraft_subgame_and_copying_it_means_you_use_our_code_so_we_become_contributors_of_your_project then exit() end
|
if not default.multicraft_is_variable_is_a_part_of_multicraft_subgame_and_copying_it_means_you_use_our_code_so_we_become_contributors_of_your_project then exit() end
|
||||||
dofile(multicraft.get_modpath("crafting").."/formspecs.lua")
|
dofile(multicraft.get_modpath("crafting").."/formspecs.lua")
|
||||||
|
|
||||||
local show_armor = false
|
local show_armor = false
|
||||||
if multicraft.get_modpath("3d_armor") ~= nil then show_armor = true end
|
if multicraft.get_modpath("3d_armor") ~= nil then show_armor = true end
|
||||||
|
|
||||||
local function item_drop(itemstack, dropper, pos)
|
local function item_drop(itemstack, dropper, pos)
|
||||||
if dropper:is_player() then
|
if dropper:is_player() then
|
||||||
local v = dropper:get_look_dir()
|
local v = dropper:get_look_dir()
|
||||||
local p = {x=pos.x, y=pos.y+1.2, z=pos.z}
|
local p = {x=pos.x, y=pos.y+1.2, z=pos.z}
|
||||||
p.x = p.x+(math.random(1,3)*0.2)
|
p.x = p.x+(math.random(1,3)*0.2)
|
||||||
p.z = p.z+(math.random(1,3)*0.2)
|
p.z = p.z+(math.random(1,3)*0.2)
|
||||||
local obj = multicraft.add_item(p, itemstack)
|
local obj = multicraft.add_item(p, itemstack)
|
||||||
if obj then
|
if obj then
|
||||||
v.x = v.x*4
|
v.x = v.x*4
|
||||||
v.y = v.y*4 + 2
|
v.y = v.y*4 + 2
|
||||||
v.z = v.z*4
|
v.z = v.z*4
|
||||||
obj:setvelocity(v)
|
obj:setvelocity(v)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
multicraft.add_item(pos, itemstack)
|
multicraft.add_item(pos, itemstack)
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
local function drop_fields(player, name)
|
local function drop_fields(player, name)
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
for i,stack in ipairs(inv:get_list(name)) do
|
for i,stack in ipairs(inv:get_list(name)) do
|
||||||
item_drop(stack, player, player:getpos())
|
item_drop(stack, player, player:getpos())
|
||||||
stack:clear()
|
stack:clear()
|
||||||
inv:set_stack(name, i, stack)
|
inv:set_stack(name, i, stack)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local player_armor = {}
|
local player_armor = {}
|
||||||
|
|
||||||
local function update_armor(player)
|
local function update_armor(player)
|
||||||
local out = ""
|
local out = ""
|
||||||
if not player then return end
|
if not player then return end
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if not armor or not armor.textures then return end
|
if not armor or not armor.textures then return end
|
||||||
local armor_str = armor.textures[name].armor
|
local armor_str = armor.textures[name].armor
|
||||||
if string.find(armor_str, "leggings") then
|
if string.find(armor_str, "leggings") then
|
||||||
out = out .. "^crafting_armor_legs.png"
|
out = out .. "^crafting_armor_legs.png"
|
||||||
end
|
end
|
||||||
if string.find(armor_str, "boots") then
|
if string.find(armor_str, "boots") then
|
||||||
out = out .. "^crafting_armor_boots.png"
|
out = out .. "^crafting_armor_boots.png"
|
||||||
end
|
end
|
||||||
if string.find(armor_str, "helmet") then
|
if string.find(armor_str, "helmet") then
|
||||||
out = out .. "^crafting_armor_helmet.png"
|
out = out .. "^crafting_armor_helmet.png"
|
||||||
end
|
end
|
||||||
if string.find(armor_str, "chestplate") then
|
if string.find(armor_str, "chestplate") then
|
||||||
out = out .. "^crafting_armor_chest.png"
|
out = out .. "^crafting_armor_chest.png"
|
||||||
end
|
end
|
||||||
player_armor[name] = out
|
player_armor[name] = out
|
||||||
end
|
end
|
||||||
|
|
||||||
local function set_inventory(player)
|
local function set_inventory(player)
|
||||||
if multicraft.setting_getbool("creative_mode") then
|
if multicraft.setting_getbool("creative_mode") then
|
||||||
multicraft.after(0.5,function()
|
multicraft.after(0.5,function()
|
||||||
crafting.set_creative_formspec(player, 0, 1)
|
crafting.set_creative_formspec(player, 0, 1)
|
||||||
return
|
return
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
player:get_inventory():set_width("craft", 3)
|
player:get_inventory():set_width("craft", 3)
|
||||||
player:get_inventory():set_size("craft", 9)
|
player:get_inventory():set_size("craft", 9)
|
||||||
player:get_inventory():set_size("main", 9*4)
|
player:get_inventory():set_size("main", 9*4)
|
||||||
|
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
local img = "crafting_inventory_player.png"
|
local img = "crafting_inventory_player.png"
|
||||||
local armor_img = ""
|
local armor_img = ""
|
||||||
if show_armor then
|
if show_armor then
|
||||||
armor_img = "^crafting_inventory_armor.png"
|
armor_img = "^crafting_inventory_armor.png"
|
||||||
if player_armor[player_name] ~= nil then
|
if player_armor[player_name] ~= nil then
|
||||||
img = img .. player_armor[player_name]
|
img = img .. player_armor[player_name]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local img_element = "image[1,0;3,4;"..img.."]"
|
local img_element = "image[1,0;3,4;"..img.."]"
|
||||||
if show_armor and armor.textures[player_name] and armor.textures[player_name].preview then
|
if show_armor and armor.textures[player_name] and armor.textures[player_name].preview then
|
||||||
img = armor.textures[player_name].preview
|
img = armor.textures[player_name].preview
|
||||||
local s1 = img:find("character_preview")
|
local s1 = img:find("character_preview")
|
||||||
if s1 ~= nil then
|
if s1 ~= nil then
|
||||||
s1 = img:sub(s1+21)
|
s1 = img:sub(s1+21)
|
||||||
img = "crafting_player2d.png"..s1
|
img = "crafting_player2d.png"..s1
|
||||||
end
|
end
|
||||||
img_element = "image[1.5,0;2,4;"..img.."]"
|
img_element = "image[1.5,0;2,4;"..img.."]"
|
||||||
end
|
end
|
||||||
|
|
||||||
local form = "size[9,8.75]"..
|
local form = "size[9,8.75]"..
|
||||||
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory.png"..armor_img.."]"..
|
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory.png"..armor_img.."]"..
|
||||||
"bgcolor[#080808BB;true]"..
|
"bgcolor[#080808BB;true]"..
|
||||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
||||||
img_element
|
img_element
|
||||||
--armor
|
--armor
|
||||||
if show_armor then
|
if show_armor then
|
||||||
if armor.def[player_name] and armor.def[player_name].level then
|
if armor.def[player_name] and armor.def[player_name].level then
|
||||||
form = form ..
|
form = form ..
|
||||||
"list[detached:"..player_name.."_armor;armor;0,0;1,1;]"..
|
"list[detached:"..player_name.."_armor;armor;0,0;1,1;]"..
|
||||||
"list[detached:"..player_name.."_armor;armor;0,1;1,1;1]"..
|
"list[detached:"..player_name.."_armor;armor;0,1;1,1;1]"..
|
||||||
"list[detached:"..player_name.."_armor;armor;0,2;1,1;2]"..
|
"list[detached:"..player_name.."_armor;armor;0,2;1,1;2]"..
|
||||||
"list[detached:"..player_name.."_armor;armor;0,3;1,1;3]"
|
"list[detached:"..player_name.."_armor;armor;0,3;1,1;3]"
|
||||||
else
|
else
|
||||||
form = form ..
|
form = form ..
|
||||||
"list[detached:"..player_name.."_armor;armor_head;0,0;1,1;]"..
|
"list[detached:"..player_name.."_armor;armor_head;0,0;1,1;]"..
|
||||||
"list[detached:"..player_name.."_armor;armor_torso;0,1;1,1;1]"..
|
"list[detached:"..player_name.."_armor;armor_torso;0,1;1,1;1]"..
|
||||||
"list[detached:"..player_name.."_armor;armor_legs;0,2;1,1;2]"..
|
"list[detached:"..player_name.."_armor;armor_legs;0,2;1,1;2]"..
|
||||||
"list[detached:"..player_name.."_armor;armor_feet;0,3;1,1;3]"
|
"list[detached:"..player_name.."_armor;armor_feet;0,3;1,1;3]"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
form = form ..
|
form = form ..
|
||||||
"list[current_player;main;0,4.5;9,3;9]"..
|
"list[current_player;main;0,4.5;9,3;9]"..
|
||||||
"list[current_player;main;0,7.74;9,1;]"..
|
"list[current_player;main;0,7.74;9,1;]"..
|
||||||
"list[current_player;craft;4,1;2,1;1]"..
|
"list[current_player;craft;4,1;2,1;1]"..
|
||||||
"list[current_player;craft;4,2;2,1;4]"..
|
"list[current_player;craft;4,2;2,1;4]"..
|
||||||
"list[current_player;craftpreview;7,1.5;1,1;]"..
|
"list[current_player;craftpreview;7,1.5;1,1;]"..
|
||||||
"inv"
|
"inv"
|
||||||
|
|
||||||
player:set_inventory_formspec(form)
|
player:set_inventory_formspec(form)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function set_workbench(player)
|
local function set_workbench(player)
|
||||||
player:get_inventory():set_width("craft", 3)
|
player:get_inventory():set_width("craft", 3)
|
||||||
player:get_inventory():set_size("craft", 9)
|
player:get_inventory():set_size("craft", 9)
|
||||||
player:get_inventory():set_size("main", 9*4)
|
player:get_inventory():set_size("main", 9*4)
|
||||||
|
|
||||||
local form = "size[9,8.75]"..
|
local form = "size[9,8.75]"..
|
||||||
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory_workbench.png]"..
|
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory_workbench.png]"..
|
||||||
"bgcolor[#080808BB;true]"..
|
"bgcolor[#080808BB;true]"..
|
||||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
||||||
"list[current_player;main;0,4.5;9,3;9]"..
|
"list[current_player;main;0,4.5;9,3;9]"..
|
||||||
"list[current_player;main;0,7.74;9,1;]"..
|
"list[current_player;main;0,7.74;9,1;]"..
|
||||||
"list[current_player;craft;1.75,0.5;3,3;]"..
|
"list[current_player;craft;1.75,0.5;3,3;]"..
|
||||||
"list[current_player;craftpreview;5.75,1.5;1,1;]"..
|
"list[current_player;craftpreview;5.75,1.5;1,1;]"..
|
||||||
"wob"
|
"wob"
|
||||||
|
|
||||||
--player:set_inventory_formspec(form)
|
--player:set_inventory_formspec(form)
|
||||||
multicraft.show_formspec(player:get_player_name(), "main", form)
|
multicraft.show_formspec(player:get_player_name(), "main", form)
|
||||||
end
|
end
|
||||||
|
|
||||||
--drop craf items and reset inventory on closing
|
--drop craf items and reset inventory on closing
|
||||||
multicraft.register_on_player_receive_fields(function(player, formname, fields)
|
multicraft.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if fields.quit then
|
if fields.quit then
|
||||||
local formspec = player:get_inventory_formspec()
|
local formspec = player:get_inventory_formspec()
|
||||||
local size = string.len(formspec)
|
local size = string.len(formspec)
|
||||||
local marker = string.sub(formspec,size-2)
|
local marker = string.sub(formspec,size-2)
|
||||||
if marker == "inv" or marker == "wob" then
|
if marker == "inv" or marker == "wob" then
|
||||||
set_inventory(player)
|
set_inventory(player)
|
||||||
drop_fields(player,"craft")
|
drop_fields(player,"craft")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
multicraft.register_on_joinplayer(function(player)
|
multicraft.register_on_joinplayer(function(player)
|
||||||
if multicraft.setting_getbool("creative_mode") then
|
if multicraft.setting_getbool("creative_mode") then
|
||||||
dofile(multicraft.get_modpath("crafting").."/creative.lua")
|
dofile(multicraft.get_modpath("crafting").."/creative.lua")
|
||||||
end
|
end
|
||||||
--init inventory
|
--init inventory
|
||||||
set_inventory(player)
|
set_inventory(player)
|
||||||
--set hotbar size
|
--set hotbar size
|
||||||
if player.hud_set_hotbar_itemcount then
|
if player.hud_set_hotbar_itemcount then
|
||||||
multicraft.after(0.5, player.hud_set_hotbar_itemcount, player, 8)
|
multicraft.after(0.5, player.hud_set_hotbar_itemcount, player, 8)
|
||||||
end
|
end
|
||||||
--add hotbar images
|
--add hotbar images
|
||||||
multicraft.after(0.5,function()
|
multicraft.after(0.5,function()
|
||||||
player:hud_set_hotbar_image("crafting_hotbar.png")
|
player:hud_set_hotbar_image("crafting_hotbar.png")
|
||||||
player:hud_set_hotbar_selected_image("crafting_hotbar_selected.png")
|
player:hud_set_hotbar_selected_image("crafting_hotbar_selected.png")
|
||||||
|
|
||||||
if show_armor then
|
if show_armor then
|
||||||
local armor_orginal = armor.set_player_armor
|
local armor_orginal = armor.set_player_armor
|
||||||
armor.set_player_armor = function(self, player)
|
armor.set_player_armor = function(self, player)
|
||||||
armor_orginal(self, player)
|
armor_orginal(self, player)
|
||||||
update_armor(player)
|
update_armor(player)
|
||||||
-- set_inventory(player)
|
-- set_inventory(player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
multicraft.register_node("crafting:workbench", {
|
multicraft.register_node("crafting:workbench", {
|
||||||
description = "Workbench",
|
description = "Workbench",
|
||||||
tiles = {"crafting_workbench_top.png", "default_wood.png", "crafting_workbench_side.png",
|
tiles = {"crafting_workbench_top.png", "default_wood.png", "crafting_workbench_side.png",
|
||||||
"crafting_workbench_side.png", "crafting_workbench_front.png", "crafting_workbench_front.png"},
|
"crafting_workbench_side.png", "crafting_workbench_front.png", "crafting_workbench_front.png"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=2, decorative = 1},
|
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=2, decorative = 1},
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
on_rightclick = function(pos, node, clicker, itemstack)
|
||||||
set_workbench(clicker)
|
set_workbench(clicker)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
multicraft.register_craft({
|
multicraft.register_craft({
|
||||||
output = "crafting:workbench",
|
output = "crafting:workbench",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"group:wood", "group:wood"},
|
{"group:wood", "group:wood"},
|
||||||
{"group:wood", "group:wood"}
|
{"group:wood", "group:wood"}
|
||||||
}
|
}
|
||||||
})
|
})
|
|
@ -1,11 +1,11 @@
|
||||||
if not multicraft.get_modpath("check") then os.exit() end
|
if not multicraft.get_modpath("check") then os.exit() end
|
||||||
if not default.multicraft_is_variable_is_a_part_of_multicraft_subgame_and_copying_it_means_you_use_our_code_so_we_become_contributors_of_your_project then exit() end
|
if not default.multicraft_is_variable_is_a_part_of_multicraft_subgame_and_copying_it_means_you_use_our_code_so_we_become_contributors_of_your_project then exit() end
|
||||||
creative = {}
|
creative = {}
|
||||||
|
|
||||||
creative.set_creative_formspec = function()
|
creative.set_creative_formspec = function()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
multicraft.register_on_player_receive_fields(function(player, formname, fields)
|
multicraft.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
|
||||||
end)
|
end)
|
|
@ -1,3 +1,3 @@
|
||||||
check
|
check
|
||||||
default
|
default
|
||||||
crafting
|
crafting
|
|
@ -1,9 +1,9 @@
|
||||||
if not multicraft.get_modpath("check") then os.exit() end
|
if not multicraft.get_modpath("check") then os.exit() end
|
||||||
if not default.multicraft_is_variable_is_a_part_of_multicraft_subgame_and_copying_it_means_you_use_our_code_so_we_become_contributors_of_your_project then exit() end
|
if not default.multicraft_is_variable_is_a_part_of_multicraft_subgame_and_copying_it_means_you_use_our_code_so_we_become_contributors_of_your_project then exit() end
|
||||||
inventory_plus = {}
|
inventory_plus = {}
|
||||||
|
|
||||||
function inventory_plus.set_inventory_formspec(player, formspec)
|
function inventory_plus.set_inventory_formspec(player, formspec)
|
||||||
end
|
end
|
||||||
|
|
||||||
function inventory_plus.register_button(player,str1, str2)
|
function inventory_plus.register_button(player,str1, str2)
|
||||||
end
|
end
|
|
@ -1,19 +1,19 @@
|
||||||
if not multicraft.get_modpath("check") then os.exit() end
|
if not multicraft.get_modpath("check") then os.exit() end
|
||||||
if not default.multicraft_is_variable_is_a_part_of_multicraft_subgame_and_copying_it_means_you_use_our_code_so_we_become_contributors_of_your_project then exit() end
|
if not default.multicraft_is_variable_is_a_part_of_multicraft_subgame_and_copying_it_means_you_use_our_code_so_we_become_contributors_of_your_project then exit() end
|
||||||
--if multicraft.setting_get("keepInventory") == false then
|
--if multicraft.setting_get("keepInventory") == false then
|
||||||
multicraft.register_on_dieplayer(function(player)
|
multicraft.register_on_dieplayer(function(player)
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
local pos = player:getpos()
|
local pos = player:getpos()
|
||||||
for i,stack in ipairs(inv:get_list("main")) do
|
for i,stack in ipairs(inv:get_list("main")) do
|
||||||
local x = math.random(0, 9)/3
|
local x = math.random(0, 9)/3
|
||||||
local z = math.random(0, 9)/3
|
local z = math.random(0, 9)/3
|
||||||
pos.x = pos.x + x
|
pos.x = pos.x + x
|
||||||
pos.z = pos.z + z
|
pos.z = pos.z + z
|
||||||
multicraft.add_item(pos, stack)
|
multicraft.add_item(pos, stack)
|
||||||
stack:clear()
|
stack:clear()
|
||||||
inv:set_stack("main", i, stack)
|
inv:set_stack("main", i, stack)
|
||||||
pos.x = pos.x - x
|
pos.x = pos.x - x
|
||||||
pos.z = pos.z - z
|
pos.z = pos.z - z
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
--end
|
--end
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue