parent
d2a6429253
commit
6df7918aea
|
@ -7,21 +7,19 @@ tags
|
|||
*.orig
|
||||
*.rej
|
||||
|
||||
## Files related to minetest development cycle
|
||||
## Files related to MultiCraft development cycle
|
||||
/*.patch
|
||||
|
||||
## Non-static Minetest directories
|
||||
## Non-static MultiCraft directories
|
||||
/bin/
|
||||
/games/*
|
||||
!/games/minimal/
|
||||
!/games/MultiCraft_game/
|
||||
/cache/
|
||||
/textures/*
|
||||
!/textures/base/
|
||||
/sounds/
|
||||
/mods/*
|
||||
!/mods/minetest/
|
||||
/mods/minetest/*
|
||||
!/mods/minetest/mods_here.txt
|
||||
!/mods/mods_here.txt
|
||||
/worlds/
|
||||
/world/
|
||||
|
||||
|
|
|
@ -0,0 +1,166 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
# MultiCraft_game
|
||||
Subgame for MultiCraft.
|
||||
|
||||
|
||||
A Minecraft clone game for the MultiCraft game engine.
|
||||
======================================================================
|
||||
|
||||
License of source code
|
||||
----------------------
|
||||
Copyright (C) 2013 jojoa1997
|
||||
See README.txt in each mod directory for information about other authors.
|
||||
|
||||
LGPL v3 see LICENSE.txt
|
||||
|
||||
License of media (textures and sounds)
|
||||
--------------------------------------
|
||||
Copyright (C) 2013 Vattic
|
||||
|
||||
http://www.minecraftforum.net/topic/72747-/
|
||||
|
||||
Vattic's Terms:
|
||||
Things that are fine:
|
||||
- Use as placeholders.
|
||||
- Using as many textures as you've made yourself.
|
||||
- Using the items or paintings.
|
||||
- Use as base for mod textures.
|
||||
|
||||
Requirements:
|
||||
- Give clear credit.
|
||||
- Link back to the Faithful 32x32 thread.
|
||||
- Be honest about what you are using.
|
||||
- No money making links.
|
||||
|
||||
On remix/tweaked packs:
|
||||
- Let's Players can share a modified copy with fans.
|
||||
- Adventure map makers can provide modified copy to go along with it.
|
||||
|
||||
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.
|
||||
- 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:
|
||||
- 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.
|
||||
|
||||
See README.txt in each mod directory for information about other authors.
|
|
@ -0,0 +1 @@
|
|||
name = MultiCraft
|
|
@ -0,0 +1,15 @@
|
|||
[mod] Visible Player Armor [3d_armor]
|
||||
=====================================
|
||||
|
||||
depends: default, inventory_plus, unified_skins
|
||||
|
||||
Adds craftable armor that is visible to other players. Each armor item worn contibutes to
|
||||
a player's armor group level making them less vulnerable to weapons.
|
||||
|
||||
Armor takes damage when a player is hurt but also offers a percentage chance of healing.
|
||||
|
||||
default settings: [multicraft.conf]
|
||||
|
||||
# Set number of seconds between armor updates.
|
||||
3d_armor_update_time = 1
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
-- Armor Configuration (defaults)
|
||||
|
||||
-- Increase this if you get initialization glitches when a player first joins.
|
||||
ARMOR_INIT_DELAY = 1
|
||||
|
||||
-- Number of initialization attempts.
|
||||
-- Use in conjunction with ARMOR_INIT_DELAY if initialization problems persist.
|
||||
ARMOR_INIT_TIMES = 1
|
||||
|
||||
-- Increase this if armor is not getting into bones due to server lag.
|
||||
ARMOR_BONES_DELAY = 1
|
||||
|
||||
-- How often player armor/wield items are updated.
|
||||
ARMOR_UPDATE_TIME = 1
|
||||
|
||||
-- Drop armor when a player dies.
|
||||
-- Uses bones mod if present, otherwise items are dropped around the player.
|
||||
ARMOR_DROP = true
|
||||
|
||||
-- Pulverise armor when a player dies, overrides ARMOR_DROP.
|
||||
ARMOR_DESTROY = false
|
||||
|
||||
-- You can use this to increase or decrease overall armor effectiveness,
|
||||
-- eg: ARMOR_LEVEL_MULTIPLIER = 0.5 will reduce armor level by half.
|
||||
ARMOR_LEVEL_MULTIPLIER = 1
|
||||
|
||||
-- You can use this to increase or decrease overall armor healing,
|
||||
-- eg: ARMOR_HEAL_MULTIPLIER = 0 will disable healing altogether.
|
||||
ARMOR_HEAL_MULTIPLIER = 1
|
||||
|
||||
-- You can also use this file to execute arbitary lua code
|
||||
-- eg: Dumb the armor down if using Simple Mobs
|
||||
if multicraft.get_modpath("mobs") then
|
||||
ARMOR_LEVEL_MULTIPLIER = 0.5
|
||||
ARMOR_HEAL_MULTIPLIER = 0
|
||||
end
|
||||
|
|
@ -0,0 +1,504 @@
|
|||
ARMOR_INIT_DELAY = 1
|
||||
ARMOR_INIT_TIMES = 1
|
||||
ARMOR_BONES_DELAY = 1
|
||||
ARMOR_UPDATE_TIME = 1
|
||||
ARMOR_DROP = multicraft.get_modpath("bones") ~= nil
|
||||
ARMOR_DESTROY = false
|
||||
ARMOR_LEVEL_MULTIPLIER = 1
|
||||
ARMOR_HEAL_MULTIPLIER = 1
|
||||
|
||||
local modpath = multicraft.get_modpath(ARMOR_MOD_NAME)
|
||||
local worldpath = multicraft.get_worldpath()
|
||||
local input = io.open(modpath.."/armor.conf", "r")
|
||||
if input then
|
||||
dofile(modpath.."/armor.conf")
|
||||
input:close()
|
||||
input = nil
|
||||
end
|
||||
input = io.open(worldpath.."/armor.conf", "r")
|
||||
if input then
|
||||
dofile(worldpath.."/armor.conf")
|
||||
input:close()
|
||||
input = nil
|
||||
end
|
||||
|
||||
local time = 0
|
||||
|
||||
armor = {
|
||||
player_hp = {},
|
||||
elements = {"head", "torso", "legs", "feet"},
|
||||
physics = {"jump","speed","gravity"},
|
||||
--[[formspec = "size[8,8.5]list[detached:player_name_armor;armor;0,1;2,3;]"
|
||||
.."image[2,0.75;2,4;armor_preview]"
|
||||
.."list[current_player;main;0,4.5;8,4;]"
|
||||
.."list[current_player;craft;4,1;3,3;]"
|
||||
.."list[current_player;craftpreview;7,2;1,1;]",]]
|
||||
textures = {},
|
||||
default_skin = "character",
|
||||
}
|
||||
|
||||
--[[if inventory_plus then
|
||||
armor.formspec = "size[8,8.5]button[0,0;2,0.5;main;Back]"
|
||||
.."list[detached:player_name_armor;armor;0,1;2,3;]"
|
||||
.."image[2.5,0.75;2,4;armor_preview]"
|
||||
.."label[5,1;Level: armor_level]"
|
||||
.."label[5,1.5;Heal: armor_heal]"
|
||||
.."list[current_player;main;0,4.5;8,4;]"
|
||||
elseif unified_inventory then
|
||||
unified_inventory.register_button("armor", {
|
||||
type = "image",
|
||||
image = "inventory_plus_armor.png",
|
||||
})
|
||||
unified_inventory.register_page("armor", {
|
||||
get_formspec = function(player)
|
||||
local name = player:get_player_name()
|
||||
local formspec = "background[0.06,0.99;7.92,7.52;3d_armor_ui_form.png]"
|
||||
.."label[0,0;Armor]"
|
||||
.."list[detached:"..name.."_armor;armor;0,1;2,3;]"
|
||||
.."image[2.5,0.75;2,4;"..armor.textures[name].preview.."]"
|
||||
.."label[5,1;Level: "..armor.def[name].level.."]"
|
||||
.."label[5,1.5;Heal: "..armor.def[name].heal.."]"
|
||||
return {formspec=formspec}
|
||||
end,
|
||||
})
|
||||
end]]
|
||||
|
||||
armor.def = {
|
||||
state = 0,
|
||||
count = 0,
|
||||
}
|
||||
|
||||
armor.update_player_visuals = function(self, player)
|
||||
if not player then
|
||||
return
|
||||
end
|
||||
local name = player:get_player_name()
|
||||
if self.textures[name] then
|
||||
default.player_set_textures(player, {
|
||||
self.textures[name].skin,
|
||||
self.textures[name].armor,
|
||||
self.textures[name].wielditem,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
armor.set_player_armor = function(self, player)
|
||||
if not player then
|
||||
return
|
||||
end
|
||||
local name = player:get_player_name()
|
||||
local player_inv = player:get_inventory()
|
||||
if not name then
|
||||
multicraft.log("error", "Failed to read player name")
|
||||
return
|
||||
elseif not player_inv then
|
||||
multicraft.log("error", "Failed to read player inventory")
|
||||
return
|
||||
end
|
||||
local armor_texture = "3d_armor_trans.png"
|
||||
local armor_level = 0
|
||||
local armor_heal = 0
|
||||
local state = 0
|
||||
local items = 0
|
||||
local elements = {}
|
||||
local textures = {}
|
||||
local physics_o = {speed=1,gravity=1,jump=1}
|
||||
local material = {type=nil, count=1}
|
||||
--local preview = armor:get_player_skin(name).."_preview.png"
|
||||
for _,v in ipairs(self.elements) do
|
||||
elements[v] = false
|
||||
end
|
||||
for i=1, 4 do
|
||||
local stack = player_inv:get_stack("armor", i)
|
||||
local item = stack:get_name()
|
||||
if stack:get_count() == 1 then
|
||||
local def = stack:get_definition()
|
||||
for k, v in pairs(elements) do
|
||||
if v == false then
|
||||
local level = def.groups["armor_"..k]
|
||||
if level then
|
||||
local texture = item:gsub("%:", "_")
|
||||
table.insert(textures, texture..".png")
|
||||
--preview = preview.."^"..texture.."_preview.png"
|
||||
armor_level = armor_level + level
|
||||
state = state + stack:get_wear()
|
||||
items = items + 1
|
||||
local heal = def.groups["armor_heal"] or 0
|
||||
armor_heal = armor_heal + heal
|
||||
for kk,vv in ipairs(self.physics) do
|
||||
local o_value = def.groups["physics_"..vv]
|
||||
if o_value then
|
||||
physics_o[vv] = physics_o[vv] + o_value
|
||||
end
|
||||
end
|
||||
local mat = string.match(item, "%:.+_(.+)$")
|
||||
if material.type then
|
||||
if material.type == mat then
|
||||
material.count = material.count + 1
|
||||
end
|
||||
else
|
||||
material.type = mat
|
||||
end
|
||||
elements[k] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--[[if multicraft.get_modpath("shields") then
|
||||
armor_level = armor_level * 0.9
|
||||
end]]
|
||||
if material.type and material.count == #self.elements then
|
||||
armor_level = armor_level * 1.1
|
||||
end
|
||||
armor_level = armor_level * ARMOR_LEVEL_MULTIPLIER
|
||||
armor_heal = armor_heal * ARMOR_HEAL_MULTIPLIER
|
||||
if #textures > 0 then
|
||||
armor_texture = table.concat(textures, "^")
|
||||
end
|
||||
local armor_groups = {fleshy=100}
|
||||
if armor_level > 0 then
|
||||
armor_groups.level = math.floor(armor_level / 20)
|
||||
armor_groups.fleshy = 100 - armor_level
|
||||
end
|
||||
player:set_armor_groups(armor_groups)
|
||||
player:set_physics_override(physics_o)
|
||||
self.textures[name].armor = armor_texture
|
||||
--self.textures[name].preview = preview
|
||||
self.def[name].state = state
|
||||
self.def[name].count = items
|
||||
self.def[name].level = armor_level
|
||||
self.def[name].heal = armor_heal
|
||||
self.def[name].jump = physics_o.jump
|
||||
self.def[name].speed = physics_o.speed
|
||||
self.def[name].gravity = physics_o.gravity
|
||||
self:update_player_visuals(player)
|
||||
end
|
||||
|
||||
armor.update_armor = function(self, player)
|
||||
if not player then
|
||||
return
|
||||
end
|
||||
local name = player:get_player_name()
|
||||
local hp = player:get_hp() or 0
|
||||
if hp == 0 or hp == self.player_hp[name] then
|
||||
return
|
||||
end
|
||||
if self.player_hp[name] > hp then
|
||||
local player_inv = player:get_inventory()
|
||||
local armor_inv = multicraft.get_inventory({type="detached", name=name.."_armor"})
|
||||
if not player_inv then
|
||||
multicraft.log("error", "Failed to read player inventory")
|
||||
return
|
||||
elseif not armor_inv then
|
||||
multicraft.log("error", "Failed to read detached inventory")
|
||||
return
|
||||
end
|
||||
local heal_max = 0
|
||||
local state = 0
|
||||
local items = 0
|
||||
for i=1, 6 do
|
||||
local stack = player_inv:get_stack("armor", i)
|
||||
if stack:get_count() > 0 then
|
||||
local use = stack:get_definition().groups["armor_use"] or 0
|
||||
local heal = stack:get_definition().groups["armor_heal"] or 0
|
||||
local item = stack:get_name()
|
||||
stack:add_wear(use)
|
||||
armor_inv:set_stack("armor", i, stack)
|
||||
player_inv:set_stack("armor", i, stack)
|
||||
state = state + stack:get_wear()
|
||||
items = items + 1
|
||||
if stack:get_count() == 0 then
|
||||
local desc = multicraft.registered_items[item].description
|
||||
if desc then
|
||||
multicraft.chat_send_player(name, "Your "..desc.." got destroyed!")
|
||||
end
|
||||
self:set_player_armor(player)
|
||||
armor:update_inventory(player)
|
||||
end
|
||||
heal_max = heal_max + heal
|
||||
end
|
||||
end
|
||||
self.def[name].state = state
|
||||
self.def[name].count = items
|
||||
heal_max = heal_max * ARMOR_HEAL_MULTIPLIER
|
||||
if heal_max > math.random(100) then
|
||||
player:set_hp(self.player_hp[name])
|
||||
return
|
||||
end
|
||||
end
|
||||
self.player_hp[name] = hp
|
||||
end
|
||||
|
||||
armor.get_player_skin = function(self, name)
|
||||
local skin = nil
|
||||
if skins then
|
||||
skin = skins.skins[name]
|
||||
elseif u_skins then
|
||||
skin = u_skins.u_skins[name]
|
||||
end
|
||||
return skin or armor.default_skin
|
||||
end
|
||||
|
||||
armor.get_armor_formspec = function(self, name)
|
||||
local formspec = armor.formspec:gsub("player_name", name)
|
||||
--formspec = formspec:gsub("armor_preview", armor.textures[name].preview)
|
||||
formspec = formspec:gsub("armor_level", armor.def[name].level)
|
||||
return formspec:gsub("armor_heal", armor.def[name].heal)
|
||||
end
|
||||
|
||||
--[[armor.update_inventory = function(self, player)
|
||||
local name = player:get_player_name()
|
||||
if unified_inventory then
|
||||
if unified_inventory.current_page[name] == "armor" then
|
||||
unified_inventory.set_inventory_formspec(player, "armor")
|
||||
end
|
||||
else
|
||||
local formspec = armor:get_armor_formspec(name)
|
||||
if inventory_plus then
|
||||
local page = player:get_inventory_formspec()
|
||||
if page:find("detached:"..name.."_armor") then
|
||||
inventory_plus.set_inventory_formspec(player, formspec)
|
||||
end
|
||||
else
|
||||
player:set_inventory_formspec(formspec)
|
||||
end
|
||||
end
|
||||
end]]
|
||||
|
||||
-- Register Player Model
|
||||
|
||||
default.player_register_model("3d_armor_character.x", {
|
||||
animation_speed = 30,
|
||||
textures = {
|
||||
armor.default_skin..".png",
|
||||
"3d_armor_trans.png",
|
||||
"3d_armor_trans.png",
|
||||
},
|
||||
animations = {
|
||||
stand = {x=0, y=79},
|
||||
lay = {x=162, y=166},
|
||||
walk = {x=168, y=187},
|
||||
mine = {x=189, y=198},
|
||||
walk_mine = {x=200, y=219},
|
||||
sit = {x=81, y=160},
|
||||
},
|
||||
})
|
||||
|
||||
-- Register Callbacks
|
||||
|
||||
multicraft.register_on_player_receive_fields(function(player, formname, fields)
|
||||
local name = player:get_player_name()
|
||||
if inventory_plus and fields.armor then
|
||||
local formspec = armor:get_armor_formspec(name)
|
||||
inventory_plus.set_inventory_formspec(player, formspec)
|
||||
return
|
||||
end
|
||||
for field, _ in pairs(fields) do
|
||||
if string.find(field, "skins_set_") then
|
||||
multicraft.after(0, function(player)
|
||||
local skin = armor:get_player_skin(name)
|
||||
armor.textures[name].skin = skin..".png"
|
||||
armor:set_player_armor(player)
|
||||
end, player)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
multicraft.register_on_joinplayer(function(player)
|
||||
default.player_set_model(player, "3d_armor_character.x")
|
||||
local name = player:get_player_name()
|
||||
local player_inv = player:get_inventory()
|
||||
local armor_inv = multicraft.create_detached_inventory(name.."_armor",{
|
||||
allow_put = function(inv, listname, index, stack, player)
|
||||
local item = stack:get_name()
|
||||
if not multicraft.registered_items[item] then return end
|
||||
if not multicraft.registered_items[item].groups then return end
|
||||
if multicraft.registered_items[item].groups['armor_head']
|
||||
and index == 1
|
||||
then
|
||||
return 1
|
||||
end
|
||||
if multicraft.registered_items[item].groups['armor_torso']
|
||||
and index == 2
|
||||
then
|
||||
return 1
|
||||
end
|
||||
if multicraft.registered_items[item].groups['armor_legs']
|
||||
and index == 3
|
||||
then
|
||||
return 1
|
||||
end
|
||||
if multicraft.registered_items[item].groups['armor_feet']
|
||||
and index == 4
|
||||
then
|
||||
return 1
|
||||
end
|
||||
return 0
|
||||
end,
|
||||
on_put = function(inv, listname, index, stack, player)
|
||||
player:get_inventory():set_stack(listname, index, stack)
|
||||
armor:set_player_armor(player)
|
||||
--armor:update_inventory(player)
|
||||
end,
|
||||
on_take = function(inv, listname, index, stack, player)
|
||||
player:get_inventory():set_stack(listname, index, nil)
|
||||
armor:set_player_armor(player)
|
||||
--armor:update_inventory(player)
|
||||
end,
|
||||
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||
local plaver_inv = player:get_inventory()
|
||||
local stack = inv:get_stack(to_list, to_index)
|
||||
player_inv:set_stack(to_list, to_index, stack)
|
||||
player_inv:set_stack(from_list, from_index, nil)
|
||||
armor:set_player_armor(player)
|
||||
--armor:update_inventory(player)
|
||||
end,
|
||||
allow_take = function(inv, listname, index, stack, player)
|
||||
return stack:get_count()
|
||||
end,
|
||||
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||
return 0
|
||||
end,
|
||||
})
|
||||
--[[if inventory_plus then
|
||||
inventory_plus.register_button(player,"armor", "Armor")
|
||||
end]]
|
||||
armor_inv:set_size("armor", 4)
|
||||
player_inv:set_size("armor", 4)
|
||||
for i=1, 4 do
|
||||
local stack = player_inv:get_stack("armor", i)
|
||||
armor_inv:set_stack("armor", i, stack)
|
||||
end
|
||||
|
||||
-- Legacy support, import player's armor from old inventory format
|
||||
for _,v in pairs(armor.elements) do
|
||||
local list = "armor_"..v
|
||||
armor_inv:add_item("armor", player_inv:get_stack(list, 1))
|
||||
player_inv:set_stack(list, 1, nil)
|
||||
end
|
||||
|
||||
armor.player_hp[name] = 0
|
||||
armor.def[name] = {
|
||||
state = 0,
|
||||
count = 0,
|
||||
level = 0,
|
||||
heal = 0,
|
||||
jump = 1,
|
||||
speed = 1,
|
||||
gravity = 1,
|
||||
}
|
||||
armor.textures[name] = {
|
||||
skin = armor.default_skin..".png",
|
||||
armor = "3d_armor_trans.png",
|
||||
wielditem = "3d_armor_trans.png",
|
||||
preview = armor.default_skin.."_preview.png",
|
||||
}
|
||||
if multicraft.get_modpath("skins") then
|
||||
local skin = skins.skins[name]
|
||||
if skin and skins.get_type(skin) == skins.type.MODEL then
|
||||
armor.textures[name].skin = skin..".png"
|
||||
end
|
||||
elseif multicraft.get_modpath("simple_skins") then
|
||||
local skin = skins.skins[name]
|
||||
if skin then
|
||||
armor.textures[name].skin = skin..".png"
|
||||
end
|
||||
--[[elseif multicraft.get_modpath("u_skins") then
|
||||
local skin = u_skins.u_skins[name]
|
||||
if skin and u_skins.get_type(skin) == u_skins.type.MODEL then
|
||||
armor.textures[name].skin = skin..".png"
|
||||
end]]
|
||||
end
|
||||
if multicraft.get_modpath("player_textures") then
|
||||
local filename = multicraft.get_modpath("player_textures").."/textures/player_"..name
|
||||
local f = io.open(filename..".png")
|
||||
if f then
|
||||
f:close()
|
||||
armor.textures[name].skin = "player_"..name..".png"
|
||||
end
|
||||
end
|
||||
for i=1, ARMOR_INIT_TIMES do
|
||||
multicraft.after(ARMOR_INIT_DELAY * i, function(player)
|
||||
armor:set_player_armor(player)
|
||||
if inventory_plus == nil and unified_inventory == nil then
|
||||
--armor:update_inventory(player)
|
||||
end
|
||||
end, player)
|
||||
end
|
||||
end)
|
||||
|
||||
if ARMOR_DROP == true or ARMOR_DESTROY == true then
|
||||
multicraft.register_on_dieplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
local pos = player:getpos()
|
||||
if name and pos then
|
||||
local drop = {}
|
||||
local player_inv = player:get_inventory()
|
||||
local armor_inv = multicraft.get_inventory({type="detached", name=name.."_armor"})
|
||||
for i=1, player_inv:get_size("armor") do
|
||||
local stack = armor_inv:get_stack("armor", i)
|
||||
if stack:get_count() > 0 then
|
||||
table.insert(drop, stack)
|
||||
armor_inv:set_stack("armor", i, nil)
|
||||
player_inv:set_stack("armor", i, nil)
|
||||
end
|
||||
end
|
||||
armor:set_player_armor(player)
|
||||
--[[if unified_inventory then
|
||||
unified_inventory.set_inventory_formspec(player, "craft")
|
||||
elseif inventory_plus then
|
||||
local formspec = inventory_plus.get_formspec(player,"main")
|
||||
inventory_plus.set_inventory_formspec(player, formspec)
|
||||
else
|
||||
armor:update_inventory(player)
|
||||
end]]
|
||||
if ARMOR_DESTROY == false then
|
||||
if multicraft.get_modpath("bones") then
|
||||
multicraft.after(ARMOR_BONES_DELAY, function()
|
||||
pos = vector.round(pos)
|
||||
local node = multicraft.get_node(pos)
|
||||
if node.name == "bones:bones" then
|
||||
local meta = multicraft.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
local inv = meta:get_inventory()
|
||||
if name == owner then
|
||||
for _,stack in ipairs(drop) do
|
||||
if inv:room_for_item("main", stack) then
|
||||
inv:add_item("main", stack)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
else
|
||||
for _,stack in ipairs(drop) do
|
||||
local obj = multicraft.add_item(pos, stack)
|
||||
if obj then
|
||||
local x = math.random(1, 5)
|
||||
if math.random(1,2) == 1 then
|
||||
x = -x
|
||||
end
|
||||
local z = math.random(1, 5)
|
||||
if math.random(1,2) == 1 then
|
||||
z = -z
|
||||
end
|
||||
obj:setvelocity({x=1/x, y=obj:getvelocity().y, z=1/z})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
multicraft.register_globalstep(function(dtime)
|
||||
time = time + dtime
|
||||
if time > ARMOR_UPDATE_TIME then
|
||||
for _,player in ipairs(multicraft.get_connected_players()) do
|
||||
armor:update_armor(player)
|
||||
end
|
||||
time = 0
|
||||
end
|
||||
end)
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
3d_armor -- Crafting Guide
|
||||
--------------------------
|
||||
|
||||
Helmets:
|
||||
|
||||
+---+---+---+
|
||||
| X | X | X |
|
||||
+---+---+---+
|
||||
| X | | X |
|
||||
+---+---+---+
|
||||
| | | |
|
||||
+---+---+---+
|
||||
|
||||
[3d_armor:helmet_wood] X = [default:wood]
|
||||
[3d_armor:helmet_steel] X = [default:steel_ingot]
|
||||
[3d_armor:helmet_bronze] X = [default:bronze_ingot]
|
||||
[3d_armor:helmet_diamond] X = [default:diamond]
|
||||
|
||||
Chestplates:
|
||||
|
||||
+---+---+---+
|
||||
| X | | X |
|
||||
+---+---+---+
|
||||
| X | X | X |
|
||||
+---+---+---+
|
||||
| X | X | X |
|
||||
+---+---+---+
|
||||
|
||||
[3d_armor:chestplate_wood] X = [default:wood]
|
||||
[3d_armor:chestplate_steel] X = [default:steel_ingot]
|
||||
[3d_armor:chestplate_bronze] X = [default:bronze_ingot]
|
||||
[3d_armor:chestplate_diamond] X = [default:diamond]
|
||||
|
||||
Leggings:
|
||||
|
||||
+---+---+---+
|
||||
| X | X | X |
|
||||
+---+---+---+
|
||||
| X | | X |
|
||||
+---+---+---+
|
||||
| X | | X |
|
||||
+---+---+---+
|
||||
|
||||
[3d_armor:leggings_wood] X = [default:wood]
|
||||
[3d_armor:leggings_steel] X = [default:steel_ingot]
|
||||
[3d_armor:leggings_bronze] X = [default:bronze_ingot]
|
||||
[3d_armor:leggings_diamond] X = [default:diamond]
|
||||
|
||||
Boots:
|
||||
|
||||
+---+---+---+
|
||||
| X | | X |
|
||||
+---+---+---+
|
||||
| X | | X |
|
||||
+---+---+---+
|
||||
|
||||
[3d_armor:boots_wood] X = [default:wood]
|
||||
[3d_armor:boots_steel] X = [default:steel_ingot]
|
||||
[3d_armor:boots_bronze] X = [default:bronze_ingot
|
||||
[3d_armor:boots_diamond] X = [default:diamond]
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
check
|
||||
default
|
||||
|
|
@ -0,0 +1,197 @@
|
|||
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
|
||||
ARMOR_MOD_NAME = multicraft.get_current_modname()
|
||||
dofile(multicraft.get_modpath(multicraft.get_current_modname()).."/armor.lua")
|
||||
|
||||
-- Regisiter Head Armor
|
||||
|
||||
multicraft.register_tool("3d_armor:helmet_leather", {
|
||||
description = "Leather Helmet",
|
||||
inventory_image = "3d_armor_inv_helmet_leather.png",
|
||||
groups = {armor_head=5, armor_heal=0, armor_use=100, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
|
||||
multicraft.register_tool("3d_armor:helmet_steel", {
|
||||
description = "Steel Helmet",
|
||||
inventory_image = "3d_armor_inv_helmet_steel.png",
|
||||
groups = {armor_head=10, armor_heal=5, armor_use=250, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
|
||||
multicraft.register_tool("3d_armor:helmet_gold", {
|
||||
description = "Golden Helmet",
|
||||
inventory_image = "3d_armor_inv_helmet_gold.png",
|
||||
groups = {armor_head=15, armor_heal=10, armor_use=500, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
|
||||
multicraft.register_tool("3d_armor:helmet_diamond",{
|
||||
description = "Diamond Helmet",
|
||||
inventory_image = "3d_armor_inv_helmet_diamond.png",
|
||||
groups = {armor_head=20, armor_heal=15, armor_use=750, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
|
||||
multicraft.register_tool("3d_armor:helmet_chain", {
|
||||
description = "Chain Helmet",
|
||||
inventory_image = "3d_armor_inv_helmet_chain.png",
|
||||
groups = {armor_head=15, armor_heal=10, armor_use=500, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
|
||||
-- Regisiter Torso Armor
|
||||
|
||||
multicraft.register_tool("3d_armor:chestplate_leather", {
|
||||
description = "Leather Chestplate",
|
||||
inventory_image = "3d_armor_inv_chestplate_leather.png",
|
||||
groups = {armor_torso=15, armor_heal=0, armor_use=100, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
|
||||
multicraft.register_tool("3d_armor:chestplate_steel", {
|
||||
description = "Steel Chestplate",
|
||||
inventory_image = "3d_armor_inv_chestplate_steel.png",
|
||||
groups = {armor_torso=20, armor_heal=5, armor_use=250, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
|
||||
multicraft.register_tool("3d_armor:chestplate_gold", {
|
||||
description = "Golden Chestplate",
|
||||
inventory_image = "3d_armor_inv_chestplate_gold.png",
|
||||
groups = {armor_torso=25, armor_heal=10, armor_use=500, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
|
||||
multicraft.register_tool("3d_armor:chestplate_diamond",{
|
||||
description = "Diamond Chestplate",
|
||||
inventory_image = "3d_armor_inv_chestplate_diamond.png",
|
||||
groups = {armor_torso=30, armor_heal=15, armor_use=750, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
|
||||
multicraft.register_tool("3d_armor:chestplate_chain", {
|
||||
description = "Chain Chestplate",
|
||||
inventory_image = "3d_armor_inv_chestplate_chain.png",
|
||||
groups = {armor_torso=25, armor_heal=10, armor_use=500, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
|
||||
-- Regisiter Leg Armor
|
||||
|
||||
multicraft.register_tool("3d_armor:leggings_leather", {
|
||||
description = "Leather Leggings",
|
||||
inventory_image = "3d_armor_inv_leggings_leather.png",
|
||||
groups = {armor_legs=10, armor_heal=0, armor_use=100, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
|
||||
multicraft.register_tool("3d_armor:leggings_steel", {
|
||||
description = "Steel Leggings",
|
||||
inventory_image = "3d_armor_inv_leggings_steel.png",
|
||||
groups = {armor_legs=15, armor_heal=5, armor_use=250, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
|
||||
multicraft.register_tool("3d_armor:leggings_gold", {
|
||||
description = "Golden Leggings",
|
||||
inventory_image = "3d_armor_inv_leggings_gold.png",
|
||||
groups = {armor_legs=20, armor_heal=10, armor_use=500, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
|
||||
multicraft.register_tool("3d_armor:leggings_diamond",{
|
||||
description = "Diamond Helmet",
|
||||
inventory_image = "3d_armor_inv_leggings_diamond.png",
|
||||
groups = {armor_legs=25, armor_heal=15, armor_use=750, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
|
||||
multicraft.register_tool("3d_armor:leggings_chain", {
|
||||
description = "Chain Leggings",
|
||||
inventory_image = "3d_armor_inv_leggings_chain.png",
|
||||
groups = {armor_legs=20, armor_heal=10, armor_use=500, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
-- Regisiter Boots
|
||||
|
||||
multicraft.register_tool("3d_armor:boots_leather", {
|
||||
description = "Leather Boots",
|
||||
inventory_image = "3d_armor_inv_boots_leather.png",
|
||||
groups = {armor_feet=5, armor_heal=0, armor_use=100, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
|
||||
multicraft.register_tool("3d_armor:boots_steel", {
|
||||
description = "Steel Boots",
|
||||
inventory_image = "3d_armor_inv_boots_steel.png",
|
||||
groups = {armor_feet=10, armor_heal=5, armor_use=250, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
|
||||
multicraft.register_tool("3d_armor:boots_gold", {
|
||||
description = "Golden Boots",
|
||||
inventory_image = "3d_armor_inv_boots_gold.png",
|
||||
groups = {armor_feet=15, armor_heal=10, armor_use=500, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
|
||||
multicraft.register_tool("3d_armor:boots_diamond",{
|
||||
description = "Diamond Helmet",
|
||||
inventory_image = "3d_armor_inv_boots_diamond.png",
|
||||
groups = {armor_feet=20, armor_heal=15, armor_use=750, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
|
||||
multicraft.register_tool("3d_armor:boots_chain", {
|
||||
description = "Chain Boots",
|
||||
inventory_image = "3d_armor_inv_boots_chain.png",
|
||||
groups = {armor_feet=15, armor_heal=10, armor_use=500, combat = 1},
|
||||
wear = 0,
|
||||
})
|
||||
|
||||
-- Register Craft Recipies
|
||||
|
||||
local craft_ingreds = {
|
||||
leather = "default:wood",
|
||||
steel = "default:steel_ingot",
|
||||
gold = "default:gold_ingot",
|
||||
diamond = "default:diamond",
|
||||
chain = "fire:fire",
|
||||
}
|
||||
|
||||
for k, v in pairs(craft_ingreds) do
|
||||
multicraft.register_craft({
|
||||
output = "3d_armor:helmet_"..k,
|
||||
recipe = {
|
||||
{v, v, v},
|
||||
{v, "", v},
|
||||
{"", "", ""},
|
||||
},
|
||||
})
|
||||
multicraft.register_craft({
|
||||
output = "3d_armor:chestplate_"..k,
|
||||
recipe = {
|
||||
{v, "", v},
|
||||
{v, v, v},
|
||||
{v, v, v},
|
||||
},
|
||||
})
|
||||
multicraft.register_craft({
|
||||
output = "3d_armor:leggings_"..k,
|
||||
recipe = {
|
||||
{v, v, v},
|
||||
{v, "", v},
|
||||
{v, "", v},
|
||||
},
|
||||
})
|
||||
multicraft.register_craft({
|
||||
output = "3d_armor:boots_"..k,
|
||||
recipe = {
|
||||
{v, "", v},
|
||||
{v, "", v},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
3D Armor - Visible Player Armor
|
||||
===============================
|
||||
|
||||
Source Code: Copyright (C) 2013 Stuart Jones - LGPL
|
||||
|
||||
Special credit to Jordach and MirceaKitsune for providing the default 3d character model.
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
Modpack - 3d Armor
|
||||
==================
|
||||
|
||||
[mod] Unified Skins [unified_skins]
|
||||
-----------------------------------
|
||||
|
||||
depends: default
|
||||
|
||||
A 3d character model re-texturing api used as the framework for this modpack.
|
||||
|
||||
Compatible with player skins mod [skins] by Zeg9 and Player Textures [player_textures] by sdzen.
|
||||
|
||||
Note: Currently only supports 64x32px player skins.
|
||||
|
||||
[mod] Visible Wielded Items [wieldview]
|
||||
---------------------------------------
|
||||
|
||||
depends: unified_skins
|
||||
|
||||
Makes hand wielded items visible to other players.
|
||||
|
||||
Note: Currently only supports 16x16px texture packs, sorry!
|
||||
|
||||
[mod] Visible Player Armor [3d_armor]
|
||||
-------------------------------------
|
||||
|
||||
depends: unified_skins, inventory_plus
|
||||
|
||||
Adds craftable armor that is visible to other players. Each armor item worn contributes to
|
||||
a player's armor group level making them less vulnerable to weapons.
|
||||
|
||||
Armor takes damage when a player is hurt, however, many armor items offer a 'stackable'
|
||||
percentage chance of restoring the lost health points.
|
||||
|
||||
[mod] Shields [shields]
|
||||
-------------------------------------
|
||||
|
||||
depends: 3d_armor
|
||||
|
||||
Originally a part of 3d_armor, shields have been re-included as an optional extra.
|
||||
If you do not want shields then simply remove the shields folder from the modpack.
|
|
@ -0,0 +1,7 @@
|
|||
A 3d character model re-texturing api used as the framework for this modpack.
|
||||
|
||||
depends: default
|
||||
|
||||
Compatible with player skins mod [skins] by Zeg9 and Player Textures [player_textures] by sdzen.
|
||||
|
||||
Note: Currently only 64x32px player skins.
|
|
@ -0,0 +1,2 @@
|
|||
check
|
||||
default
|
|
@ -0,0 +1,49 @@
|
|||
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
|
||||
--[[
|
||||
uniskins = {
|
||||
skin = {},
|
||||
armor = {},
|
||||
wielditem = {},
|
||||
default_skin = "character.png",
|
||||
default_texture = "uniskins_trans.png",
|
||||
}
|
||||
|
||||
uniskins.update_player_visuals = function(self, player)
|
||||
if not player then
|
||||
return
|
||||
end
|
||||
local name = player:get_player_name()
|
||||
player:set_properties({
|
||||
visual = "mesh",
|
||||
mesh = "uniskins_character.x",
|
||||
textures = {
|
||||
self.skin[name],
|
||||
self.armor[name],
|
||||
self.wielditem[name]
|
||||
},
|
||||
visual_size = {x=1, y=1},
|
||||
})
|
||||
end
|
||||
|
||||
multicraft.register_on_joinplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
uniskins.skin[name] = uniskins.default_skin
|
||||
uniskins.armor[name] = uniskins.default_texture
|
||||
uniskins.wielditem[name] = uniskins.default_texture
|
||||
if multicraft.get_modpath("player_textures") then
|
||||
local filename = multicraft.get_modpath("player_textures").."/textures/player_"..name
|
||||
local f = io.open(filename..".png")
|
||||
if f then
|
||||
f:close()
|
||||
uniskins.skin[name] = "player_"..name..".png"
|
||||
end
|
||||
end
|
||||
if multicraft.get_modpath("skins") then
|
||||
local skin = skins.skins[name]
|
||||
if skin and skins.get_type(skin) == skins.type.MODEL then
|
||||
uniskins.skin[name] = skin..".png"
|
||||
end
|
||||
end
|
||||
end)
|
||||
]]
|
|
@ -0,0 +1,17 @@
|
|||
[mod] visible wielded items [wieldview]
|
||||
=======================================
|
||||
|
||||
depends: default, unified_skins
|
||||
|
||||
Makes hand wielded items visible to other players. Compatible with player skins mod [skins].
|
||||
|
||||
Note: Currently only supports 16x16px texture packs, sorry!
|
||||
|
||||
default settings: [multicraft.conf]
|
||||
|
||||
# Set number of seconds between visible wielded item updates.
|
||||
wieldview_update_time = 2
|
||||
|
||||
# Show nodes as tiles, disabled by default
|
||||
wieldview_node_tiles = false
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
check
|
||||
default
|
||||
3d_armor
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
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
|
||||
local time = 0
|
||||
local update_time = tonumber(multicraft.setting_get("wieldview_update_time"))
|
||||
if not update_time then
|
||||
update_time = 2
|
||||
multicraft.setting_set("wieldview_update_time", tostring(update_time))
|
||||
end
|
||||
local node_tiles = multicraft.setting_getbool("wieldview_node_tiles")
|
||||
if not node_tiles then
|
||||
node_tiles = false
|
||||
multicraft.setting_set("wieldview_node_tiles", "false")
|
||||
end
|
||||
|
||||
wieldview = {
|
||||
wielded_item = {},
|
||||
transform = {},
|
||||
}
|
||||
|
||||
dofile(multicraft.get_modpath(multicraft.get_current_modname()).."/transform.lua")
|
||||
|
||||
wieldview.get_item_texture = function(self, item)
|
||||
local texture = "3d_armor_trans.png"
|
||||
if item ~= "" then
|
||||
if multicraft.registered_items[item] then
|
||||
local inventory_image = multicraft.registered_items[item].inventory_image
|
||||
if inventory_image and inventory_image ~= "" then
|
||||
texture = inventory_image
|
||||
elseif node_tiles == true and multicraft.registered_items[item].tiles then
|
||||
texture = multicraft.registered_items[item].tiles[1]
|
||||
end
|
||||
end
|
||||
if wieldview.transform[item] then
|
||||
texture = texture.."^[transform"..wieldview.transform[item]
|
||||
end
|
||||
end
|
||||
return texture
|
||||
end
|
||||
|
||||
wieldview.update_wielded_item = function(self, player)
|
||||
if not player then
|
||||
return
|
||||
end
|
||||
local name = player:get_player_name()
|
||||
local stack = player:get_wielded_item()
|
||||
local item = stack:get_name()
|
||||
if not item then
|
||||
return
|
||||
end
|
||||
if self.wielded_item[name] then
|
||||
if self.wielded_item[name] == item then
|
||||
return
|
||||
end
|
||||
armor.textures[name].wielditem = self:get_item_texture(item)
|
||||
armor:update_player_visuals(player)
|
||||
end
|
||||
self.wielded_item[name] = item
|
||||
end
|
||||
|
||||
multicraft.register_on_joinplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
wieldview.wielded_item[name] = ""
|
||||
multicraft.after(0, function(player)
|
||||
wieldview:update_wielded_item(player)
|
||||
end, player)
|
||||
end)
|
||||
|
||||
multicraft.register_globalstep(function(dtime)
|
||||
time = time + dtime
|
||||
if time > update_time then
|
||||
for _,player in ipairs(multicraft.get_connected_players()) do
|
||||
wieldview:update_wielded_item(player)
|
||||
end
|
||||
time = 0
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,24 @@
|
|||
-- Wielded Item Transformations - http://dev.multicraft.net/texture
|
||||
|
||||
wieldview_transform = {
|
||||
["default:torch"]="R270",
|
||||
["default:sapling"]="R270",
|
||||
["flowers:dandelion_white"]="R270",
|
||||
["flowers:dandelion_yellow"]="R270",
|
||||
["flowers:geranium"]="R270",
|
||||
["flowers:rose"]="R270",
|
||||
["flowers:tulip"]="R270",
|
||||
["flowers:viola"]="R270",
|
||||
["bucket:bucket_empty"]="R270",
|
||||
["bucket:bucket_water"]="R270",
|
||||
["bucket:bucket_lava"]="R270",
|
||||
["screwdriver:screwdriver"]="R270",
|
||||
["screwdriver:screwdriver1"]="R270",
|
||||
["screwdriver:screwdriver2"]="R270",
|
||||
["screwdriver:screwdriver3"]="R270",
|
||||
["screwdriver:screwdriver4"]="R270",
|
||||
["vessels:glass_bottle"]="R270",
|
||||
["vessels:drinking_glass"]="R270",
|
||||
["vessels:steel_bottle"]="R270",
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
check
|
||||
hud
|
|
@ -0,0 +1,536 @@
|
|||
|
||||
-----------------------------
|
||||
--- 4hunger mod by 4aiman ---
|
||||
-----------------------------
|
||||
--- license: GPLv3 ---
|
||||
-----------------------------
|
||||
|
||||
----
|
||||
---- Many thanks go to fairiestoy, who forced me to understand Lua a little bit more!
|
||||
|
||||
----
|
||||
|
||||
----
|
||||
---- Disclaimer 1 ----
|
||||
----
|
||||
-- This mod TRIES too copy MC hunger mechanics as described at wiki
|
||||
-- here: http://minecraft.gamepedia.com/Hunger#Mechanics and FAILS to do do:
|
||||
-- several things aren't covered due to internal differences of MT and MC.
|
||||
-- Those are subject to get added by some other mod(s), creation of which
|
||||
-- has began allready.
|
||||
----
|
||||
|
||||
----
|
||||
---- Disclaimer 2 ----
|
||||
----
|
||||
-- Since lua_api documentation sucks (it's of GREAT use nevertheless),
|
||||
-- I got inspired AND "guided" by some other mods that this one:
|
||||
-- 1. "Farming" from the "Minitest" game by PilzAdam. What hunger if
|
||||
-- there's nothing to eat?
|
||||
-- 2. "HUD & hunger". I make mistakes. Stupid ones too.
|
||||
-- But those ones, deliberately repeated by Blockman over and over,
|
||||
-- in spite of some community members' notions, were pissing me off so much,
|
||||
-- that I decided to edit his mod to fix 'em...
|
||||
-- That was when I saw that his "hunger" do NOT depend on taken by a player
|
||||
-- actions... That was a shame!
|
||||
-- So, I got my lazy butt up and wrote this hunger mod.
|
||||
-- 3. The "Sprint" mod by I-don't-know-who. Very useful. (The old one.)
|
||||
--
|
||||
----
|
||||
|
||||
--
|
||||
-- Feel free and welcomed to ask me to fix my grammar. But do not expect
|
||||
-- me to fix any mistake without telling me where it is. I'm not THAT good.
|
||||
--
|
||||
|
||||
--
|
||||
-- Update: added ethereal food. Fixed unsupported food crashes.
|
||||
--
|
||||
|
||||
--
|
||||
-- Update: added poison effects
|
||||
--
|
||||
|
||||
--
|
||||
-- Update: fixed poison/hunger effects, fixed bananas
|
||||
--
|
||||
|
||||
--
|
||||
-- Update: new sprinting code, ore types of exhaustion and tweaks
|
||||
--
|
||||
|
||||
--
|
||||
-- Update: ported for Multicraft
|
||||
--
|
||||
|
||||
max_save_time = 10
|
||||
save_time = 0
|
||||
max_drumsticks = 20
|
||||
foodTickTimerMAX = 5
|
||||
max_exhaustion = 8
|
||||
foodTickTimerMax = {}
|
||||
food_level = {}
|
||||
food_saturation = {}
|
||||
food_exhaustion = {}
|
||||
foodTickTimer = {}
|
||||
death_timer = {}
|
||||
walked_distance = {}
|
||||
oldHPs = {}
|
||||
oldpos = {}
|
||||
timers = {}
|
||||
state = {}
|
||||
jumped = {}
|
||||
keypress_track = {}
|
||||
hungerhud = {}
|
||||
hungerhudb = {}
|
||||
hearthud = {}
|
||||
hearthudb = {}
|
||||
need_to_update_ph = {}
|
||||
|
||||
|
||||
local ews = 0.01
|
||||
local esw = 0.015
|
||||
local esp = 0.025
|
||||
local ebr = 0.025
|
||||
local ejp = 0.2
|
||||
local eat = 0.3
|
||||
local edm = 0.3
|
||||
local ef1 = 0.5
|
||||
local ef2 = 1.5
|
||||
local esj = 0.8
|
||||
local erg = 3.0
|
||||
local eid = 0.001
|
||||
|
||||
local max_being_hungry_time = 120
|
||||
local keypress_cooldown = 0.3
|
||||
|
||||
local death_message = 'No one had fed him anything... Poor '
|
||||
|
||||
local function math_round(num)
|
||||
local pow = math.pow(10, 2)
|
||||
return ( math.floor( ( num * pow ) + 0.5 )/pow )
|
||||
end
|
||||
|
||||
local function save_4hunger()
|
||||
local output = io.open(multicraft.get_worldpath().."/4hunger.lua", "w")
|
||||
if output then
|
||||
local list = {
|
||||
[1]='foodTickTimerMax',
|
||||
[2]='food_level',
|
||||
[3]='food_saturation',
|
||||
[4]='food_exhaustion',
|
||||
[5]='foodTickTimer',
|
||||
[6]='walked_distance',
|
||||
[7]='oldHPs',
|
||||
[8]='oldpos',
|
||||
[9]='timers',
|
||||
[11]='state',
|
||||
[12]='eating',
|
||||
[13]='eat_timer',
|
||||
[14]='max_save_time',
|
||||
[15]='save_time',
|
||||
[16]='max_drumsticks',
|
||||
[17]='foodTickTimerMAX',
|
||||
[18]='max_exhaustion',
|
||||
[19]='death_timer',
|
||||
}
|
||||
for i,var in ipairs(list) do
|
||||
local o = multicraft.serialize(_G[var])
|
||||
local j = string.find(o, "return")
|
||||
local oo1 = string.sub(o, 1, j-1)
|
||||
local oo2 = string.sub(o, j-1, -1)
|
||||
output:write(oo1 .. "\n")
|
||||
output:write(var .." = multicraft.deserialize('" .. oo2 .. "')\n")
|
||||
end
|
||||
|
||||
io.close(output)
|
||||
end
|
||||
end
|
||||
|
||||
local function load_4hunger()
|
||||
local input = io.open(multicraft.get_worldpath().."/4hunger.lua", "r")
|
||||
if input then
|
||||
io.close(input)
|
||||
dofile(multicraft.get_worldpath().."/4hunger.lua")
|
||||
end
|
||||
end
|
||||
|
||||
if not pcall(load_4hunger) then
|
||||
print('Hunger data is corrupted! All 4hunger stuff will be re-initialized.')
|
||||
end
|
||||
|
||||
local function get_points(item) -- ToDo: redo to use groups!
|
||||
local fp,sp,ps,stack = 0,0,nil, false
|
||||
if item:find("ethereal:mushroom_plant") then fp,sp = 00.5, 01.0 end
|
||||
if item:find("4hunger:apple2") then fp,sp = 02.0, 06.4 end
|
||||
if item:find('apple') then fp,sp = 05.0, 06.0 end
|
||||
if item:find('gold_apple') then fp,sp = 04.0, 09.6 end
|
||||
if item:find('golden_apple') then fp,sp = 06.0, 09.6 end
|
||||
if item:find('gold_apple_2') then fp,sp = 04.0, 09.6 end
|
||||
if item:find('ethereal:banana') then fp,sp = 05.0, 0.01 end
|
||||
if item:find('banana_bread') then fp,sp = 06.0, 01.0 end
|
||||
if item:find('bread') then fp,sp = 05.0, 06.0 end
|
||||
if item:find('beef_raw') then fp,sp = 03.0, 01.8 end
|
||||
if item:find('steak') then fp,sp = 08.0, 12.8 end
|
||||
if item:find('cake') then fp,sp = 02.0, 00.4 end
|
||||
if item:find('carrot') then fp,sp = 04.0, 04.8 end
|
||||
if item:find('carrot_gold') then fp,sp = 06.0, 14.4 end
|
||||
if item:find('clownfish') then fp,sp = 00.2, 01.2 end
|
||||
if item:find('chicken_raw') then fp,sp = 02.0, 01.2 end
|
||||
if item:find('chicken_cooked') then fp,sp = 06.0, 07.2 end
|
||||
if item:find('coconut_slice') then fp,sp = 01.0, 01.0 end
|
||||
if item:find('fish_raw') then fp,sp = 02.0, 00.4 end
|
||||
if item:find('fish_cooked') then fp,sp = 05.0, 06.0 end
|
||||
if item:find('pine_nuts') then fp,sp = 00.1, 01.0 end
|
||||
if item:find('porkchop_raw') then fp,sp = 03.0, 01.8 end
|
||||
if item:find('porkchop_cooked') then fp,sp = 08.0, 12.8 end
|
||||
if item:find('potato') then fp,sp = 01.0, 00.6 end
|
||||
if item:find('potato_baked') then fp,sp = 02.0, 00.4 end
|
||||
if item:find('potato_poisonous') then fp,sp = 02.0, 01.2 end
|
||||
if item:find('salmon_raw') then fp,sp = 02.0, 00.4 end
|
||||
if item:find('salmon_cooked') then fp,sp = 06.0, 09.6 end
|
||||
if item:find('cookie') then fp,sp = 02.0, 00.4 end
|
||||
if item:find('melon_item') then fp,sp = 02.0, 01.2 end
|
||||
if item:find('melon_slice') then fp,sp = 02.0, 01.2 end
|
||||
if item:find('mushroom_stew') then fp,sp = 05.0, 00.2 end
|
||||
if item:find('hearty_stew') then fp,sp = 08.0, 04.2 end
|
||||
if item:find('hearty_stew_co') then fp,sp = 10.0, 06.2 end
|
||||
if item:find('mushroom_soup') then fp,sp = 04.0, 00.2 end
|
||||
if item:find('mushroom_soup_co') then fp,sp = 06.0, 07.2 end
|
||||
if item:find('pufferfish') then fp,sp = 01.0, 00.2 end
|
||||
if item:find('pumpkin_pie') then fp,sp = 08.0, 04.8 end
|
||||
if item:find('rotten_flesh') then fp,sp = 04.0, 00.8 end
|
||||
if item:find('spider_eye') then fp,sp = 02.0, 03.2 end
|
||||
if item:find('strawberry') then fp,sp = 01.0, 01.2 end
|
||||
if item:find('wild_onion') then fp,sp = 00.2, 01.6 end
|
||||
if item:find('fish_raw') then fp,sp = 02.0, 01.6 end
|
||||
if item:find('fish') then fp,sp = 04.0, 01.6 end
|
||||
if item:find('apple') then fp,sp = 04.0, 01.6 end
|
||||
if item:find('apple_gold') then fp,sp = 08.0, 01.6 end
|
||||
if item:find('carrot_item') then fp,sp = 01.0, 01.6 end
|
||||
if item:find('carrot_item_gold') then fp,sp = 03.0, 01.6 end
|
||||
if item:find('potato_item') then fp,sp = 02.0, 01.6 end
|
||||
if item:find('potato_item_baked')then fp,sp = 02.0, 01.6 end
|
||||
if item:find('bread') then fp,sp = 06.0, 01.6 end
|
||||
if item:find('cheese') then fp,sp = 04.0, 01.6 end
|
||||
if item:find('meat') then fp,sp = 08.0, 01.6 end
|
||||
if item:find('meat_raw') then fp,sp = 04.0, 01.6 end
|
||||
if item:find('rat_cooked') then fp,sp = 04.0, 01.6 end
|
||||
if item:find('pork_raw') then fp,sp = 03.0, 01.6 end
|
||||
if item:find('pork_cooked') then fp,sp = 08.0, 01.6 end
|
||||
if item:find('porkchop_raw') then fp,sp = 03.0, 01.6 end
|
||||
if item:find('porkchop_cooked') then fp,sp = 08.0, 01.6 end
|
||||
if item:find('chicken_cooked') then fp,sp = 06.0, 01.6 end
|
||||
if item:find('chicken_raw') then fp,sp = 02.0, 01.6 end
|
||||
if item:find('chicken_egg_fried')then fp,sp = 02.0, 01.6 end
|
||||
if item:find('milk') then fp,sp,ps,stack = 3,0,nil,"bucket:bucket_empty" end
|
||||
if item:find('rotten_flesh') then fp,sp = 01.2, 01.6 end
|
||||
if item:find('rotten') then ps = 1 end
|
||||
if item:find('poison') then ps = 1 end
|
||||
if item:find('bucket_cactus') then fp,sp,ps,stack = 2,0,nil,"bucket:bucket_empty" end
|
||||
|
||||
if fp~=0 and sp~=0
|
||||
then return fp,sp,ps,stack
|
||||
else return false
|
||||
end
|
||||
end
|
||||
|
||||
local old_eat=multicraft.item_eat
|
||||
|
||||
function multicraft.item_eat(food_points, saturation_points, replace_with_item)
|
||||
return function(itemstack, user, pointed_thing)
|
||||
if itemstack then
|
||||
local f = food_points
|
||||
if not user or not user:is_player() then return itemstack end
|
||||
local pll = user:get_player_name()
|
||||
local wstack = itemstack:get_name()
|
||||
if food_level[pll]>=max_drumsticks then return itemstack end
|
||||
local food_points,saturation_points,poisoned,restack
|
||||
if (not food_points)
|
||||
or (not saturation_points)
|
||||
then
|
||||
food_points,saturation_points,poisoned,restack = get_points(wstack)
|
||||
end
|
||||
if not food_points then old_eat(f) return end
|
||||
itemstack:take_item()
|
||||
if food_level[pll] then
|
||||
if food_level[pll]+food_points<=max_drumsticks then
|
||||
food_level[pll]=food_level[pll]+food_points
|
||||
else
|
||||
food_level[pll]=max_drumsticks
|
||||
end
|
||||
else
|
||||
food_level[pll]=max_drumsticks
|
||||
end
|
||||
if food_saturation[pll] then
|
||||
if food_saturation[pll]+saturation_points<=food_level[pll]
|
||||
then
|
||||
food_saturation[pll]=food_saturation[pll]+saturation_points
|
||||
else
|
||||
food_saturation[pll]=food_level[pll]
|
||||
end
|
||||
else -- if fs is NOT defined
|
||||
food_saturation[pll]=food_points
|
||||
end
|
||||
if poisoned then
|
||||
if poisoned==1 then state[pll] = 7 end
|
||||
if poisoned==2 then state[pll] = 8 end
|
||||
else
|
||||
state[pll] = -1
|
||||
end
|
||||
itemstack:add_item(replace_with_item)
|
||||
end
|
||||
if restack then return restack end
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
|
||||
function distance(pos1,pos2)
|
||||
if not pos1 or not pos2 then
|
||||
return 0
|
||||
end
|
||||
return math.sqrt( (pos1.x - pos2.x)^2 + (pos1.y - pos2.y)^2 + (pos1.z - pos2.z)^2 )
|
||||
end
|
||||
|
||||
function init_hunger(player)
|
||||
if player then
|
||||
local pll = player:get_player_name()
|
||||
if not foodTickTimerMax[pll] then foodTickTimerMax[pll]=foodTickTimerMAX end
|
||||
if not food_level[pll] then food_level[pll] = max_drumsticks end
|
||||
if not death_timer[pll] then death_timer[pll] = 0 end
|
||||
if not food_saturation[pll] then food_saturation[pll]=food_level[pll] end
|
||||
if not timers[pll] then timers[pll] = -1 end
|
||||
if not keypress_track[pll] then keypress_track[pll] = {} end
|
||||
|
||||
multicraft.after(0, function()
|
||||
if not player then return end
|
||||
hungerhudb[pll]=player:hud_add({
|
||||
hud_elem_type = "statbar",
|
||||
position = HUD_HUNGER_POS,
|
||||
size = HUD_SB_SIZE,
|
||||
text = "hud_hunger_bg.png",
|
||||
number = 20,
|
||||
alignment = {x=-1,y=-1},
|
||||
offset = HUD_HUNGER_OFFSET,
|
||||
})
|
||||
hungerhud[pll]=player:hud_add({
|
||||
hud_elem_type = "statbar",
|
||||
position = HUD_HUNGER_POS,
|
||||
size = HUD_SB_SIZE,
|
||||
text = "hud_hunger_fg.png",
|
||||
number = 20,
|
||||
alignment = {x=-1,y=-1},
|
||||
offset = HUD_HUNGER_OFFSET,
|
||||
})
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
multicraft.register_on_joinplayer(function(player)
|
||||
init_hunger(player)
|
||||
end)
|
||||
|
||||
local function get_field(item,field)
|
||||
if multicraft.registered_nodes[item] then return multicraft.registered_nodes[item][field] end
|
||||
if multicraft.registered_items[item] then return multicraft.registered_items[item][field] end
|
||||
if multicraft.registered_craftitems[item] then return multicraft.registered_craftitems[item][field] end
|
||||
if multicraft.registered_tools[item] then return multicraft.registered_tools[item][field] end
|
||||
return ""
|
||||
end
|
||||
|
||||
local function get_on_eat(item)
|
||||
return get_field(item,"on_eat")
|
||||
end
|
||||
|
||||
multicraft.after(0, function(dtime)
|
||||
local global_dtime = 0
|
||||
local doit = false
|
||||
multicraft.register_globalstep(function(dtime)
|
||||
global_dtime = global_dtime + dtime
|
||||
if global_dtime>1 then
|
||||
doit = true
|
||||
global_dtime = 0
|
||||
end
|
||||
if save_time > max_save_time then
|
||||
save_time=0
|
||||
save_4hunger()
|
||||
else
|
||||
save_time=save_time+dtime
|
||||
end
|
||||
local players = multicraft.get_connected_players()
|
||||
for i,player in ipairs(players) do
|
||||
local pll = player:get_player_name()
|
||||
local pos = player:getpos()
|
||||
local hp = player:get_hp()
|
||||
local control = player:get_player_control()
|
||||
local wstack = player:get_wielded_item():get_name()
|
||||
local bar
|
||||
local addex = 0
|
||||
if hp==1 and food_level[pll]<=0 and food_saturation[pll]<=0 then
|
||||
death_timer[pll] = death_timer[pll] + dtime
|
||||
end
|
||||
if not food_level[pll] then init_hunger(player) end
|
||||
if (death_timer[pll] or 0) > max_being_hungry_time then
|
||||
death_timer[pll] = 0
|
||||
multicraft.chat_send_all(death_message .. pll)
|
||||
food_level[pll] = max_drumsticks
|
||||
food_saturation[pll] = max_drumsticks
|
||||
food_exhaustion[pll] = 0
|
||||
player:set_hp(0)
|
||||
end
|
||||
|
||||
if state[pll] == 7 or state[pll] == 8 then
|
||||
if not timers[pll] then
|
||||
timers[pll] = 15
|
||||
player:hud_change(hungerhudb[pll],"text",'hunger_tile_d.png')
|
||||
player:hud_change(hungerhud[pll] ,"text",'hunger_tile_c.png')
|
||||
if doit==true and hp>1 then
|
||||
player:set_hp(hp-1)
|
||||
hp=hp-1
|
||||
end
|
||||
end
|
||||
if state == 7 then addex = addex + ef1
|
||||
elseif state == 8 then addex = addex + ef2 end
|
||||
end
|
||||
|
||||
if timers[pll] then
|
||||
timers[pll] = timers[pll] - dtime
|
||||
if timers[pll]<0 then
|
||||
timers[pll]=nil
|
||||
player:hud_change(hungerhudb[pll],"text", "hud_hunger_bg.png")
|
||||
player:hud_change(hungerhud[pll] ,"text", "hud_hunger_fg.png")
|
||||
else
|
||||
if doit==true and hp>1 then
|
||||
player:set_hp(hp-1)
|
||||
hp=hp-1
|
||||
end
|
||||
end
|
||||
end
|
||||
local hp_diff = 0
|
||||
if oldHPs[pll] and hp then
|
||||
hp_diff = oldHPs[pll]-hp
|
||||
end
|
||||
if hp_diff~=0 then
|
||||
state[pll] = 5
|
||||
addex = addex + edm
|
||||
player:hud_change(hearthud[pll],"number",hp)
|
||||
end
|
||||
oldHPs[pll] = hp
|
||||
local dist = distance(oldpos[pll],pos)
|
||||
if not jumped[pll] then
|
||||
local node = multicraft.get_node(pos)
|
||||
local name = node.name
|
||||
if name:find("air") then
|
||||
if state[pll] == 1 then
|
||||
state[pll] = 6
|
||||
addex = addex + esj
|
||||
else
|
||||
state[pll] = 3
|
||||
addex = addex + ejp
|
||||
end
|
||||
jumped[pll] = true
|
||||
else
|
||||
if dist and dist>0 then
|
||||
state[pll] = 0
|
||||
else
|
||||
state[pll] = -1
|
||||
end
|
||||
jumped[pll] = false
|
||||
end
|
||||
end
|
||||
pos.y=pos.y+1
|
||||
local node = multicraft.get_node(pos)
|
||||
local name = node.name
|
||||
if multicraft.get_item_group(name, "water") ~= 0 then
|
||||
state[pll] = 2
|
||||
end
|
||||
if food_level[pll]<=0 then food_level[pll] = 0 end
|
||||
if food_level[pll]==0 or (food_level[pll]>17 and food_level[pll]<=max_drumsticks)
|
||||
then
|
||||
if foodTickTimer[pll]
|
||||
then foodTickTimer[pll] = foodTickTimer[pll] + dtime
|
||||
else foodTickTimer[pll] = dtime
|
||||
end
|
||||
end
|
||||
if foodTickTimer[pll]>foodTickTimerMax[pll] then
|
||||
if food_level[pll]>17 and food_level[pll]<=max_drumsticks then
|
||||
if hp>0 then
|
||||
player:set_hp(hp+1)
|
||||
end
|
||||
elseif food_level[pll]==0 then
|
||||
if hp>1 then
|
||||
player:set_hp(hp-1)
|
||||
hp = hp-1
|
||||
end
|
||||
end
|
||||
foodTickTimer[pll] = 0
|
||||
end
|
||||
if not walked_distance[pll] then walked_distance[pll] = 0 end
|
||||
oldpos[pll]=pos
|
||||
walked_distance[pll] = walked_distance[pll] + dist
|
||||
if hp_diff<0 and hp>18 then state[pll]=10 end
|
||||
|
||||
if not state[pll] then state[pll]=-1 end
|
||||
if state[pll]==-1 then addex=addex+eid
|
||||
elseif state[pll]==00 then addex=addex+ews*dist
|
||||
elseif state[pll]==01 then addex=addex+esp*dist
|
||||
elseif state[pll]==02 then addex=addex+esw*dist
|
||||
elseif state[pll]==03 then addex=addex+ejp*dist
|
||||
elseif state[pll]==06 then addex=addex+esj*dist
|
||||
elseif state[pll]==09 then addex=addex+ebr
|
||||
elseif state[pll]==10 then addex=addex+erg*-hp_diff
|
||||
end
|
||||
if food_exhaustion[pll] then
|
||||
food_exhaustion[pll]=food_exhaustion[pll]+addex
|
||||
else
|
||||
food_exhaustion[pll]=addex
|
||||
end
|
||||
if food_exhaustion[pll]>max_exhaustion then
|
||||
if food_saturation[pll] then
|
||||
food_saturation[pll] = food_saturation[pll]-1
|
||||
if food_saturation[pll]<0 then food_saturation[pll]=0 end
|
||||
else
|
||||
food_saturation[pll] = food_level[pll]-1
|
||||
end
|
||||
if food_saturation[pll]==0 then food_level[pll]=food_level[pll]-1 end
|
||||
if food_level[pll]<0 then food_level[pll]=0 end
|
||||
food_exhaustion[pll] = 0
|
||||
end
|
||||
if hungerhud[pll] and food_level[pll] then
|
||||
player:hud_change(hungerhud[pll],"number",food_level[pll])
|
||||
end
|
||||
end
|
||||
doit = false
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
multicraft.register_on_dignode(function(pos, oldnode, digger)
|
||||
if not digger then return end
|
||||
local pll = digger:get_player_name()
|
||||
state[pll]=9
|
||||
if food_exhaustion[pll] then
|
||||
food_exhaustion[pll]=food_exhaustion[pll]+ebr
|
||||
else
|
||||
food_exhaustion[pll]=ebr
|
||||
end
|
||||
end)
|
||||
|
||||
multicraft.after(0,function(dtime)
|
||||
for cou,def in pairs(multicraft.registered_items) do
|
||||
if get_points(def['name']) ~= false then
|
||||
def['on_use'] = multicraft.item_eat(1)
|
||||
multicraft.register_item(':' .. def.name, def)
|
||||
end
|
||||
end
|
||||
end )
|
||||
|
||||
multicraft.register_chatcommand("hunger", {
|
||||
func = function(name, param)
|
||||
food_level[name] = 0
|
||||
food_saturation[name] = 0
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
print('[OK] 4hunger (Multicraft version) loaded')
|
|
@ -0,0 +1,2 @@
|
|||
check
|
||||
default
|
|
@ -0,0 +1,452 @@
|
|||
--Para ser usado no gerador aleatório.
|
||||
domb.aleatorio = nil
|
||||
|
||||
--Inicialização da variável aleatoria para que seja usada quando necessário.
|
||||
multicraft.after(0.01, function()
|
||||
domb.aleatorio=PseudoRandom(200 + (multicraft.get_timeofday()*100000))
|
||||
end)
|
||||
|
||||
-- Identifica vizinhança de um ponto, os pontos retornados tem a parte superior como ponto 1.
|
||||
-- Totaliza atualmente água, lava e ar. Contabiliza totais e separando fontes de fluindo.
|
||||
|
||||
function DOM_vizinhos(ponto)
|
||||
local p = {}
|
||||
local vx=0
|
||||
local vy=0
|
||||
local vz=0
|
||||
local tipo = ''
|
||||
local pontos = 0
|
||||
-- p.total = 0
|
||||
p.total_ar = 0
|
||||
p.total_lava = 0
|
||||
p.total_lava_fonte = 0
|
||||
p.total_agua = 0
|
||||
p.total_agua_fonte = 0
|
||||
p.n = {'','','','','',''}
|
||||
|
||||
--Começa pelo y (altura) de baixo para cima, sendo assim os 3 últimos testes serão os
|
||||
for vy=-1,1 do
|
||||
for vx=-1, 1 do
|
||||
for vz=-1,1 do
|
||||
p.n[pontos] = ''
|
||||
tipo = multicraft.get_node({x=(ponto.x + vx), y=(ponto.y + vy), z=(ponto.z + vz)}).name
|
||||
--print("Ponto pego: " .. tipo)
|
||||
-- Busca pontos onde dois eixos estejam zerados e um outro tenha valor.
|
||||
if vx==0 and vy==0 and vz==0 then
|
||||
-- Ignora caso seja exatamente o ponto testado.
|
||||
elseif (vx==0 and vy==0 and vz~= 0) or (vx==0 and vz==0 and vy~=0) or (vy==0 and vz==0 and vx~=0) then
|
||||
--print("Ponto: " .. tostring(vx) .. " " .. tostring(vy) .. " " .. tostring(vz) .. " (Pontos: " .. tostring(pontos) .. ")")
|
||||
--print("Tipo: " .. tipo)
|
||||
if tipo == "default:air" or tipo == "air" then
|
||||
p.total_ar = p.total_ar + 1
|
||||
--print("Ar contado, total de " .. tostring(p.total_ar))
|
||||
elseif tipo == "default:water_source" or tipo == "default:water_flowing" or tipo == "default:water" then
|
||||
p.total_agua = p.total_agua + 1
|
||||
--print("Agua contada, total de " .. tostring(p.total_agua) .. ", tipo:" .. tipo)
|
||||
if tipo == "default:water_source" then
|
||||
p.total_agua_fonte = p.total_agua_fonte + 1
|
||||
end
|
||||
elseif tipo == "default:lava_source" or tipo == "default:lava_flowing" then
|
||||
p.total_lava = p.total_lava + 1
|
||||
if tipo == "default:lava_source" then
|
||||
p.total_lava_fonte = p.total_lava_fonte + 1
|
||||
end
|
||||
end
|
||||
|
||||
p.n[pontos] = tipo
|
||||
pontos = pontos + 1
|
||||
--if(vx==0 and vz==0 and vy==-1) then
|
||||
--print("Ponto n para x=0, y=-1 e z=0 é o : " .. tostring(pontos))
|
||||
--end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
p.total_lava_corrente = p.total_lava - p.total_lava_fonte
|
||||
p.total_agua_corrente = p.total_agua - p.total_agua_fonte
|
||||
|
||||
-- print("Retornando total ar de :" .. tostring(p.total_ar))
|
||||
return(p)
|
||||
end
|
||||
|
||||
|
||||
--[[
|
||||
Rotina que pega o texto e remove eventuais símbolos não desejados.
|
||||
]]--
|
||||
|
||||
function DOM_remove_simbolos(texto)
|
||||
local t = ""
|
||||
|
||||
if texto == "" or texto == nil then
|
||||
return("")
|
||||
end
|
||||
|
||||
-- Remoção de símbolos proibidos.
|
||||
t=string.gsub(texto, "(%[)", "")
|
||||
t=string.gsub(t, "(%])", "")
|
||||
t=string.gsub(t, "(%()", "")
|
||||
t=string.gsub(t, "(%))", "")
|
||||
t=string.gsub(t, "(#)", "")
|
||||
t=string.gsub(t, "(@)", "")
|
||||
t=string.gsub(t, "(?)", "")
|
||||
t=string.gsub(t, "(!)", "")
|
||||
t=string.gsub(t, "($)", "")
|
||||
t=string.gsub(t, "(%%)", "")
|
||||
t=string.gsub(t, "(&)", "")
|
||||
t=string.gsub(t, "(*)", "")
|
||||
t=string.gsub(t, "(=)", "")
|
||||
|
||||
return(t)
|
||||
end
|
||||
|
||||
--[[
|
||||
Rotina que pega o texto e remove eventuais espaços no inicio, no final e espacos duplos no meio da string.
|
||||
]]--
|
||||
|
||||
function DOM_remove_espacos(texto)
|
||||
local t = ""
|
||||
|
||||
if texto == "" or texto == nil then
|
||||
return("")
|
||||
end
|
||||
t = texto
|
||||
|
||||
--Remove todos os espaços duplos que encontrar.
|
||||
while string.find(t," ") do
|
||||
t=string.gsub(texto, "( )", " ")
|
||||
end
|
||||
|
||||
--Remove espaços no final e no início do texto.
|
||||
t=string.trim(t)
|
||||
|
||||
return t
|
||||
end
|
||||
|
||||
|
||||
--[[
|
||||
Rotina usada para inspecionar elementos retornando um relatório na linha de comando.
|
||||
Aceita quantidade variável de parâmetros sendo:
|
||||
1) Arquivo
|
||||
2) Linha
|
||||
3) Teste
|
||||
4) Parâmetros
|
||||
|
||||
]]--
|
||||
function DOM_inspeciona_condicional(...)
|
||||
if(arg[3] ~= true) then return end
|
||||
|
||||
local a=0
|
||||
local linha= {tostring(debug.getinfo(2, 'l').currentline)}
|
||||
local arquivo = debug.getinfo(2, 'S').short_src or debug.getinfo(2,'S').source
|
||||
if string.len(arquivo) > 25 then
|
||||
arquivo = "..." arquivo:sub(string.len(arquivo)- 22)
|
||||
end
|
||||
|
||||
if arg[2] ~= nil then
|
||||
linha = arg[2]
|
||||
end
|
||||
|
||||
if arg[1] ~= nil then
|
||||
arquivo = arg[1]
|
||||
end
|
||||
|
||||
|
||||
|
||||
print("====================================== [DOM Inspeciona] =======")
|
||||
print(arquivo .. " [" .. linha .. "]")
|
||||
print(tostring(arg[4]))
|
||||
print("---------------------------------------------------------------")
|
||||
for a=5,#arg,1 do
|
||||
print(string.format("%s", dump(arg[a])))
|
||||
end
|
||||
print("");
|
||||
print("-------------------------------------- [DOM Inspeciona] ---Fim-")
|
||||
print(arquivo .. " [" .. linha .. "]")
|
||||
print("===============================================================")
|
||||
end
|
||||
|
||||
--[[
|
||||
Chama a rotina de inpecao sem a necessidade de passar a condicao.
|
||||
]]--
|
||||
|
||||
function DOM_inspeciona(...)
|
||||
local linha = debug.getinfo(2, 'l').currentline
|
||||
local arquivo = debug.getinfo(2, 'S').short_src or debug.getinfo(2,'S').source
|
||||
if string.len(arquivo) > 25 then
|
||||
arquivo = "..." .. arquivo:sub(arquivo:len(arquivo)- 22)
|
||||
end
|
||||
|
||||
DOM_inspeciona_condicional(arquivo,linha,true,...)
|
||||
end
|
||||
|
||||
--[[
|
||||
Inspeção simplificada que não necessita de valores adicionais, apenas o titulo. Mostra a linha
|
||||
--]]
|
||||
function DOM_inspeciona_r(titulo)
|
||||
if titulo == nil then
|
||||
titulo = ""
|
||||
end
|
||||
|
||||
local linha = debug.getinfo(2, 'l').currentline
|
||||
local arquivo = debug.getinfo(2, 'S').short_src or debug.getinfo(2,'S').source
|
||||
if string.len(arquivo) > 25 then
|
||||
arquivo = "..." arquivo:sub(string.len(arquivo)- 22)
|
||||
end
|
||||
|
||||
print(arquivo .. " [" .. linha .. "] " .. titulo)
|
||||
end
|
||||
|
||||
|
||||
--[[
|
||||
Realiza a união do string.format com o print simulando o printf do C++.
|
||||
--]]
|
||||
function DOM_print(...)
|
||||
print(string.format(...))
|
||||
end
|
||||
|
||||
--[[
|
||||
Permite envio de mensagens para o log no minitest ao invés do terminal, segue a formatação do string.format
|
||||
--]]
|
||||
function DOM_log(...)
|
||||
-- action, error, info
|
||||
multicraft.log("action", "[DOM]"..string.format(...))
|
||||
end
|
||||
|
||||
|
||||
--[[
|
||||
Centraliza os valores na matriz 5x5 de acordo com a largura e altura recebidas gerando automaticamente uma margem ao redor da fórmula.
|
||||
--]]
|
||||
function DOM_centraliza_matriz_5x5(matriz, largura, altura)
|
||||
--Centraliza se largura ou altura forem menores que 5.
|
||||
--Largura ou Altura/Critério: 5/Ignora, 4/Ignora, 3/1 de margem, 2/1 de margem, 1/2 de margem
|
||||
local i = 0
|
||||
a=matriz[1][3]
|
||||
if a~=nil then
|
||||
if string.find(a,"gravel") then
|
||||
i = 1
|
||||
end
|
||||
end
|
||||
--DOM_inspeciona("Rotina centraliza matriz: ",matriz)
|
||||
|
||||
local margem_superior = math.floor((5-altura)/2)
|
||||
local margem_lateral = math.floor((5-largura)/2)
|
||||
local d_a = margem_lateral
|
||||
local d_b = margem_superior
|
||||
|
||||
if margem_superior > 0 or margem_lateral > 0 then
|
||||
for a=5,margem_lateral+1,-1 do --Colunas
|
||||
for b=5,margem_superior+1,-1 do --Linhas
|
||||
-- Transfere valor da posição original para a deslocada tornando o valor da posição original como nulo.
|
||||
matriz[a][b] = matriz[a-d_a][b-d_b]
|
||||
matriz[a-d_a][b-d_b] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
--DOM_inspeciona("Matriz convertida:",matriz)
|
||||
|
||||
---DOM_inspeciona("Saida da rotina centraliza matriz: ",matriz)
|
||||
return matriz
|
||||
end
|
||||
|
||||
--[[
|
||||
Cria matriz 5x5 a patir de uma linha de itens separados por virgulas
|
||||
- Ignora itens a partir do sexto...
|
||||
--]]
|
||||
function DOM_cria_matriz_5x5(itens)
|
||||
local m_5x5={{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil}},{{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil}},{{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil}},{{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil}},{{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil},{nil,nil,nil,nil,nil}}
|
||||
local i = {}
|
||||
local a = 0
|
||||
local largura = 0
|
||||
|
||||
if itens ~= "" and itens ~= nil then
|
||||
if itens.find(itens,",") then
|
||||
else
|
||||
table.insert(i,itens)
|
||||
a = a + 1
|
||||
end
|
||||
end
|
||||
|
||||
while string.find(itens,",") do
|
||||
lido = string.sub(itens,1,itens.find(","))
|
||||
itens = string.sub(itens,itens.find(",")+1)
|
||||
table.insert(i,lido)
|
||||
a = a + 1
|
||||
end
|
||||
|
||||
largura = a
|
||||
while a < 5 do
|
||||
table.insert(i,nil)
|
||||
a = a + 1
|
||||
end
|
||||
|
||||
for a=1,5,1 do --Colunas
|
||||
-- Transfere valores para a linha 3.
|
||||
m_5x5[3][a] = i[a]
|
||||
end
|
||||
|
||||
m_5x5 = DOM_centraliza_matriz_5x5(m_5x5,largura,5)
|
||||
|
||||
return m_5x5
|
||||
end
|
||||
|
||||
--[[
|
||||
Converte valor posicional xyz para valor em texto separados por virgulas e sem espaços:
|
||||
<classe> -> "x,y,z"
|
||||
]]--
|
||||
function DOM_de_xyz_para_texto(valor)
|
||||
if valor==nil then
|
||||
return "0,0,0"
|
||||
end
|
||||
|
||||
local r = ""
|
||||
r = tostring(valor.x)..",".. tostring(valor.y) ..",".. tostring(valor.z)
|
||||
return r
|
||||
end
|
||||
|
||||
|
||||
--[[
|
||||
Converte valor posicional de texto para a classe xyz:
|
||||
"x,y,z" -> <classe>
|
||||
|
||||
|
||||
Convert values x,y,z in text to the class xyz:
|
||||
"x,y,z" -> <classe>
|
||||
]]--
|
||||
function DOM_de_texto_para_xyz(valor)
|
||||
if valor==nil or recebido == "" then
|
||||
return {x=0,y=0,z=0}
|
||||
end
|
||||
|
||||
--print("Recebido:".. dump(valor))
|
||||
local r={x=0,y=0,z=0}
|
||||
local d=valor
|
||||
r.x=tonumber(d:sub(1,string.find(d,",")-1))
|
||||
|
||||
d=d:sub(string.find(d,",")+1)
|
||||
r.y= tonumber(d:sub(1,string.find(d,",")-1))
|
||||
|
||||
d=d:sub(string.find(d,",")+1)
|
||||
r.z= tonumber(d)
|
||||
--print("Retorno:".. dump(r))
|
||||
return r
|
||||
end
|
||||
|
||||
|
||||
--[[
|
||||
Mensagem básica de carga
|
||||
Recebe:
|
||||
nome do modulo, caminho do modulo
|
||||
|
||||
Basic load message
|
||||
Params:
|
||||
module name, path of the module
|
||||
]]--
|
||||
function DOM_mb(m,c)
|
||||
-- multicraft.log("action", "[DOM]"..m.." loaded from "..multicraft.get_modpath(multicraft.get_current_modname()))
|
||||
multicraft.log("action", "[DOM]"..m.." is ready.")
|
||||
end
|
||||
|
||||
|
||||
|
||||
--[[
|
||||
Registra comando para chamar rotinas de apoio pelo chat com o comando /dom_util <comando> <parametros...>
|
||||
Comandos:
|
||||
apaga x y z Apaga node no lugar especificado.
|
||||
|
||||
if comando == "comando" then -- Comando?
|
||||
multicraft.chat_send_player(name, "[DOM]dom_util: ".."Comando?")
|
||||
elseif comando == "comando2" then -- Comando?
|
||||
multicraft.chat_send_player(name, "[DOM]dom_util: ".."Comando2?")
|
||||
end
|
||||
end
|
||||
|
||||
--]]
|
||||
function DOM_registra_comandos_de_uso_geral()
|
||||
end
|
||||
|
||||
--[[
|
||||
Quebra texto em lista utilizando espaços como delimitadores.
|
||||
--]]
|
||||
function DOM_quebra_texto_em_lista (texto)
|
||||
local lista = {}
|
||||
|
||||
lista = DOM_quebra_texto_em_lista_por_delimitador (texto, " ")
|
||||
|
||||
return lista
|
||||
end
|
||||
|
||||
--[[
|
||||
Quebra texto em lista utilizando delimitador pedido.
|
||||
--]]
|
||||
function DOM_quebra_texto_em_lista_por_delimitador (texto, delimitador)
|
||||
local lista = {}
|
||||
lista.tamanho = 0
|
||||
local t = ""
|
||||
local fatia = ""
|
||||
|
||||
if texto==nil or texto =="" then return nil end -- Caso texto recebido não seja válido retorna nulo
|
||||
if delimitador==nil or delimitador =="" then return nil end -- Caso delimitador recebido não seja válido retorna nulo
|
||||
|
||||
--print("Texto: \'"..dump(texto).."\'")
|
||||
t = texto
|
||||
if not t:find(delimitador) then -- Cria lista com um item caso não seja encontrado nenhum delimitador.
|
||||
table.insert(lista, t)
|
||||
lista.tamanho = 1
|
||||
end
|
||||
|
||||
while t:find(delimitador) do -- Enquanto o delimitador puder ser encontrado no texto, fica no laço.
|
||||
fatia = t:sub(1,t:find(delimitador)-1)
|
||||
table.insert(lista,fatia)
|
||||
lista.tamanho= lista.tamanho + 1
|
||||
|
||||
t = t:sub(t:find(delimitador)+1)
|
||||
|
||||
if not t:find(delimitador) then -- Adiciona o item que sobra ao final após o último delimitador ser removido.
|
||||
table.insert(lista,t)
|
||||
lista.tamanho= lista.tamanho + 1
|
||||
end
|
||||
end
|
||||
|
||||
--print("saída: "..dump(table.tamanho).." => "..dump(table))
|
||||
return lista
|
||||
end
|
||||
|
||||
--[[
|
||||
Copia ponto evitando que seja passada matriz por referência
|
||||
--]]
|
||||
function DOM_copia_ponto(origem,destino)
|
||||
--DOM_inspeciona("Copia ponto:",origem,destino)
|
||||
if destino == nil then
|
||||
destino = {}
|
||||
end
|
||||
|
||||
destino.x = tonumber(origem.x)
|
||||
destino.y = tonumber(origem.y)
|
||||
destino.z = tonumber(origem.z)
|
||||
|
||||
return destino
|
||||
end
|
||||
|
||||
-- Pega valores meta de um item, provavelmente se aplica a nodos.
|
||||
function DOM_get_item_meta (item)
|
||||
local r = {}
|
||||
local v = item["metadata"]
|
||||
|
||||
if v==nil then
|
||||
return r
|
||||
end
|
||||
|
||||
if string.find(v,"return {") then
|
||||
r = multicraft.deserialize(v)
|
||||
end
|
||||
|
||||
return r
|
||||
end
|
||||
|
||||
-- Associa valores meta a um item, provavelmente se aplica a nodos.
|
||||
function DOM_set_item_meta(i, v)
|
||||
local t = multicraft.serialize(v)
|
||||
|
||||
i["metadata"]=t
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
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
|
||||
domb = {}
|
||||
|
||||
--DOM base system library
|
||||
dofile(multicraft.get_modpath("domb").."/domb.lua")
|
||||
|
||||
DOM_registra_comandos_de_uso_geral()
|
|
@ -0,0 +1,3 @@
|
|||
check
|
||||
default
|
||||
domb
|
|
@ -0,0 +1,17 @@
|
|||
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
|
||||
--[[
|
||||
DOM, renew of the watch mod
|
||||
|
||||
Original from Echo, here: http://forum.multicraft.net/viewtopic.php?id=3795
|
||||
]]--
|
||||
|
||||
|
||||
--Rotinas usadas pelo mod
|
||||
dofile(multicraft.get_modpath("watch").."/rotinas.lua")
|
||||
|
||||
--Declarações dos objetos
|
||||
dofile(multicraft.get_modpath("watch").."/itens.lua")
|
||||
|
||||
-- Apenas para indicar que este módulo foi completamente carregado.
|
||||
DOM_mb(multicraft.get_current_modname(),multicraft.get_modpath(multicraft.get_current_modname()))
|
|
@ -0,0 +1,19 @@
|
|||
-- Watch recipe
|
||||
multicraft.register_craft({
|
||||
description = "Watch",
|
||||
output = 'watch:watch',
|
||||
recipe = {
|
||||
{'', 'default:gold_ingot', ''},
|
||||
{'default:gold_ingot', 'default:redstone_dust', 'default:gold_ingot'},
|
||||
{'', 'default:gold_ingot', ''}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
--Watch tool
|
||||
watch.registra_item("watch:watch",watch.images_a[3],true)
|
||||
|
||||
--Faces
|
||||
for a=0,11,1 do
|
||||
watch.registra_item("watch:watch_a"..tostring(a),watch.images_a[a+1],false)
|
||||
end
|
|
@ -0,0 +1,139 @@
|
|||
--[[
|
||||
DOM, renew of the watch mod
|
||||
|
||||
Original from Echo, here: http://forum.multicraft.net/viewtopic.php?id=3795
|
||||
]]--
|
||||
|
||||
watch = {}
|
||||
watch.ultimo_tempo = -1
|
||||
|
||||
-- Image of all 12 possible faces, only cover hours, a day is to short to lost time with game minutes... :-P
|
||||
watch.images_a = {
|
||||
"watch_a0.png",
|
||||
"watch_a1.png",
|
||||
"watch_a2.png",
|
||||
"watch_a3.png",
|
||||
"watch_a4.png",
|
||||
"watch_a5.png",
|
||||
"watch_a6.png",
|
||||
"watch_a7.png",
|
||||
"watch_a8.png",
|
||||
"watch_a9.png",
|
||||
"watch_a10.png",
|
||||
"watch_a11.png",
|
||||
}
|
||||
watch.images_d={
|
||||
"watch_d0.png",
|
||||
"watch_d1.png",
|
||||
"watch_d2.png",
|
||||
"watch_d3.png",
|
||||
"watch_d4.png",
|
||||
"watch_d5.png",
|
||||
"watch_d6.png",
|
||||
"watch_d7.png",
|
||||
"watch_d8.png",
|
||||
"watch_d9.png",
|
||||
"watch_d10.png",
|
||||
"watch_d11.png",
|
||||
}
|
||||
|
||||
--Catch the sever time and convert to hour, 12000 = 12h = 0.5, 6000 = 6h = 0.25
|
||||
function watch.pega_hora(tipo)
|
||||
local tempo_r = "12:00"
|
||||
local t = multicraft.get_timeofday()
|
||||
local tempo = t*24 -- Get the time
|
||||
local tempo_h = math.floor(tempo) -- Get 24h only, losting minutes
|
||||
local tempo_m =math.floor((tempo - tempo_h)*60) --Get only minutes
|
||||
|
||||
--Hour
|
||||
local tempo_h_12=tempo_h
|
||||
if tempo_h > 12 then -- Converte time to time in 12h format
|
||||
tempo_h_12 = tempo_h - 12
|
||||
end
|
||||
|
||||
if tipo==2 then -- hh
|
||||
return(tostring(tempo_h_12))
|
||||
end
|
||||
|
||||
tempo_r = tostring(tempo_h) .. ":"
|
||||
|
||||
--Minutes
|
||||
if tempo_m < 10 then -- Add a zero at left if need.
|
||||
tempo_r = tempo_r .. "0"
|
||||
end
|
||||
tempo_r = tempo_r .. tostring(tempo_m)
|
||||
|
||||
return(tempo_r) --HH:MM
|
||||
end
|
||||
|
||||
--When someone try use the watch.
|
||||
function watch.usa (itemstack, user, pointed_thing)
|
||||
item=itemstack:to_table()
|
||||
local meta=DOM_get_item_meta(item)
|
||||
local w_type="a"
|
||||
|
||||
if meta~=nil then
|
||||
w_type = meta["w_type"]
|
||||
end
|
||||
|
||||
--DOM_inspeciona_r("Valores no meta:"..dump(meta))
|
||||
--print("Relógio em modo: "..w_type)
|
||||
meta["time"] = watch.pega_hora(1)
|
||||
meta["w_type"] = w_type
|
||||
DOM_set_item_meta(item, meta)
|
||||
meta=DOM_get_item_meta(item)
|
||||
--DOM_inspeciona_r("Valores no meta:"..dump(meta))
|
||||
multicraft.chat_send_player(user:get_player_name(), "[Watch] Time now is:" .. meta["time"])
|
||||
|
||||
itemstack:replace(item)
|
||||
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- Register itens
|
||||
function watch.registra_item(nome,imagem,aparece_nas_receitas)
|
||||
local g = 1
|
||||
if aparece_nas_receitas then
|
||||
g = 0
|
||||
end
|
||||
|
||||
--DOM_inspeciona_r("Registrando item "..nome..","..imagem)
|
||||
multicraft.register_tool(nome, {
|
||||
description = "Watch",
|
||||
inventory_image = imagem,
|
||||
groups = {not_in_creative_inventory=g, tools = g},
|
||||
metadata = {w_type="d"},
|
||||
wield_image = "",
|
||||
stack_max = 1,
|
||||
on_use = watch.usa,
|
||||
})
|
||||
end
|
||||
|
||||
multicraft.register_globalstep(function(dtime)
|
||||
local t="a" -- d to digital, a to analogic
|
||||
|
||||
local now = watch.pega_hora(2)
|
||||
--DOM_inspeciona_r("Hora:"..now)
|
||||
if now == "12" then now = "0" end
|
||||
|
||||
if watch.ultimo_tempo == now then
|
||||
return
|
||||
end
|
||||
|
||||
watch.ultimo_tempo = now
|
||||
|
||||
|
||||
local players = multicraft.get_connected_players()
|
||||
for i,player in ipairs(players) do
|
||||
|
||||
if string.sub(player:get_wielded_item():get_name(), 0, 11) == "watch:watch" then
|
||||
player:set_wielded_item("watch:watch_"..t..now)
|
||||
end
|
||||
for i,stack in ipairs(player:get_inventory():get_list("main")) do
|
||||
if i<9 and string.sub(stack:get_name(), 0, 11) == "watch:watch" then
|
||||
player:get_inventory():remove_item("main", stack:get_name())
|
||||
player:get_inventory():add_item("main", "watch:watch_"..t..now)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,2 @@
|
|||
check
|
||||
default
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,26 @@
|
|||
multicraft mod "Beds"
|
||||
=======================
|
||||
version: 1.1
|
||||
|
||||
|
||||
License of source code: WTFPL
|
||||
-----------------------------
|
||||
author: BlockMen (2013)
|
||||
original author: PilzAdam
|
||||
|
||||
This program is free software. It comes without any warranty, to
|
||||
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
|
||||
To Public License, Version 2, as published by Sam Hocevar. See
|
||||
http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
|
||||
|
||||
--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.
|
||||
|
||||
|
||||
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.
|
|
@ -0,0 +1,3 @@
|
|||
check
|
||||
default
|
||||
wool
|
|
@ -0,0 +1,263 @@
|
|||
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
|
||||
local player_in_bed = 0
|
||||
local guy
|
||||
local hand
|
||||
local old_yaw = 0
|
||||
|
||||
local function get_dir(pos)
|
||||
local btop = "beds:bed_top"
|
||||
if multicraft.get_node({x=pos.x+1,y=pos.y,z=pos.z}).name == btop then
|
||||
return 7.9
|
||||
elseif multicraft.get_node({x=pos.x-1,y=pos.y,z=pos.z}).name == btop then
|
||||
return 4.75
|
||||
elseif multicraft.get_node({x=pos.x,y=pos.y,z=pos.z+1}).name == btop then
|
||||
return 3.15
|
||||
elseif multicraft.get_node({x=pos.x,y=pos.y,z=pos.z-1}).name == btop then
|
||||
return 6.28
|
||||
end
|
||||
end
|
||||
|
||||
function plock(start, max, tick, player, yaw)
|
||||
if start+tick < max then
|
||||
player:set_look_pitch(-1.2)
|
||||
player:set_look_yaw(yaw)
|
||||
multicraft.after(tick, plock, start+tick, max, tick, player, yaw)
|
||||
else
|
||||
player:set_look_pitch(0)
|
||||
if old_yaw ~= 0 then multicraft.after(0.1+tick, function() player:set_look_yaw(old_yaw) end) end
|
||||
end
|
||||
end
|
||||
|
||||
function exit(pos)
|
||||
local npos = multicraft.find_node_near(pos, 1, "beds:bed_bottom")
|
||||
if npos ~= nil then pos = npos end
|
||||
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}
|
||||
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}
|
||||
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}
|
||||
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}
|
||||
else
|
||||
return {x=pos.x,y=pos.y,z=pos.z}
|
||||
end
|
||||
end
|
||||
|
||||
multicraft.register_node("beds:bed_bottom", {
|
||||
description = "Bed",
|
||||
inventory_image = "beds_bed.png",
|
||||
wield_image = "beds_bed.png",
|
||||
wield_scale = {x=0.8,y=2.5,z=1.3},
|
||||
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"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
stack_max = 64,
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3, decorative = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5},
|
||||
|
||||
},
|
||||
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local node = multicraft.get_node(pos)
|
||||
local param2 = node.param2
|
||||
local npos = {x=pos.x, y=pos.y, z=pos.z}
|
||||
if param2 == 0 then
|
||||
npos.z = npos.z+1
|
||||
elseif param2 == 1 then
|
||||
npos.x = npos.x+1
|
||||
elseif param2 == 2 then
|
||||
npos.z = npos.z-1
|
||||
elseif param2 == 3 then
|
||||
npos.x = npos.x-1
|
||||
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
|
||||
multicraft.set_node(npos, {name="beds:bed_top", param2 = param2})
|
||||
else
|
||||
multicraft.dig_node(pos)
|
||||
return true
|
||||
end
|
||||
end,
|
||||
|
||||
on_destruct = function(pos)
|
||||
pos = multicraft.find_node_near(pos, 1, "beds:bed_top")
|
||||
if pos ~= nil then multicraft.remove_node(pos) end
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
if not clicker:is_player() then
|
||||
return
|
||||
end
|
||||
|
||||
if multicraft.get_timeofday() > 0.2 and multicraft.get_timeofday() < 0.805 then
|
||||
multicraft.chat_send_all("You can only sleep at night")
|
||||
return
|
||||
else
|
||||
clicker:set_physics_override(0,0,0)
|
||||
old_yaw = clicker:get_look_yaw()
|
||||
guy = clicker
|
||||
clicker:set_look_yaw(get_dir(pos))
|
||||
multicraft.chat_send_all("Good night")
|
||||
plock(0,2,0.1,clicker, get_dir(pos))
|
||||
end
|
||||
|
||||
if not clicker:get_player_control().sneak then
|
||||
local meta = multicraft.get_meta(pos)
|
||||
local param2 = node.param2
|
||||
if param2 == 0 then
|
||||
pos.z = pos.z+1
|
||||
elseif param2 == 1 then
|
||||
pos.x = pos.x+1
|
||||
elseif param2 == 2 then
|
||||
pos.z = pos.z-1
|
||||
elseif param2 == 3 then
|
||||
pos.x = pos.x-1
|
||||
end
|
||||
if clicker:get_player_name() == meta:get_string("player") then
|
||||
if param2 == 0 then
|
||||
pos.x = pos.x-1
|
||||
elseif param2 == 1 then
|
||||
pos.z = pos.z+1
|
||||
elseif param2 == 2 then
|
||||
pos.x = pos.x+1
|
||||
elseif param2 == 3 then
|
||||
pos.z = pos.z-1
|
||||
end
|
||||
pos.y = pos.y-0.5
|
||||
clicker:setpos(pos)
|
||||
meta:set_string("player", "")
|
||||
player_in_bed = player_in_bed-1
|
||||
elseif meta:get_string("player") == "" then
|
||||
pos.y = pos.y-0.5
|
||||
clicker:setpos(pos)
|
||||
meta:set_string("player", clicker:get_player_name())
|
||||
player_in_bed = player_in_bed+1
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
multicraft.register_node("beds:bed_top", {
|
||||
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"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {0, 0, 0, 0, 0, 0},
|
||||
},
|
||||
})
|
||||
|
||||
multicraft.register_alias("beds:bed", "beds:bed_bottom")
|
||||
|
||||
multicraft.register_craft({
|
||||
output = "beds:bed",
|
||||
recipe = {
|
||||
{"group:wool", "group:wool", "group:wool", },
|
||||
{"group:wood", "group:wood", "group:wood", }
|
||||
}
|
||||
})
|
||||
|
||||
beds_player_spawns = {}
|
||||
local file = io.open(multicraft.get_worldpath().."/beds_player_spawns", "r")
|
||||
if file then
|
||||
beds_player_spawns = multicraft.deserialize(file:read("*all"))
|
||||
file:close()
|
||||
end
|
||||
|
||||
local timer = 0
|
||||
local wait = false
|
||||
multicraft.register_globalstep(function(dtime)
|
||||
if timer<2 then
|
||||
timer = timer+dtime
|
||||
return
|
||||
end
|
||||
timer = 0
|
||||
|
||||
local players = #multicraft.get_connected_players()
|
||||
if players == player_in_bed and players ~= 0 then
|
||||
if multicraft.get_timeofday() < 0.2 or multicraft.get_timeofday() > 0.805 then
|
||||
if not wait then
|
||||
multicraft.after(2, function()
|
||||
multicraft.set_timeofday(0.23)
|
||||
wait = false
|
||||
guy:set_physics_override(1,1,1)
|
||||
guy:setpos(exit(guy:getpos()))
|
||||
|
||||
end)
|
||||
wait = true
|
||||
for _,player in ipairs(multicraft.get_connected_players()) do
|
||||
beds_player_spawns[player:get_player_name()] = player:getpos()
|
||||
end
|
||||
local file = io.open(multicraft.get_worldpath().."/beds_player_spawns", "w")
|
||||
if file then
|
||||
file:write(multicraft.serialize(beds_player_spawns))
|
||||
file:close()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
multicraft.register_on_respawnplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
if beds_player_spawns[name] then
|
||||
player:setpos(beds_player_spawns[name])
|
||||
return true
|
||||
end
|
||||
end)
|
||||
|
||||
multicraft.register_abm({
|
||||
nodenames = {"beds:bed_bottom"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
local meta = multicraft.get_meta(pos)
|
||||
if meta:get_string("player") ~= "" then
|
||||
local param2 = node.param2
|
||||
if param2 == 0 then
|
||||
pos.z = pos.z+1
|
||||
elseif param2 == 1 then
|
||||
pos.x = pos.x+1
|
||||
elseif param2 == 2 then
|
||||
pos.z = pos.z-1
|
||||
elseif param2 == 3 then
|
||||
pos.x = pos.x-1
|
||||
end
|
||||
local player = multicraft.get_player_by_name(meta:get_string("player"))
|
||||
if player == nil then
|
||||
meta:set_string("player", "")
|
||||
player_in_bed = player_in_bed-1
|
||||
return
|
||||
end
|
||||
local player_pos = player:getpos()
|
||||
player_pos.x = math.floor(0.5+player_pos.x)
|
||||
player_pos.y = math.floor(0.5+player_pos.y)
|
||||
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
|
||||
meta:set_string("player", "")
|
||||
player_in_bed = player_in_bed-1
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
if multicraft.setting_get("log_mods") then
|
||||
multicraft.log("action", "beds loaded")
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
check
|
||||
default
|
|
@ -0,0 +1,178 @@
|
|||
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
|
||||
--
|
||||
-- Helper functions
|
||||
--
|
||||
|
||||
local function is_water(pos)
|
||||
local nn = multicraft.get_node(pos).name
|
||||
return multicraft.get_item_group(nn, "water") ~= 0
|
||||
end
|
||||
|
||||
local function get_velocity(v, yaw, y)
|
||||
local x = -math.sin(yaw)*v
|
||||
local z = math.cos(yaw)*v
|
||||
return {x=x, y=y, z=z}
|
||||
end
|
||||
|
||||
--
|
||||
-- boat entity
|
||||
--
|
||||
local boat = {
|
||||
physical = true,
|
||||
collisionbox = {-1,-0.5,-1, 1,0.5,1},
|
||||
visual = "mesh",
|
||||
mesh = "boat_base.x",
|
||||
textures = {"boat_texture.png"},
|
||||
driver = nil,
|
||||
v = 0,
|
||||
stepcount = 0,
|
||||
unattended = 0
|
||||
}
|
||||
|
||||
function boat.on_rightclick(self, clicker)
|
||||
if not clicker or not clicker:is_player() then
|
||||
return
|
||||
end
|
||||
if self.driver and clicker == self.driver then
|
||||
self.driver = nil
|
||||
clicker:set_detach()
|
||||
elseif not self.driver then
|
||||
self.driver = clicker
|
||||
clicker:set_attach(self.object, "", {x=0,y=5,z=0}, {x=0,y=0,z=0})
|
||||
self.object:setyaw(clicker:get_look_yaw())
|
||||
end
|
||||
end
|
||||
|
||||
function boat.on_activate(self, staticdata, dtime_s)
|
||||
self.object:set_armor_groups({immortal=1})
|
||||
if staticdata then
|
||||
self.v = tonumber(staticdata)
|
||||
end
|
||||
end
|
||||
|
||||
function boat.get_staticdata()
|
||||
return tostring(v)
|
||||
end
|
||||
|
||||
function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, direction)
|
||||
|
||||
if self.driver then
|
||||
self.driver:set_detach()
|
||||
self.driver = nil
|
||||
boat.schedule_removal(self)
|
||||
if not multicraft.setting_getbool("creative_mode") then
|
||||
puncher:get_inventory():add_item("main", "boat:boat")
|
||||
end
|
||||
else
|
||||
|
||||
boat.schedule_removal(self)
|
||||
if not multicraft.setting_getbool("creative_mode") then
|
||||
puncher:get_inventory():add_item("main", "boat:boat")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function boat.on_step(self, dtime)
|
||||
|
||||
self.stepcount=self.stepcount+1
|
||||
if self.stepcount>9 then
|
||||
|
||||
self.stepcount=0
|
||||
|
||||
if self.driver then
|
||||
local ctrl = self.driver:get_player_control()
|
||||
|
||||
self.unattended=0
|
||||
|
||||
local yaw = self.object:getyaw()
|
||||
|
||||
if ctrl.up and self.v<3 then
|
||||
self.v = self.v + 1
|
||||
end
|
||||
|
||||
if ctrl.down and self.v>=-1 then
|
||||
self.v = self.v - 1
|
||||
end
|
||||
|
||||
if ctrl.left then
|
||||
if ctrl.down then
|
||||
self.object:setyaw(yaw-math.pi/12-dtime*math.pi/12)
|
||||
else
|
||||
self.object:setyaw(yaw+math.pi/12+dtime*math.pi/12)
|
||||
end
|
||||
end
|
||||
if ctrl.right then
|
||||
if ctrl.down then
|
||||
self.object:setyaw(yaw+math.pi/12+dtime*math.pi/12)
|
||||
else
|
||||
self.object:setyaw(yaw-math.pi/12-dtime*math.pi/12)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local tmp_velocity = get_velocity(self.v, self.object:getyaw(), 0)
|
||||
|
||||
local tmp_pos = self.object:getpos()
|
||||
|
||||
tmp_velocity.y=0
|
||||
|
||||
if is_water(tmp_pos) then
|
||||
tmp_velocity.y=2
|
||||
end
|
||||
|
||||
tmp_pos.y=tmp_pos.y-0.5
|
||||
|
||||
if multicraft.get_node(tmp_pos).name=="air" then
|
||||
tmp_velocity.y=-2
|
||||
end
|
||||
|
||||
self.object:setvelocity(tmp_velocity)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function boat.schedule_removal(self)
|
||||
|
||||
multicraft.after(0.25,function()
|
||||
self.object:remove()
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
|
||||
multicraft.register_entity("boat:boat", boat)
|
||||
|
||||
multicraft.register_craftitem("boat:boat", {
|
||||
description = "Boat",
|
||||
inventory_image = "boat_inventory.png",
|
||||
liquids_pointable = true,
|
||||
groups = {rail = 1},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
if not is_water(pointed_thing.under) then
|
||||
return
|
||||
end
|
||||
pointed_thing.under.y = pointed_thing.under.y+0.5
|
||||
multicraft.add_entity(pointed_thing.under, "boat:boat")
|
||||
if not multicraft.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = "boat:boat",
|
||||
recipe = {
|
||||
{"", "", ""},
|
||||
{"", "", ""},
|
||||
{"default:wood", "", ""},
|
||||
},
|
||||
})
|
||||
|
||||
multicraft.debug("[boat] Mod loaded")
|
|
@ -0,0 +1,2 @@
|
|||
check
|
||||
default
|
|
@ -0,0 +1,51 @@
|
|||
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
|
||||
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S;
|
||||
if (multicraft.get_modpath("intllib")) then
|
||||
dofile(multicraft.get_modpath("intllib").."/intllib.lua");
|
||||
S = intllib.Getter(multicraft.get_current_modname());
|
||||
else
|
||||
S = function ( s ) return s end;
|
||||
end
|
||||
|
||||
local function deepcopy ( t )
|
||||
local nt = { };
|
||||
for k, v in pairs(t) do
|
||||
if (type(v) == "table") then
|
||||
nt[k] = deepcopy(v);
|
||||
else
|
||||
nt[k] = v;
|
||||
end
|
||||
end
|
||||
return nt;
|
||||
end
|
||||
|
||||
local newbook = deepcopy(multicraft.registered_items["default:book"]);
|
||||
|
||||
newbook.on_use = function ( itemstack, user, pointed_thing )
|
||||
|
||||
local text = itemstack:get_metadata();
|
||||
|
||||
local formspec = "size[8,9]"..
|
||||
"background[-0.5,-0.5;9,10;book_bg.png]"..
|
||||
"textarea[0.5,0.25;7.5,9.25;text;;"..multicraft.formspec_escape(text).."]"..
|
||||
"button_exit[3,8.25;2,1;ok;Exit]";
|
||||
|
||||
multicraft.show_formspec(user:get_player_name(), "default:book", formspec);
|
||||
|
||||
end
|
||||
|
||||
multicraft.register_craftitem(":default:book", newbook);
|
||||
|
||||
multicraft.register_on_player_receive_fields(function ( player, formname, fields )
|
||||
if ((formname == "default:book") and fields and fields.text) then
|
||||
local stack = player:get_wielded_item();
|
||||
if (stack:get_name() and (stack:get_name() == "default:book")) then
|
||||
local t = stack:to_table();
|
||||
t.metadata = fields.text;
|
||||
player:set_wielded_item(ItemStack(t));
|
||||
end
|
||||
end
|
||||
end);
|
|
@ -0,0 +1,16 @@
|
|||
multicraft 0.4 mod: bucket
|
||||
=========================
|
||||
|
||||
License of source code:
|
||||
-----------------------
|
||||
Copyright (C) 2011-2012 Kahrl <kahrl@gmx.net>
|
||||
Copyright (C) 2011-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
http://www.gnu.org/licenses/lgpl-2.1.html
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
check
|
||||
default
|
||||
|
|
@ -0,0 +1,155 @@
|
|||
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
|
||||
-- multicraft 0.4 mod: bucket
|
||||
-- See README.txt for licensing and other information.
|
||||
|
||||
local LIQUID_MAX = 8 --The number of water levels when liquid_finite is enabled
|
||||
|
||||
multicraft.register_alias("bucket", "bucket:bucket_empty")
|
||||
multicraft.register_alias("bucket_water", "bucket:bucket_water")
|
||||
multicraft.register_alias("bucket_lava", "bucket:bucket_lava")
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'bucket:bucket_empty 1',
|
||||
recipe = {
|
||||
{'default:steel_ingot', '', 'default:steel_ingot'},
|
||||
{'', 'default:steel_ingot', ''},
|
||||
}
|
||||
})
|
||||
|
||||
bucket = {}
|
||||
bucket.liquids = {}
|
||||
|
||||
-- Register a new liquid
|
||||
-- source = name of the source node
|
||||
-- flowing = name of the flowing node
|
||||
-- itemname = name of the new bucket item (or nil if liquid is not takeable)
|
||||
-- inventory_image = texture of the new bucket item (ignored if itemname == nil)
|
||||
-- This function can be called from any mod (that depends on bucket).
|
||||
function bucket.register_liquid(source, flowing, itemname, inventory_image, name)
|
||||
bucket.liquids[source] = {
|
||||
source = source,
|
||||
flowing = flowing,
|
||||
itemname = itemname,
|
||||
}
|
||||
bucket.liquids[flowing] = bucket.liquids[source]
|
||||
|
||||
if itemname ~= nil then
|
||||
multicraft.register_craftitem(itemname, {
|
||||
description = name,
|
||||
inventory_image = inventory_image,
|
||||
stack_max = 1,
|
||||
liquids_pointable = true,
|
||||
groups = {misc=1},
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
-- Must be pointing to node
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
-- Call on_rightclick if the pointed node defines it
|
||||
if user and not user:get_player_control().sneak then
|
||||
local n = multicraft.get_node(pointed_thing.under)
|
||||
local nn = n.name
|
||||
if multicraft.registered_nodes[nn] and multicraft.registered_nodes[nn].on_rightclick then
|
||||
return multicraft.registered_nodes[nn].on_rightclick(pointed_thing.under, n, user, itemstack) or itemstack
|
||||
end
|
||||
end
|
||||
|
||||
local place_liquid = function(pos, node, source, flowing, fullness)
|
||||
if math.floor(fullness/128) == 1 or (not multicraft.setting_getbool("liquid_finite")) then
|
||||
multicraft.add_node(pos, {name=source, param2=fullness})
|
||||
return
|
||||
elseif node.name == flowing then
|
||||
fullness = fullness + node.param2
|
||||
elseif node.name == source then
|
||||
fullness = LIQUID_MAX
|
||||
end
|
||||
|
||||
if fullness >= LIQUID_MAX then
|
||||
multicraft.add_node(pos, {name=source, param2=LIQUID_MAX})
|
||||
else
|
||||
multicraft.add_node(pos, {name=flowing, param2=fullness})
|
||||
end
|
||||
end
|
||||
|
||||
-- Check if pointing to a buildable node
|
||||
local node = multicraft.get_node(pointed_thing.under)
|
||||
local fullness = tonumber(itemstack:get_metadata())
|
||||
if not fullness then fullness = LIQUID_MAX end
|
||||
|
||||
if multicraft.registered_nodes[node.name].buildable_to then
|
||||
-- buildable; replace the node
|
||||
local pns = user:get_player_name()
|
||||
if multicraft.is_protected(pointed_thing.under, pns) then
|
||||
return itemstack
|
||||
end
|
||||
place_liquid(pointed_thing.under, node, source, flowing, fullness)
|
||||
else
|
||||
-- not buildable to; place the liquid above
|
||||
-- check if the node above can be replaced
|
||||
local node = multicraft.get_node(pointed_thing.above)
|
||||
if multicraft.registered_nodes[node.name].buildable_to then
|
||||
local pn = user:get_player_name()
|
||||
if multicraft.is_protected(pointed_thing.above, pn) then
|
||||
return itemstack
|
||||
end
|
||||
place_liquid(pointed_thing.above, node, source, flowing, fullness)
|
||||
else
|
||||
-- do not remove the bucket with the liquid
|
||||
return
|
||||
end
|
||||
end
|
||||
return {name="bucket:bucket_empty"}
|
||||
end
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
multicraft.register_craftitem("bucket:bucket_empty", {
|
||||
description = "Empty Bucket",
|
||||
inventory_image = "bucket.png",
|
||||
stack_max = 1,
|
||||
liquids_pointable = true,
|
||||
groups = {misc = 1},
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
-- Must be pointing to node
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
-- Check if pointing to a liquid source
|
||||
node = multicraft.get_node(pointed_thing.under)
|
||||
liquiddef = bucket.liquids[node.name]
|
||||
if liquiddef ~= nil and liquiddef.itemname ~= nil and (node.name == liquiddef.source or
|
||||
(node.name == liquiddef.flowing and multicraft.setting_getbool("liquid_finite"))) then
|
||||
|
||||
multicraft.add_node(pointed_thing.under, {name="air"})
|
||||
|
||||
if node.name == liquiddef.source then node.param2 = LIQUID_MAX end
|
||||
return ItemStack({name = liquiddef.itemname, metadata = tostring(node.param2)})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
bucket.register_liquid(
|
||||
"default:water_source",
|
||||
"default:water_flowing",
|
||||
"bucket:bucket_water",
|
||||
"bucket_water.png",
|
||||
"Water Bucket"
|
||||
)
|
||||
|
||||
bucket.register_liquid(
|
||||
"default:lava_source",
|
||||
"default:lava_flowing",
|
||||
"bucket:bucket_lava",
|
||||
"bucket_lava.png",
|
||||
"Lava Bucket"
|
||||
)
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "bucket:bucket_lava",
|
||||
burntime = 60,
|
||||
replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}},
|
||||
})
|
|
@ -0,0 +1,38 @@
|
|||
=== BUILTIN_ITEM MOD for multicraft-C55 ===
|
||||
by PilzAdam
|
||||
|
||||
Features:
|
||||
This mod adds some new features to the builtin items:
|
||||
- The items are pushed by flowing water
|
||||
- The items are destroyed by lava
|
||||
- The items are removed after 300 seconds or the time that is specified by
|
||||
remove_items in multicraft.conf (0 disables it)
|
||||
|
||||
How to install:
|
||||
Unzip the archive an place it in multicraft-base-directory/mods/multicraft/
|
||||
if you have a windows client or a linux run-in-place client. If you have
|
||||
a linux system-wide instalation place it in ~/.multicraft/mods/multicraft/.
|
||||
If you want to install this mod only in one world create the folder
|
||||
worldmods/ in your worlddirectory.
|
||||
For further information or help see:
|
||||
http://wiki.multicraft.com/wiki/Installing_Mods
|
||||
|
||||
License:
|
||||
WTFPL (see below)
|
||||
|
||||
See also:
|
||||
http://multicraft.net/
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
|
@ -0,0 +1,2 @@
|
|||
check
|
||||
default
|
|
@ -0,0 +1,188 @@
|
|||
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
|
||||
multicraft.register_entity(":__builtin:item", {
|
||||
initial_properties = {
|
||||
hp_max = 1,
|
||||
physical = true,
|
||||
collisionbox = {-0.07,-0.07,-0.07, 0.07,0.07,0.07},
|
||||
visual = "sprite",
|
||||
visual_size = {x=0.5, y=0.5},
|
||||
textures = {""},
|
||||
spritediv = {x=1, y=1},
|
||||
initial_sprite_basepos = {x=0, y=0},
|
||||
is_visible = false,
|
||||
timer = 0,
|
||||
},
|
||||
|
||||
itemstring = '',
|
||||
physical_state = true,
|
||||
|
||||
set_item = function(self, itemstring)
|
||||
self.itemstring = itemstring
|
||||
local stack = ItemStack(itemstring)
|
||||
local itemtable = stack:to_table()
|
||||
local itemname = nil
|
||||
if itemtable then
|
||||
itemname = stack:to_table().name
|
||||
end
|
||||
local item_texture = nil
|
||||
local item_type = ""
|
||||
if multicraft.registered_items[itemname] then
|
||||
item_texture = multicraft.registered_items[itemname].inventory_image
|
||||
item_type = multicraft.registered_items[itemname].type
|
||||
end
|
||||
local prop = {
|
||||
is_visible = true,
|
||||
visual = "sprite",
|
||||
textures = {"unknown_item.png"}
|
||||
}
|
||||
if item_texture and item_texture ~= "" then
|
||||
prop.visual = "sprite"
|
||||
prop.textures = {item_texture}
|
||||
prop.visual_size = {x=0.50, y=0.50}
|
||||
else
|
||||
prop.visual = "wielditem"
|
||||
prop.textures = {itemname}
|
||||
prop.visual_size = {x=0.20, y=0.20}
|
||||
prop.automatic_rotate = math.pi * 0.25
|
||||
end
|
||||
self.object:set_properties(prop)
|
||||
end,
|
||||
|
||||
get_staticdata = function(self)
|
||||
--return self.itemstring
|
||||
return multicraft.serialize({
|
||||
itemstring = self.itemstring,
|
||||
always_collect = self.always_collect,
|
||||
timer = self.timer,
|
||||
})
|
||||
end,
|
||||
|
||||
on_activate = function(self, staticdata, dtime_s)
|
||||
if string.sub(staticdata, 1, string.len("return")) == "return" then
|
||||
local data = multicraft.deserialize(staticdata)
|
||||
if data and type(data) == "table" then
|
||||
self.itemstring = data.itemstring
|
||||
self.always_collect = data.always_collect
|
||||
self.timer = data.timer
|
||||
if not self.timer then
|
||||
self.timer = 0
|
||||
end
|
||||
self.timer = self.timer+dtime_s
|
||||
end
|
||||
else
|
||||
self.itemstring = staticdata
|
||||
end
|
||||
self.object:set_armor_groups({immortal=1})
|
||||
self.object:setvelocity({x=0, y=2, z=0})
|
||||
self.object:setacceleration({x=0, y=-10, z=0})
|
||||
self:set_item(self.itemstring)
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
local time = tonumber(multicraft.setting_get("remove_items"))
|
||||
if not time then
|
||||
time = 300
|
||||
end
|
||||
if not self.timer then
|
||||
self.timer = 0
|
||||
end
|
||||
self.timer = self.timer + dtime
|
||||
if time ~= 0 and (self.timer > time) then
|
||||
self.object:remove()
|
||||
end
|
||||
|
||||
local p = self.object:getpos()
|
||||
|
||||
local name = multicraft.get_node(p).name
|
||||
if name == "default:lava_flowing" or name == "default:lava_source" then
|
||||
multicraft.sound_play("builtin_item_lava", {pos=self.object:getpos()})
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
|
||||
if multicraft.registered_nodes[name].liquidtype == "flowing" then
|
||||
get_flowing_dir = function(self)
|
||||
local pos = self.object:getpos()
|
||||
local param2 = multicraft.get_node(pos).param2
|
||||
for i,d in ipairs({-1, 1, -1, 1}) do
|
||||
if i<3 then
|
||||
pos.x = pos.x+d
|
||||
else
|
||||
pos.z = pos.z+d
|
||||
end
|
||||
|
||||
local name = multicraft.get_node(pos).name
|
||||
local par2 = multicraft.get_node(pos).param2
|
||||
if name == "default:water_flowing" and par2 < param2 then
|
||||
return pos
|
||||
end
|
||||
|
||||
if i<3 then
|
||||
pos.x = pos.x-d
|
||||
else
|
||||
pos.z = pos.z-d
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local vec = get_flowing_dir(self)
|
||||
if vec then
|
||||
local v = self.object:getvelocity()
|
||||
if vec and vec.x-p.x > 0 then
|
||||
self.object:setvelocity({x=0.5,y=v.y,z=0})
|
||||
elseif vec and vec.x-p.x < 0 then
|
||||
self.object:setvelocity({x=-0.5,y=v.y,z=0})
|
||||
elseif vec and vec.z-p.z > 0 then
|
||||
self.object:setvelocity({x=0,y=v.y,z=0.5})
|
||||
elseif vec and vec.z-p.z < 0 then
|
||||
self.object:setvelocity({x=0,y=v.y,z=-0.5})
|
||||
end
|
||||
self.object:setacceleration({x=0, y=-10, z=0})
|
||||
self.physical_state = true
|
||||
self.object:set_properties({
|
||||
physical = true
|
||||
})
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
p.y = p.y - 0.3
|
||||
local nn = multicraft.get_node(p).name
|
||||
-- If node is not registered or node is walkably solid
|
||||
if not multicraft.registered_nodes[nn] or multicraft.registered_nodes[nn].walkable then
|
||||
if self.physical_state then
|
||||
self.object:setvelocity({x=0,y=0,z=0})
|
||||
self.object:setacceleration({x=0, y=0, z=0})
|
||||
self.physical_state = false
|
||||
self.object:set_properties({
|
||||
physical = false
|
||||
})
|
||||
end
|
||||
else
|
||||
if not self.physical_state then
|
||||
self.object:setvelocity({x=0,y=0,z=0})
|
||||
self.object:setacceleration({x=0, y=-10, z=0})
|
||||
self.physical_state = true
|
||||
self.object:set_properties({
|
||||
physical = true
|
||||
})
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
on_punch = function(self, hitter)
|
||||
if self.itemstring ~= '' then
|
||||
local left = hitter:get_inventory():add_item("main", self.itemstring)
|
||||
if not left:is_empty() then
|
||||
self.itemstring = left:to_string()
|
||||
return
|
||||
end
|
||||
end
|
||||
self.object:remove()
|
||||
end,
|
||||
})
|
||||
|
||||
if multicraft.setting_get("log_mods") then
|
||||
multicraft.log("action", "builtin_item loaded")
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
check
|
||||
default
|
|
@ -0,0 +1,170 @@
|
|||
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
|
||||
--[[
|
||||
#!#!#!#Cake mod created by Jordan4ibanez#!#!#
|
||||
#!#!#!#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"}
|
||||
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_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_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}
|
||||
|
||||
multicraft.register_craft({
|
||||
output = "cake:cake",
|
||||
recipe = {
|
||||
{'bucket:bucket_water', 'bucket:bucket_water', 'bucket:bucket_water'},
|
||||
{'default:sugar', 'default:leaves', 'default:sugar'},
|
||||
{'farming:wheat_harvested', 'farming:wheat_harvested', 'farming:wheat_harvested'},
|
||||
},
|
||||
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}},
|
||||
})
|
||||
|
||||
multicraft.register_node("cake:cake", {
|
||||
description = "Cake",
|
||||
tiles = {"cake_top.png","cake_bottom.png","cake_side.png","cake_side.png","cake_side.png","cake_side.png"},
|
||||
paramtype = "light",
|
||||
drawtype = "nodebox",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = slice_6
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = slice_6
|
||||
},
|
||||
is_ground_content = true,
|
||||
stack_max = 1,
|
||||
groups = {crumbly=3,falling_node=1, foodstuffs = 1},
|
||||
drop = '',
|
||||
--legacy_mineral = true,
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
if clicker:get_hp() < 20 then
|
||||
clicker:set_hp(clicker:get_hp()+2)
|
||||
multicraft.add_node(pos,{type="node",name="cake:cake_5",param2=param2})
|
||||
end
|
||||
end,
|
||||
})
|
||||
multicraft.register_node("cake:cake_5", {
|
||||
description = "Cake [5 Slices Left]",
|
||||
tiles = cake_texture,
|
||||
paramtype = "light",
|
||||
drawtype = "nodebox",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = slice_5
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = slice_5
|
||||
},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
|
||||
drop = '',
|
||||
--legacy_mineral = true,
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
if clicker:get_hp() < 20 then
|
||||
clicker:set_hp(clicker:get_hp()+2)
|
||||
multicraft.add_node(pos,{type="node",name="cake:cake_4",param2=param2})
|
||||
end
|
||||
end,
|
||||
})
|
||||
multicraft.register_node("cake:cake_4", {
|
||||
description = "Cake [4 Slices Left]",
|
||||
tiles = cake_texture,
|
||||
paramtype = "light",
|
||||
drawtype = "nodebox",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = slice_4
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = slice_4
|
||||
},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
|
||||
drop = '',
|
||||
--legacy_mineral = true,
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
if clicker:get_hp() < 20 then
|
||||
clicker:set_hp(clicker:get_hp()+2)
|
||||
multicraft.add_node(pos,{type="node",name="cake:cake_3",param2=param2})
|
||||
end
|
||||
end,
|
||||
})
|
||||
multicraft.register_node("cake:cake_3", {
|
||||
description = "Cake [3 Slices Left]",
|
||||
tiles = cake_texture,
|
||||
paramtype = "light",
|
||||
drawtype = "nodebox",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = slice_3
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = slice_3
|
||||
},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
|
||||
drop = '',
|
||||
--legacy_mineral = true,
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
if clicker:get_hp() < 20 then
|
||||
clicker:set_hp(clicker:get_hp()+2)
|
||||
multicraft.add_node(pos,{type="node",name="cake:cake_2",param2=param2})
|
||||
end
|
||||
end,
|
||||
})
|
||||
multicraft.register_node("cake:cake_2", {
|
||||
description = "Cake [2 Slices Left]",
|
||||
tiles = cake_texture,
|
||||
paramtype = "light",
|
||||
drawtype = "nodebox",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = slice_2
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = slice_2
|
||||
},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
|
||||
drop = '',
|
||||
--legacy_mineral = true,
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
if clicker:get_hp() < 20 then
|
||||
clicker:set_hp(clicker:get_hp()+2)
|
||||
multicraft.add_node(pos,{type="node",name="cake:cake_1",param2=param2})
|
||||
end
|
||||
end,
|
||||
})
|
||||
multicraft.register_node("cake:cake_1", {
|
||||
description = "Cake [1 Slice Left]",
|
||||
tiles = cake_texture,
|
||||
paramtype = "light",
|
||||
drawtype = "nodebox",
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = slice_1
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = slice_1
|
||||
},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3,falling_node=1,not_in_creative_inventory=1},
|
||||
drop = '',
|
||||
--legacy_mineral = true,
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
if clicker:get_hp() < 20 then
|
||||
clicker:set_hp(clicker:get_hp()+2)
|
||||
multicraft.remove_node(pos)
|
||||
end
|
||||
end,
|
||||
})
|
|
@ -0,0 +1,67 @@
|
|||
local check = {
|
||||
"3d_armor",
|
||||
"unified_skins",
|
||||
"wieldview",
|
||||
"adbs",
|
||||
"beds",
|
||||
"boat",
|
||||
"bookex",
|
||||
"bucket",
|
||||
"builtin_item",
|
||||
"cake",
|
||||
"command",
|
||||
"compass",
|
||||
"creative2",
|
||||
"inventory_plus",
|
||||
"creative",
|
||||
"death",
|
||||
"default",
|
||||
"domb",
|
||||
"watch",
|
||||
"doors",
|
||||
"dye",
|
||||
"farming",
|
||||
"fences",
|
||||
"fire",
|
||||
"flowers",
|
||||
"gemalde",
|
||||
"give_initial_stuff",
|
||||
"hardened_clay",
|
||||
"hud",
|
||||
"item_drop",
|
||||
"itemframes",
|
||||
"mapp",
|
||||
"playerplus",
|
||||
"player_textures",
|
||||
"potions",
|
||||
"protector",
|
||||
"mesecons_solarpanel",
|
||||
"mesecons_lightstone",
|
||||
"mesecons_alias",
|
||||
"mesecons_walllever",
|
||||
"mesecons_delayer",
|
||||
"mesecons_materials",
|
||||
"mesecons_mvps",
|
||||
"mesecons_extrawires",
|
||||
"mesecons_button",
|
||||
"mesecons_noteblock",
|
||||
"mesecons_pressureplates",
|
||||
"mesecons_torch",
|
||||
"mesecons",
|
||||
"mesecons_pistons",
|
||||
"mesecons_compatibility",
|
||||
"sethome",
|
||||
"signs",
|
||||
"sprint",
|
||||
"stairs",
|
||||
"throwing",
|
||||
"tnt",
|
||||
"vessels",
|
||||
"wallet",
|
||||
"wool",
|
||||
"xpanes",
|
||||
}
|
||||
|
||||
for _,mod in ipairs(check) do
|
||||
if not multicraft.get_modpath(mod) then os.exit() end
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
check
|
||||
default
|
|
@ -0,0 +1,24 @@
|
|||
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_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"
|
||||
|
||||
|
||||
multicraft.register_chatcommand("info", {
|
||||
params = "(blank) | update | version | creative",
|
||||
description = "To get info on stuff.",
|
||||
func = function(name, param)
|
||||
if param == "" then
|
||||
multicraft.chat_send_player(name, INFO_BLANK)
|
||||
end
|
||||
if param == "update" then
|
||||
multicraft.chat_send_player(name, INFO_UPDATE)
|
||||
end
|
||||
if param == "version" then
|
||||
multicraft.chat_send_player(name, INFO_VERSION)
|
||||
end
|
||||
if param == "creative" then
|
||||
multicraft.chat_send_player(name, INFO_CREATIVE)
|
||||
end
|
||||
end
|
||||
})
|
|
@ -0,0 +1,44 @@
|
|||
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
|
||||
local path = multicraft.get_modpath(multicraft.get_current_modname())
|
||||
|
||||
-- Load Info command
|
||||
dofile(path.."/info.lua")
|
||||
|
||||
-- Load vanish command
|
||||
dofile(path.."/vanish.lua")
|
||||
|
||||
-- Load time command
|
||||
dofile(path.."/time.lua")
|
||||
|
||||
-- Load kits command
|
||||
dofile(path.."/kits.lua")
|
||||
|
||||
-- By VanessaE, sfan5, and kaeza.
|
||||
local disallowed = {
|
||||
["guest"] = "Guest accounts are disallowed on this server. "..
|
||||
"Please choose a proper username and try again.",
|
||||
["^[0-9]+$"] = "All-numeric usernames are disallowed on this server. "..
|
||||
"Please choose a proper username and try again.",
|
||||
["[0-9].-[0-9].-[0-9].-[0-9].-[0-9]"] = "Too many numbers in your username. "..
|
||||
"Please try again with less than five digits in your username."
|
||||
}
|
||||
multicraft.register_on_prejoinplayer(function(name, ip)
|
||||
local lname = name:lower()
|
||||
for re, reason in pairs(disallowed) do
|
||||
if lname:find(re) then
|
||||
return reason
|
||||
end
|
||||
end
|
||||
|
||||
if #name < 2 then
|
||||
return "Too short of a username. "..
|
||||
"Please pick a name with at least two letters and try again."
|
||||
end
|
||||
|
||||
if #name > 30 then
|
||||
return "Too long username. "..
|
||||
"Please pick a name with no more 30 letters and try again."
|
||||
end
|
||||
|
||||
end)
|
|
@ -0,0 +1,26 @@
|
|||
multicraft.register_chatcommand("kit", {
|
||||
params = "",
|
||||
description = "Add a Kit to player",
|
||||
privs = {},
|
||||
func = function(name, param)
|
||||
if param == "" then
|
||||
multicraft.chat_send_player(name, "No kit selected use ... Aviable : noob , pvp")
|
||||
end
|
||||
local receiverref = core.get_player_by_name(name)
|
||||
if param == "noob" then
|
||||
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:torch 16')
|
||||
receiverref:get_inventory():add_item('main', 'default:axe_steel')
|
||||
receiverref:get_inventory():add_item('main', 'default:cobble 64')
|
||||
end
|
||||
if param == "pvp" then
|
||||
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', '3d_armor:helmet_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:boots_diamond')
|
||||
end
|
||||
end
|
||||
})
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
multicraft.register_chatcommand("night", {
|
||||
params = "",
|
||||
description = "Make the night",
|
||||
privs = {settime = true},
|
||||
func = function(name, param)
|
||||
local player = multicraft.get_player_by_name(name)
|
||||
if not player then
|
||||
return
|
||||
end
|
||||
multicraft.set_timeofday(0.22)
|
||||
end
|
||||
})
|
||||
|
||||
multicraft.register_chatcommand("day", {
|
||||
params = "",
|
||||
description = "Make the day wakeup",
|
||||
privs = {settime = true},
|
||||
func = function(name, param)
|
||||
local player = multicraft.get_player_by_name(name)
|
||||
if not player then
|
||||
return
|
||||
end
|
||||
multicraft.set_timeofday(0.6)
|
||||
end
|
||||
})
|
||||
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
vanished_players = {}
|
||||
|
||||
multicraft.register_privilege("vanish", "Allow to use /vanish command")
|
||||
|
||||
multicraft.register_chatcommand("vanish", {
|
||||
params = "",
|
||||
description = "Make user invisible at eye of all",
|
||||
privs = {vanish = true},
|
||||
func = function(name, param)
|
||||
local prop
|
||||
vanished_players[name] = not vanished_players[name]
|
||||
|
||||
if vanished_players[name] then
|
||||
prop = {visual_size = {x=0, y=0}, collisionbox = {0,0,0,0,0,0}}
|
||||
else
|
||||
-- default player size
|
||||
prop = {visual_size = {x=1, y=1},
|
||||
collisionbox = {-0.35, -1, -0.35, 0.35, 1, 0.35}}
|
||||
end
|
||||
|
||||
multicraft.get_player_by_name(name):set_properties(prop)
|
||||
end
|
||||
})
|
|
@ -0,0 +1,2 @@
|
|||
default
|
||||
check
|
|
@ -0,0 +1,76 @@
|
|||
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
|
||||
|
||||
local default_spawn_settings = multicraft.setting_get("static_spawnpoint")
|
||||
|
||||
multicraft.register_globalstep(function(dtime)
|
||||
local players = multicraft.get_connected_players()
|
||||
for i,player in ipairs(players) do
|
||||
local function has_compass(player)
|
||||
for _,stack in ipairs(player:get_inventory():get_list("main")) do
|
||||
if multicraft.get_item_group(stack:get_name(), "compass") ~= 0 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
if has_compass(player) then
|
||||
local spawn = beds_player_spawns[player:get_player_name()] or
|
||||
multicraft.setting_get("static_spawnpoint") or
|
||||
{x=0,y=0,z=0}
|
||||
pos = player:getpos()
|
||||
dir = player:get_look_yaw()
|
||||
local angle_north = math.deg(math.atan2(spawn.x - pos.x, spawn.z - pos.z))
|
||||
if angle_north < 0 then angle_north = angle_north + 360 end
|
||||
angle_dir = 90 - math.deg(dir)
|
||||
local angle_relative = (angle_north - angle_dir) % 360
|
||||
local compass_image = math.floor((angle_relative/30) + 0.5)%12
|
||||
|
||||
for j,stack in ipairs(player:get_inventory():get_list("main")) do
|
||||
if multicraft.get_item_group(stack:get_name(), "compass") ~= 0 and
|
||||
multicraft.get_item_group(stack:get_name(), "compass")-1 ~= compass_image then
|
||||
player:get_inventory():set_stack("main", j, "compass:"..compass_image)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local images = {
|
||||
"compass_0.png",
|
||||
"compass_1.png",
|
||||
"compass_2.png",
|
||||
"compass_3.png",
|
||||
"compass_4.png",
|
||||
"compass_5.png",
|
||||
"compass_6.png",
|
||||
"compass_7.png",
|
||||
"compass_8.png",
|
||||
"compass_9.png",
|
||||
"compass_10.png",
|
||||
"compass_11.png",
|
||||
}
|
||||
|
||||
local i
|
||||
for i,img in ipairs(images) do
|
||||
local inv = 1
|
||||
if i == 1 then
|
||||
inv = 0
|
||||
end
|
||||
multicraft.register_tool("compass:"..(i-1), {
|
||||
description = "Compass",
|
||||
inventory_image = img,
|
||||
wield_image = img,
|
||||
stack_max = 1,
|
||||
groups = {not_in_creative_inventory=inv,compass=i, tools = inv}
|
||||
})
|
||||
end
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'compass:1',
|
||||
recipe = {
|
||||
{'', 'default:iron_ingot', ''},
|
||||
{'default:iron_ingot', 'default_redstone_dust', 'default:iron_ingot'},
|
||||
{'', 'default:iron_ingot', ''}
|
||||
}
|
||||
})
|
|
@ -0,0 +1,31 @@
|
|||
multicraft mod "Crafting"
|
||||
=======================
|
||||
version: 2.0.1
|
||||
|
||||
License of source code and Textures: WTFPL
|
||||
------------------------------------
|
||||
Copyright (c) 2013-2014 BlockMen
|
||||
|
||||
This program is free software. It comes without any warranty, to
|
||||
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
|
||||
To Public License, Version 2, as published by Sam Hocevar. See
|
||||
http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
|
||||
|
||||
--USING the mod--
|
||||
=================
|
||||
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
|
||||
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.
|
||||
|
||||
Workbench
|
||||
=========
|
||||
With following recipe you craft a workbench (aka crafting table):
|
||||
|
||||
wood wood
|
||||
wood wood
|
||||
|
||||
The workbench has a 3x3 crafting grid, that allows to use all recipes.
|
|
@ -0,0 +1,34 @@
|
|||
multicraft mod "Crafting"
|
||||
=======================
|
||||
Version: 2.0.1
|
||||
|
||||
License of source code and Textures: WTFPL
|
||||
------------------------------------
|
||||
copyright (c) 2013-2014 by BlockMen
|
||||
|
||||
This program is free software. It comes without any warranty, to
|
||||
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
|
||||
To Public License, Version 2, as published by Sam Hocevar. See
|
||||
http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
|
||||
|
||||
--USING the mod--
|
||||
=================
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
|
||||
Workbench
|
||||
_________
|
||||
|
||||
With following recipe you craft a workbench (aka crafting table):
|
||||
|
||||
wood wood
|
||||
wood wood
|
||||
|
||||
The workbench has a 3x3 crafting grid, that allows to use all recipes.
|
|
@ -0,0 +1,397 @@
|
|||
crafting = {}
|
||||
crafting.creative_inventory_size = 0
|
||||
crafting.start_is = {}
|
||||
crafting.pages = {}
|
||||
|
||||
function init()
|
||||
local inv = multicraft.create_detached_inventory("creative", {
|
||||
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||
if multicraft.setting_getbool("creative_mode") then
|
||||
return count
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
allow_put = function(inv, listname, index, stack, player)
|
||||
return 0
|
||||
end,
|
||||
allow_take = function(inv, listname, index, stack, player)
|
||||
if multicraft.setting_getbool("creative_mode") then
|
||||
return -1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||
end,
|
||||
on_put = function(inv, listname, index, stack, player)
|
||||
end,
|
||||
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))
|
||||
if stack then
|
||||
print("stack:get_name()="..dump(stack:get_name())..", stack:get_count()="..dump(stack:get_count()))
|
||||
end
|
||||
end,
|
||||
})
|
||||
set_inv("all")
|
||||
end
|
||||
|
||||
function set_inv(filter, player)
|
||||
local inv = multicraft.get_inventory({type="detached", name="creative"})
|
||||
inv:set_size("main", 0)
|
||||
local creative_list = {}
|
||||
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 filter ~= "" then
|
||||
if filter == "#blocks" then
|
||||
if multicraft.registered_items[def.name]
|
||||
and multicraft.registered_items[def.name].groups
|
||||
and multicraft.registered_items[def.name].groups.building
|
||||
then
|
||||
table.insert(creative_list, name)
|
||||
end
|
||||
elseif filter == "#deco" then
|
||||
if multicraft.registered_items[def.name]
|
||||
and multicraft.registered_items[def.name].groups
|
||||
and multicraft.registered_items[def.name].groups.decorative
|
||||
then
|
||||
table.insert(creative_list, name)
|
||||
end
|
||||
elseif filter == "#mese" then
|
||||
if multicraft.registered_items[def.name]
|
||||
and multicraft.registered_items[def.name].groups
|
||||
and multicraft.registered_items[def.name].groups.mese
|
||||
then
|
||||
table.insert(creative_list, name)
|
||||
end
|
||||
elseif filter == "#rail" then
|
||||
if multicraft.registered_items[def.name]
|
||||
and multicraft.registered_items[def.name].groups
|
||||
and multicraft.registered_items[def.name].groups.rail
|
||||
then
|
||||
table.insert(creative_list, name)
|
||||
end
|
||||
elseif filter == "#misc" then
|
||||
if multicraft.registered_items[def.name]
|
||||
and multicraft.registered_items[def.name].groups
|
||||
and multicraft.registered_items[def.name].groups.misc
|
||||
then
|
||||
table.insert(creative_list, name)
|
||||
end
|
||||
elseif filter == "#food" then
|
||||
if multicraft.registered_items[def.name]
|
||||
and multicraft.registered_items[def.name].groups
|
||||
and multicraft.registered_items[def.name].groups.foodstuffs
|
||||
then
|
||||
table.insert(creative_list, name)
|
||||
end
|
||||
elseif filter == "#tools" then
|
||||
if multicraft.registered_items[def.name]
|
||||
and multicraft.registered_items[def.name].groups
|
||||
and multicraft.registered_items[def.name].groups.tools
|
||||
then
|
||||
table.insert(creative_list, name)
|
||||
end
|
||||
elseif filter == "#combat" then
|
||||
if multicraft.registered_items[def.name]
|
||||
and multicraft.registered_items[def.name].groups
|
||||
and multicraft.registered_items[def.name].groups.combat
|
||||
then
|
||||
table.insert(creative_list, name)
|
||||
end
|
||||
elseif filter == "#matr" then
|
||||
if multicraft.registered_items[def.name]
|
||||
and multicraft.registered_items[def.name].groups
|
||||
and multicraft.registered_items[def.name].groups.materials
|
||||
then
|
||||
table.insert(creative_list, name)
|
||||
end
|
||||
elseif filter == "#brew" then
|
||||
if multicraft.registered_items[def.name]
|
||||
and multicraft.registered_items[def.name].groups
|
||||
and multicraft.registered_items[def.name].groups.brewing
|
||||
then
|
||||
table.insert(creative_list, name)
|
||||
end
|
||||
elseif filter == "all" then
|
||||
table.insert(creative_list, name)
|
||||
else --for all other
|
||||
if string.find(string.lower(def.name), filter) or string.find(string.lower(def.description), filter) then
|
||||
table.insert(creative_list, name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
table.sort(creative_list)
|
||||
inv:set_size("main", #creative_list)
|
||||
for _,itemstring in ipairs(creative_list) do
|
||||
inv:add_item("main", ItemStack(itemstring))
|
||||
end
|
||||
crafting.creative_inventory_size = #creative_list
|
||||
--print("creative inventory size: "..dump(crafting.creative_inventory_size))
|
||||
end
|
||||
|
||||
-- Create the trash field
|
||||
local trash = multicraft.create_detached_inventory("creative_trash", {
|
||||
allow_put = function(inv, listname, index, stack, player)
|
||||
if multicraft.setting_getbool("creative_mode") then
|
||||
return stack:get_count()
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
on_put = function(inv, listname, index, stack, player)
|
||||
inv:set_stack(listname, index, "")
|
||||
end,
|
||||
})
|
||||
trash:set_size("main", 1)
|
||||
|
||||
|
||||
-- Create detached creative inventory after loading all mods
|
||||
multicraft.after(0, init)
|
||||
|
||||
local offset = {}
|
||||
local hoch = {}
|
||||
local bg = {}
|
||||
offset["blocks"] = "-0.29,-0.25"
|
||||
offset["deco"] = "0.98,-0.25"
|
||||
offset["mese"] = "2.23,-0.25"
|
||||
offset["rail"] = "3.495,-0.25"
|
||||
offset["misc"] = "4.75,-0.25"
|
||||
offset["nix"] = "8.99,-0.25"
|
||||
offset["food"] = "-0.29,8.12"
|
||||
offset["tools"] = "0.98,8.12"
|
||||
offset["combat"] = "2.23,8.12"
|
||||
offset["brew"] = "4.78,8.12"
|
||||
offset["matr"] = "3.495,8.12"
|
||||
offset["inv"] = "8.99,8.12"
|
||||
|
||||
hoch["blocks"] = ""
|
||||
hoch["deco"] = ""
|
||||
hoch["mese"] = ""
|
||||
hoch["rail"] = ""
|
||||
hoch["misc"] = ""
|
||||
hoch["nix"] = ""
|
||||
hoch["food"] = "^[transformfy"
|
||||
hoch["tools"] = "^[transformfy"
|
||||
hoch["combat"] = "^[transformfy"
|
||||
hoch["brew"] = "^[transformfy"
|
||||
hoch["matr"] = "^[transformfy"
|
||||
hoch["inv"] = "^[transformfy"
|
||||
|
||||
local dark_bg = "crafting_creative_bg_dark.png"
|
||||
|
||||
local function reset_menu_item_bg()
|
||||
bg["blocks"] = dark_bg
|
||||
bg["deco"] = dark_bg
|
||||
bg["mese"] = dark_bg
|
||||
bg["rail"] = dark_bg
|
||||
bg["misc"] = dark_bg
|
||||
bg["nix"] = dark_bg
|
||||
bg["food"] = dark_bg
|
||||
bg["tools"] = dark_bg
|
||||
bg["combat"] = dark_bg
|
||||
bg["brew"] = dark_bg
|
||||
bg["matr"] = dark_bg
|
||||
bg["inv"] = dark_bg
|
||||
end
|
||||
|
||||
|
||||
crafting.set_creative_formspec = function(player, start_i, pagenum, show, page, scroll)
|
||||
reset_menu_item_bg()
|
||||
pagenum = math.floor(pagenum) or 1
|
||||
local pagemax = math.floor((crafting.creative_inventory_size) / (9*5) + 1)
|
||||
local slider_height = 4/pagemax
|
||||
local slider_pos = slider_height*(pagenum-1)+2.25
|
||||
local player_name = player:get_player_name()
|
||||
crafting.start_is[player_name] = start_i
|
||||
crafting.pages[player_name] = page
|
||||
local formspec = ""
|
||||
local main_list = "list[detached:creative;main;0,1.75;9,5;"..tostring(start_i).."]"
|
||||
local name = "nix"
|
||||
if page ~= nil then name = page end
|
||||
bg[name] = "crafting_creative_bg.png"
|
||||
if name == "inv" then
|
||||
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]"..
|
||||
"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,2.55;1,1;1]"..
|
||||
"list[detached:"..player_name.."_armor;armor;1,1.55;1,1;2]"..
|
||||
"list[detached:"..player_name.."_armor;armor;1,2.55;1,1;3]"
|
||||
end
|
||||
formspec = "size[10,9.3]"..
|
||||
"background[-0.19,-0.25;10.5,9.87;crafting_inventory_creative.png]"..
|
||||
"bgcolor[#080808BB;true]"..
|
||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
||||
"label[-5,-5;"..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[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[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[9.19,0;1,1;"..bg["nix"].."^crafting_creative_all.png;default;]".. --search
|
||||
"image[0,1;5,0.75;fnt_"..name..".png]"..
|
||||
"list[current_player;main;0,7;9,1;]"..
|
||||
main_list..
|
||||
"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[-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[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[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
|
||||
"list[detached:creative_trash;main;9,7;1,1;]"..
|
||||
"image[9,7;1,1;crafting_creative_trash.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 pagenum ~= nil then formspec = formspec .. "p"..tostring(pagenum) end
|
||||
|
||||
player:set_inventory_formspec(formspec)
|
||||
end
|
||||
|
||||
multicraft.register_on_player_receive_fields(function(player, formname, fields)
|
||||
local page = nil
|
||||
if not multicraft.setting_getbool("creative_mode") then
|
||||
return
|
||||
end
|
||||
|
||||
if fields.bgcolor then
|
||||
-- multicraft.chat_send_all("jupp")
|
||||
end
|
||||
if fields.suche ~= nil and fields.suche ~= "" then
|
||||
set_inv(string.lower(fields.suche))
|
||||
multicraft.after(0, function()
|
||||
multicraft.show_formspec(player:get_player_name(), "detached:creative", player:get_inventory_formspec())
|
||||
end)
|
||||
end
|
||||
|
||||
if fields.build then
|
||||
set_inv("#blocks",player)
|
||||
page = "blocks"
|
||||
end
|
||||
if fields.deco then
|
||||
set_inv("#deco",player)
|
||||
page = "deco"
|
||||
end
|
||||
if fields.mese then
|
||||
set_inv("#mese",player)
|
||||
page = "mese"
|
||||
end
|
||||
if fields.rail then
|
||||
set_inv("#rail",player)
|
||||
page = "rail"
|
||||
end
|
||||
if fields.misc then
|
||||
set_inv("#misc",player)
|
||||
page = "misc"
|
||||
end
|
||||
if fields.default then
|
||||
set_inv("all")
|
||||
page = 'nix'
|
||||
end
|
||||
if fields.food then
|
||||
set_inv("#food")
|
||||
page = "food"
|
||||
end
|
||||
if fields.tools then
|
||||
set_inv("#tools")
|
||||
page = "tools"
|
||||
end
|
||||
if fields.combat then
|
||||
set_inv("#combat")
|
||||
page = "combat"
|
||||
end
|
||||
if fields.matr then
|
||||
set_inv("#matr")
|
||||
page = "matr"
|
||||
end
|
||||
if fields.inv then
|
||||
page = "inv"
|
||||
end
|
||||
if fields.brew then
|
||||
set_inv("#brew")
|
||||
page = "brew"
|
||||
end
|
||||
|
||||
-- Figure out current page from formspec
|
||||
local current_page = 0
|
||||
local formspec = player:get_inventory_formspec()
|
||||
|
||||
local size = string.len(formspec)
|
||||
local marker = string.sub(formspec,size-1)
|
||||
marker = string.sub(marker,1,1)
|
||||
|
||||
local player_name = player:get_player_name()
|
||||
local start_i = crafting.start_is[player_name]
|
||||
if not page then page = crafting.pages[player_name] end
|
||||
if page ~= crafting.pages[player_name] then
|
||||
start_i = 0
|
||||
end
|
||||
--if marker ~= nil and marker == "p" then
|
||||
--local ppage = string.sub(formspec,size)
|
||||
-- print('ppage ' .. (ppage or 'nope'))
|
||||
--multicraft.chat_send_all(page)
|
||||
--start_i = ppage - 1
|
||||
--end
|
||||
--start_i = tonumber(start_i) or 0
|
||||
|
||||
if fields.creative_prev then
|
||||
start_i = start_i - 9*5
|
||||
end
|
||||
if fields.creative_next
|
||||
and start_i + 9*5 <= crafting.creative_inventory_size+1 then
|
||||
start_i = start_i + 9*5
|
||||
end
|
||||
if start_i < 0 then
|
||||
start_i = 0
|
||||
end
|
||||
|
||||
crafting.set_creative_formspec(player, start_i, start_i/(9*5) +1, false, page)
|
||||
end)
|
||||
|
||||
|
||||
if multicraft.setting_getbool("creative_mode") then
|
||||
multicraft.register_item(":", {
|
||||
type = "none",
|
||||
wield_image = "wieldhand.png",
|
||||
wield_scale = {x=1,y=1,z=2.5},
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.5,
|
||||
max_drop_level = 3,
|
||||
groupcaps = {
|
||||
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},
|
||||
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},
|
||||
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)
|
||||
return true
|
||||
end)
|
||||
|
||||
function multicraft.handle_node_drops(pos, drops, digger)
|
||||
if not digger or not digger:is_player() then
|
||||
return
|
||||
end
|
||||
local inv = digger:get_inventory()
|
||||
if inv then
|
||||
for _,item in ipairs(drops) do
|
||||
item = ItemStack(item):get_name()
|
||||
if not inv:contains_item("main", item) then
|
||||
inv:add_item("main", item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
check
|
||||
default
|
|
@ -0,0 +1,79 @@
|
|||
default.furnace_inactive_formspec =
|
||||
"size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory_furnace.png]"..
|
||||
"bgcolor[#080808BB;true]"..
|
||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
"list[current_name;src;2.75,0.5;1,1;]"..
|
||||
"list[current_name;fuel;2.75,2.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"
|
||||
|
||||
function default.get_furnace_active_formspec(pos, percent)
|
||||
local formspec =
|
||||
"size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory_furnace.png]"..
|
||||
"bgcolor[#080808BB;true]"..
|
||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
"list[current_name;src;2.75,0.5;1,1;]"..
|
||||
"list[current_name;fuel;2.75,2.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:"..
|
||||
(100-percent)..":default_furnace_fire_fg.png]"
|
||||
|
||||
local meta = multicraft.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("dst",1)
|
||||
|
||||
return formspec
|
||||
end
|
||||
|
||||
default.chest_formspec =
|
||||
"size[9,9.75]"..
|
||||
"background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]"..
|
||||
"bgcolor[#080808BB;true]"..
|
||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
||||
"list[current_name;main;0,0.5;9,4;]"..
|
||||
"list[current_player;main;0,5.5;9,3;9]"..
|
||||
"list[current_player;main;0,8.74;9,1;]"
|
||||
|
||||
local chest_inv_size = 4*9
|
||||
local chest_inv_vers = 2
|
||||
|
||||
function default.get_locked_chest_formspec(pos)
|
||||
local meta = multicraft.get_meta(pos)
|
||||
local inv_v = meta:get_int("chest_inv_ver")
|
||||
if inv_v and inv_v < chest_inv_vers then
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main",chest_inv_size)
|
||||
meta:set_int("chest_inv_ver",chest_inv_vers)
|
||||
end
|
||||
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
|
||||
local formspec =
|
||||
"size[9,9.75]"..
|
||||
"background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]"..
|
||||
"bgcolor[#080808BB;true]"..
|
||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
||||
"list[nodemeta:".. spos .. ";main;0,0.5;9,4;]"..
|
||||
"list[current_player;main;0,5.5;9,3;9]"..
|
||||
"list[current_player;main;0,8.74;9,1;]"
|
||||
return formspec
|
||||
end
|
||||
|
||||
multicraft.register_abm({
|
||||
nodenames = {"default:chest"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
local meta = multicraft.get_meta(pos)
|
||||
local inv_v = meta:get_int("chest_inv_ver")
|
||||
if inv_v and inv_v < chest_inv_vers then
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main",chest_inv_size)
|
||||
meta:set_int("chest_inv_ver",chest_inv_vers)
|
||||
end
|
||||
end
|
||||
})
|
|
@ -0,0 +1,198 @@
|
|||
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
|
||||
dofile(multicraft.get_modpath("crafting").."/formspecs.lua")
|
||||
|
||||
local show_armor = false
|
||||
if multicraft.get_modpath("3d_armor") ~= nil then show_armor = true end
|
||||
|
||||
local function item_drop(itemstack, dropper, pos)
|
||||
if dropper:is_player() then
|
||||
local v = dropper:get_look_dir()
|
||||
local p = {x=pos.x, y=pos.y+1.2, z=pos.z}
|
||||
p.x = p.x+(math.random(1,3)*0.2)
|
||||
p.z = p.z+(math.random(1,3)*0.2)
|
||||
local obj = multicraft.add_item(p, itemstack)
|
||||
if obj then
|
||||
v.x = v.x*4
|
||||
v.y = v.y*4 + 2
|
||||
v.z = v.z*4
|
||||
obj:setvelocity(v)
|
||||
end
|
||||
else
|
||||
multicraft.add_item(pos, itemstack)
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local function drop_fields(player, name)
|
||||
local inv = player:get_inventory()
|
||||
for i,stack in ipairs(inv:get_list(name)) do
|
||||
item_drop(stack, player, player:getpos())
|
||||
stack:clear()
|
||||
inv:set_stack(name, i, stack)
|
||||
end
|
||||
end
|
||||
|
||||
local player_armor = {}
|
||||
|
||||
local function update_armor(player)
|
||||
local out = ""
|
||||
if not player then return end
|
||||
local name = player:get_player_name()
|
||||
if not armor or not armor.textures then return end
|
||||
local armor_str = armor.textures[name].armor
|
||||
if string.find(armor_str, "leggings") then
|
||||
out = out .. "^crafting_armor_legs.png"
|
||||
end
|
||||
if string.find(armor_str, "boots") then
|
||||
out = out .. "^crafting_armor_boots.png"
|
||||
end
|
||||
if string.find(armor_str, "helmet") then
|
||||
out = out .. "^crafting_armor_helmet.png"
|
||||
end
|
||||
if string.find(armor_str, "chestplate") then
|
||||
out = out .. "^crafting_armor_chest.png"
|
||||
end
|
||||
player_armor[name] = out
|
||||
end
|
||||
|
||||
local function set_inventory(player)
|
||||
if multicraft.setting_getbool("creative_mode") then
|
||||
multicraft.after(0.5,function()
|
||||
crafting.set_creative_formspec(player, 0, 1)
|
||||
return
|
||||
end)
|
||||
end
|
||||
player:get_inventory():set_width("craft", 3)
|
||||
player:get_inventory():set_size("craft", 9)
|
||||
player:get_inventory():set_size("main", 9*4)
|
||||
|
||||
local player_name = player:get_player_name()
|
||||
local img = "crafting_inventory_player.png"
|
||||
local armor_img = ""
|
||||
if show_armor then
|
||||
armor_img = "^crafting_inventory_armor.png"
|
||||
if player_armor[player_name] ~= nil then
|
||||
img = img .. player_armor[player_name]
|
||||
end
|
||||
end
|
||||
local img_element = "image[1,0;3,4;"..img.."]"
|
||||
if show_armor and armor.textures[player_name] and armor.textures[player_name].preview then
|
||||
img = armor.textures[player_name].preview
|
||||
local s1 = img:find("character_preview")
|
||||
if s1 ~= nil then
|
||||
s1 = img:sub(s1+21)
|
||||
img = "crafting_player2d.png"..s1
|
||||
end
|
||||
img_element = "image[1.5,0;2,4;"..img.."]"
|
||||
end
|
||||
|
||||
local form = "size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory.png"..armor_img.."]"..
|
||||
"bgcolor[#080808BB;true]"..
|
||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
||||
img_element
|
||||
--armor
|
||||
if show_armor then
|
||||
if armor.def[player_name] and armor.def[player_name].level then
|
||||
form = form ..
|
||||
"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,2;1,1;2]"..
|
||||
"list[detached:"..player_name.."_armor;armor;0,3;1,1;3]"
|
||||
else
|
||||
form = form ..
|
||||
"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_legs;0,2;1,1;2]"..
|
||||
"list[detached:"..player_name.."_armor;armor_feet;0,3;1,1;3]"
|
||||
end
|
||||
end
|
||||
form = form ..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
"list[current_player;craft;4,1;2,1;1]"..
|
||||
"list[current_player;craft;4,2;2,1;4]"..
|
||||
"list[current_player;craftpreview;7,1.5;1,1;]"..
|
||||
"inv"
|
||||
|
||||
player:set_inventory_formspec(form)
|
||||
end
|
||||
|
||||
local function set_workbench(player)
|
||||
player:get_inventory():set_width("craft", 3)
|
||||
player:get_inventory():set_size("craft", 9)
|
||||
player:get_inventory():set_size("main", 9*4)
|
||||
|
||||
local form = "size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory_workbench.png]"..
|
||||
"bgcolor[#080808BB;true]"..
|
||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
"list[current_player;craft;1.75,0.5;3,3;]"..
|
||||
"list[current_player;craftpreview;5.75,1.5;1,1;]"..
|
||||
"wob"
|
||||
|
||||
--player:set_inventory_formspec(form)
|
||||
multicraft.show_formspec(player:get_player_name(), "main", form)
|
||||
end
|
||||
|
||||
--drop craf items and reset inventory on closing
|
||||
multicraft.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if fields.quit then
|
||||
local formspec = player:get_inventory_formspec()
|
||||
local size = string.len(formspec)
|
||||
local marker = string.sub(formspec,size-2)
|
||||
if marker == "inv" or marker == "wob" then
|
||||
set_inventory(player)
|
||||
drop_fields(player,"craft")
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
multicraft.register_on_joinplayer(function(player)
|
||||
if multicraft.setting_getbool("creative_mode") then
|
||||
dofile(multicraft.get_modpath("crafting").."/creative.lua")
|
||||
end
|
||||
--init inventory
|
||||
set_inventory(player)
|
||||
--set hotbar size
|
||||
if player.hud_set_hotbar_itemcount then
|
||||
multicraft.after(0.5, player.hud_set_hotbar_itemcount, player, 8)
|
||||
end
|
||||
--add hotbar images
|
||||
multicraft.after(0.5,function()
|
||||
player:hud_set_hotbar_image("crafting_hotbar.png")
|
||||
player:hud_set_hotbar_selected_image("crafting_hotbar_selected.png")
|
||||
|
||||
if show_armor then
|
||||
local armor_orginal = armor.set_player_armor
|
||||
armor.set_player_armor = function(self, player)
|
||||
armor_orginal(self, player)
|
||||
update_armor(player)
|
||||
-- set_inventory(player)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
multicraft.register_node("crafting:workbench", {
|
||||
description = "Workbench",
|
||||
tiles = {"crafting_workbench_top.png", "default_wood.png", "crafting_workbench_side.png",
|
||||
"crafting_workbench_side.png", "crafting_workbench_front.png", "crafting_workbench_front.png"},
|
||||
paramtype2 = "facedir",
|
||||
paramtype = "light",
|
||||
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=2, decorative = 1},
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
set_workbench(clicker)
|
||||
end
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = "crafting:workbench",
|
||||
recipe = {
|
||||
{"group:wood", "group:wood"},
|
||||
{"group:wood", "group:wood"}
|
||||
}
|
||||
})
|
|
@ -0,0 +1,2 @@
|
|||
check
|
||||
default
|
|
@ -0,0 +1,11 @@
|
|||
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
|
||||
creative = {}
|
||||
|
||||
creative.set_creative_formspec = function()
|
||||
|
||||
end
|
||||
|
||||
multicraft.register_on_player_receive_fields(function(player, formname, fields)
|
||||
|
||||
end)
|
|
@ -0,0 +1,3 @@
|
|||
check
|
||||
default
|
||||
crafting
|
|
@ -0,0 +1,9 @@
|
|||
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
|
||||
inventory_plus = {}
|
||||
|
||||
function inventory_plus.set_inventory_formspec(player, formspec)
|
||||
end
|
||||
|
||||
function inventory_plus.register_button(player,str1, str2)
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
check
|
||||
default
|
|
@ -0,0 +1,48 @@
|
|||
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
|
||||
-- multicraft/creative/init.lua
|
||||
|
||||
creative_inventory = {}
|
||||
creative_inventory.creative_inventory_size = 0
|
||||
|
||||
if multicraft.setting_getbool("creative_mode") then
|
||||
local digtime = 0.5
|
||||
multicraft.register_item(":", {
|
||||
type = "none",
|
||||
wield_image = "wieldhand.png",
|
||||
wield_scale = {x=1,y=1,z=2.5},
|
||||
range = 10,
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.5,
|
||||
max_drop_level = 3,
|
||||
groupcaps = {
|
||||
crumbly = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
|
||||
cracky = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
|
||||
snappy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
|
||||
choppy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
|
||||
oddly_breakable_by_hand = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3},
|
||||
},
|
||||
damage_groups = {fleshy = 10},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
|
||||
return true
|
||||
end)
|
||||
|
||||
function multicraft.handle_node_drops(pos, drops, digger)
|
||||
if not digger or not digger:is_player() then
|
||||
return
|
||||
end
|
||||
local inv = digger:get_inventory()
|
||||
if inv then
|
||||
for _,item in ipairs(drops) do
|
||||
item = ItemStack(item):get_name()
|
||||
if not inv:contains_item("main", item) then
|
||||
inv:add_item("main", item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
check
|
||||
default
|
|
@ -0,0 +1,19 @@
|
|||
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 multicraft.setting_get("keepInventory") == false then
|
||||
multicraft.register_on_dieplayer(function(player)
|
||||
local inv = player:get_inventory()
|
||||
local pos = player:getpos()
|
||||
for i,stack in ipairs(inv:get_list("main")) do
|
||||
local x = math.random(0, 9)/3
|
||||
local z = math.random(0, 9)/3
|
||||
pos.x = pos.x + x
|
||||
pos.z = pos.z + z
|
||||
multicraft.add_item(pos, stack)
|
||||
stack:clear()
|
||||
inv:set_stack("main", i, stack)
|
||||
pos.x = pos.x - x
|
||||
pos.z = pos.z - z
|
||||
end
|
||||
end)
|
||||
--end
|
|
@ -0,0 +1,63 @@
|
|||
multicraft 0.4 mod: default
|
||||
==========================
|
||||
|
||||
License of source code:
|
||||
-----------------------
|
||||
Copyright (C) 2011-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
http://www.gnu.org/licenses/lgpl-2.1.html
|
||||
|
||||
License of media (sounds)
|
||||
--------------------------------------
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
||||
|
||||
Authors of media files
|
||||
-----------------------
|
||||
MirceaKitsune (WTFPL):
|
||||
character.x
|
||||
|
||||
Glass breaking sounds (CC BY 3.0):
|
||||
1: http://www.freesound.org/people/cmusounddesign/sounds/71947/
|
||||
2: http://www.freesound.org/people/Tomlija/sounds/97669/
|
||||
3: http://www.freesound.org/people/lsprice/sounds/88808/
|
||||
|
||||
Mito551 (sounds) (CC BY-SA):
|
||||
default_dig_choppy.ogg
|
||||
default_dig_cracky.ogg
|
||||
default_dig_crumbly.1.ogg
|
||||
default_dig_crumbly.2.ogg
|
||||
default_dig_dig_immediate.ogg
|
||||
default_dig_oddly_breakable_by_hand.ogg
|
||||
default_dug_node.1.ogg
|
||||
default_dug_node.2.ogg
|
||||
default_grass_footstep.1.ogg
|
||||
default_grass_footstep.2.ogg
|
||||
default_grass_footstep.3.ogg
|
||||
default_gravel_footstep.1.ogg
|
||||
default_gravel_footstep.2.ogg
|
||||
default_gravel_footstep.3.ogg
|
||||
default_gravel_footstep.4.ogg
|
||||
default_grass_footstep.1.ogg
|
||||
default_place_node.1.ogg
|
||||
default_place_node.2.ogg
|
||||
default_place_node.3.ogg
|
||||
default_place_node_hard.1.ogg
|
||||
default_place_node_hard.2.ogg
|
||||
default_snow_footstep.1.ogg
|
||||
default_snow_footstep.2.ogg
|
||||
default_hard_footstep.1.ogg
|
||||
default_hard_footstep.2.ogg
|
||||
default_hard_footstep.3.ogg
|
||||
default_sand_footstep.1.ogg
|
||||
default_sand_footstep.2.ogg
|
||||
default_wood_footstep.1.ogg
|
||||
default_wood_footstep.2.ogg
|
||||
default_dirt_footstep.1.ogg
|
||||
default_dirt_footstep.2.ogg
|
||||
default_glass_footstep.ogg
|
|
@ -0,0 +1,821 @@
|
|||
-- mods/default/crafting.lua
|
||||
|
||||
--
|
||||
-- Crafting definition
|
||||
--
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:wood 4',
|
||||
recipe = {
|
||||
{'default:tree'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:junglewood 4',
|
||||
recipe = {
|
||||
{'default:jungletree'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:acaciawood 4',
|
||||
recipe = {
|
||||
{'default:acaciatree'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:sprucewood 4',
|
||||
recipe = {
|
||||
{'default:sprucetree'},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:mossycobble',
|
||||
recipe = {
|
||||
{'default:cobble', 'default:vine'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:stonebrickmossy',
|
||||
recipe = {
|
||||
{'default:stonebrick', 'default:vine'},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:stick 4',
|
||||
recipe = {
|
||||
{'group:wood'},
|
||||
{'group:wood'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'fences:fence_wood 2',
|
||||
recipe = {
|
||||
{'default:stick', 'default:stick', 'default:stick'},
|
||||
{'default:stick', 'default:stick', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'signs:sign_wall',
|
||||
recipe = {
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
{'', 'default:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:torch 4',
|
||||
recipe = {
|
||||
{'default:coal_lump'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:torch 4',
|
||||
recipe = {
|
||||
{'default:charcoal_lump'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:pick_wood',
|
||||
recipe = {
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'default:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:pick_stone',
|
||||
recipe = {
|
||||
{'group:stone', 'group:stone', 'group:stone'},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'default:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:pick_steel',
|
||||
recipe = {
|
||||
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'default:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:pick_gold',
|
||||
recipe = {
|
||||
{'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot'},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'default:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:pick_diamond',
|
||||
recipe = {
|
||||
{'default:diamond', 'default:diamond', 'default:diamond'},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'default:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:shovel_wood',
|
||||
recipe = {
|
||||
{'group:wood'},
|
||||
{'default:stick'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:shovel_stone',
|
||||
recipe = {
|
||||
{'group:stone'},
|
||||
{'default:stick'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:shovel_steel',
|
||||
recipe = {
|
||||
{'default:steel_ingot'},
|
||||
{'default:stick'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:shovel_gold',
|
||||
recipe = {
|
||||
{'default:gold_ingot'},
|
||||
{'default:stick'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:shovel_diamond',
|
||||
recipe = {
|
||||
{'default:diamond'},
|
||||
{'default:stick'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:axe_wood',
|
||||
recipe = {
|
||||
{'group:wood', 'group:wood'},
|
||||
{'group:wood', 'default:stick'},
|
||||
{'', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:axe_stone',
|
||||
recipe = {
|
||||
{'group:stone', 'group:stone'},
|
||||
{'group:stone', 'default:stick'},
|
||||
{'', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:axe_steel',
|
||||
recipe = {
|
||||
{'default:steel_ingot', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'default:stick'},
|
||||
{'', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:axe_gold',
|
||||
recipe = {
|
||||
{'default:gold_ingot', 'default:gold_ingot'},
|
||||
{'default:gold_ingot', 'default:stick'},
|
||||
{'', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:axe_diamond',
|
||||
recipe = {
|
||||
{'default:diamond', 'default:diamond'},
|
||||
{'default:diamond', 'default:stick'},
|
||||
{'', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:sword_wood',
|
||||
recipe = {
|
||||
{'group:wood'},
|
||||
{'group:wood'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:sword_stone',
|
||||
recipe = {
|
||||
{'group:stone'},
|
||||
{'group:stone'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:sword_steel',
|
||||
recipe = {
|
||||
{'default:steel_ingot'},
|
||||
{'default:steel_ingot'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:sword_gold',
|
||||
recipe = {
|
||||
{'default:gold_ingot'},
|
||||
{'default:gold_ingot'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:sword_diamond',
|
||||
recipe = {
|
||||
{'default:diamond'},
|
||||
{'default:diamond'},
|
||||
{'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:flint_and_steel',
|
||||
recipe = {
|
||||
{'default:steel_ingot', ''},
|
||||
{'', 'default:flint'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = "default:pole",
|
||||
recipe = {
|
||||
{'','','default:stick'},
|
||||
{'','default:stick','farming:string'},
|
||||
{'default:stick','','farming:string'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = "default:pole",
|
||||
recipe = {
|
||||
{'', '', 'default:stick'},
|
||||
{'', 'default:stick', 'default:string'},
|
||||
{'default:stick', '', 'default:string'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:rail 15',
|
||||
recipe = {
|
||||
{'default:steel_ingot', '', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'default:stick', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', '', 'default:steel_ingot'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:chest',
|
||||
recipe = {
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
{'group:wood', '', 'group:wood'},
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:furnace',
|
||||
recipe = {
|
||||
{'group:stone', 'group:stone', 'group:stone'},
|
||||
{'group:stone', '', 'group:stone'},
|
||||
{'group:stone', 'group:stone', 'group:stone'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:haybale',
|
||||
recipe = {
|
||||
{'farming:wheat_harvested', 'farming:wheat_harvested', 'farming:wheat_harvested'},
|
||||
{'farming:wheat_harvested', 'farming:wheat_harvested', 'farming:wheat_harvested'},
|
||||
{'farming:wheat_harvested', 'farming:wheat_harvested', 'farming:wheat_harvested'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'farming:wheat_harvested 9',
|
||||
recipe = {
|
||||
{'default:haybale'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:sea_lantern',
|
||||
recipe = {
|
||||
{'default:prismarine_shard', 'default:prismarine_cry', 'default:prismarine_shard'},
|
||||
{'default:prismarine_cry', 'default:prismarine_cry', 'default:prismarine_cry'},
|
||||
{'default:prismarine_shard', 'default:prismarine_cry', 'default:prismarine_shard'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:prismarine',
|
||||
recipe = {
|
||||
{'default:prismarine_shard', 'default:prismarine_shard'},
|
||||
{'default:prismarine_shard', 'default:prismarine_shard'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:prismarine_brick',
|
||||
recipe = {
|
||||
{'default:prismarine_shard', 'default:prismarine_shard', 'default:prismarine_shard'},
|
||||
{'default:prismarine_shard', 'default:prismarine_shard', 'default:prismarine_shard'},
|
||||
{'default:prismarine_shard', 'default:prismarine_shard', 'default:prismarine_shard'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:prismarine_dark',
|
||||
recipe = {
|
||||
{'default:prismarine_shard', 'default:prismarine_shard', 'default:prismarine_shard'},
|
||||
{'default:prismarine_shard', 'dye:black', 'default:prismarine_shard'},
|
||||
{'default:prismarine_shard', 'default:prismarine_shard', 'default:prismarine_shard'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:steelblock',
|
||||
recipe = {
|
||||
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:steel_ingot 9',
|
||||
recipe = {
|
||||
{'default:steelblock'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:goldblock',
|
||||
recipe = {
|
||||
{'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot'},
|
||||
{'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot'},
|
||||
{'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:gold_ingot 9',
|
||||
recipe = {
|
||||
{'default:goldblock'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = "default:gold_nugget 9",
|
||||
recipe = {{"default:gold_ingot"}},
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:sandstone',
|
||||
recipe = {
|
||||
{'group:sand', 'group:sand'},
|
||||
{'group:sand', 'group:sand'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:clay',
|
||||
recipe = {
|
||||
{'default:clay_lump', 'default:clay_lump'},
|
||||
{'default:clay_lump', 'default:clay_lump'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:brick',
|
||||
recipe = {
|
||||
{'default:clay_brick', 'default:clay_brick'},
|
||||
{'default:clay_brick', 'default:clay_brick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:clay_brick 4',
|
||||
recipe = {
|
||||
{'default:brick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:paper',
|
||||
recipe = {
|
||||
{'default:reeds', 'default:reeds', 'default:reeds'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:book',
|
||||
recipe = {
|
||||
{'default:paper'},
|
||||
{'default:paper'},
|
||||
{'default:paper'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:bookshelf',
|
||||
recipe = {
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
{'default:book', 'default:book', 'default:book'},
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:ladder',
|
||||
recipe = {
|
||||
{'default:stick', '', 'default:stick'},
|
||||
{'default:stick', 'default:stick', 'default:stick'},
|
||||
{'default:stick', '', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:stonebrick',
|
||||
recipe = {
|
||||
{'default:stone', 'default:stone'},
|
||||
{'default:stone', 'default:stone'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "shapeless",
|
||||
output = "default:gunpowder",
|
||||
recipe = {
|
||||
'default:sand',
|
||||
'default:gravel',
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'dye:white 3',
|
||||
recipe = {
|
||||
{'default:bone'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:lapisblock',
|
||||
recipe = {
|
||||
{'dye:blue', 'dye:blue', 'dye:blue'},
|
||||
{'dye:blue', 'dye:blue', 'dye:blue'},
|
||||
{'dye:blue', 'dye:blue', 'dye:blue'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'dye:blue 9',
|
||||
recipe = {
|
||||
{'default:lapisblock'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = "default:emeraldblock",
|
||||
recipe = {
|
||||
{'default:emerald', 'default:emerald', 'default:emerald'},
|
||||
{'default:emerald', 'default:emerald', 'default:emerald'},
|
||||
{'default:emerald', 'default:emerald', 'default:emerald'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:emerald 9',
|
||||
recipe = {
|
||||
{'default:emeraldblock'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = "default:glowstone",
|
||||
recipe = {
|
||||
{'default:glowstone_dust', 'default:glowstone_dust'},
|
||||
{'default:glowstone_dust', 'default:glowstone_dust'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:glowstone_dust 4',
|
||||
recipe = {
|
||||
{'default:glowstone'},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:redstone_dust',
|
||||
recipe = {{"mesecons:wire_00000000_off"}},
|
||||
})
|
||||
|
||||
|
||||
multicraft.register_craft({
|
||||
output = "default:apple_gold",
|
||||
recipe = {
|
||||
{"default:gold_nugget", "default:gold_nugget", "default:gold_nugget"},
|
||||
{"default:gold_nugget", 'default:apple', "default:gold_nugget"},
|
||||
{"default:gold_nugget", "default:gold_nugget", "default:gold_nugget"},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = "default:sugar",
|
||||
recipe = {
|
||||
{"default:reeds"},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:snowblock',
|
||||
recipe = {
|
||||
{'default:snow', 'default:snow', 'default:snow'},
|
||||
{'default:snow', 'default:snow', 'default:snow'},
|
||||
{'default:snow', 'default:snow', 'default:snow'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:snow 9',
|
||||
recipe = {
|
||||
{'default:snowblock'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:quartz_block',
|
||||
recipe = {
|
||||
{'default:quartz_crystal', 'default:quartz_crystal'},
|
||||
{'default:quartz_crystal', 'default:quartz_crystal'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:quartz_chiseled 2',
|
||||
recipe = {
|
||||
{'stairs:slab_quartzblock'},
|
||||
{'stairs:slab_quartzblock'},
|
||||
}
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:quartz_pillar 2',
|
||||
recipe = {
|
||||
{'default:quartz_block'},
|
||||
{'default:quartz_block'},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- Crafting (tool repair)
|
||||
--
|
||||
multicraft.register_craft({
|
||||
type = "toolrepair",
|
||||
additional_wear = -0.02,
|
||||
})
|
||||
|
||||
--
|
||||
-- Cooking recipes
|
||||
--
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:glass",
|
||||
recipe = "group:sand",
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:stone",
|
||||
recipe = "default:cobble",
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:steel_ingot",
|
||||
recipe = "default:stone_with_iron",
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:gold_ingot",
|
||||
recipe = "default:stone_with_gold",
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:clay_brick",
|
||||
recipe = "default:clay_lump",
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:fish",
|
||||
recipe = "default:fish_raw",
|
||||
cooktime = 2,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:charcoal_lump",
|
||||
recipe = "group:tree",
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "cooking",
|
||||
output = "default:sponge",
|
||||
recipe = "default:sponge_wet",
|
||||
})
|
||||
|
||||
--
|
||||
-- Fuels
|
||||
--
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "group:tree",
|
||||
burntime = 30,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:junglegrass",
|
||||
burntime = 2,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "group:leaves",
|
||||
burntime = 1,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:cactus",
|
||||
burntime = 15,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:reeds",
|
||||
burntime = 1,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:bookshelf",
|
||||
burntime = 30,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:fence_wood",
|
||||
burntime = 15,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:ladder",
|
||||
burntime = 5,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "group:wood",
|
||||
burntime = 7,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:lava_source",
|
||||
burntime = 60,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:torch",
|
||||
burntime = 4,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "signs:sign_wall",
|
||||
burntime = 10,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:chest",
|
||||
burntime = 30,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:sapling",
|
||||
burntime = 10,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:apple",
|
||||
burntime = 3,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:apple_gold",
|
||||
burntime = 6,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:coal_lump",
|
||||
burntime = 40,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:haybale",
|
||||
burntime = 40,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:charcoal_lump",
|
||||
burntime = 45,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:junglesapling",
|
||||
burntime = 10,
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "default:grass_1",
|
||||
burntime = 2,
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
--Temporary
|
||||
--
|
||||
multicraft.register_craft({
|
||||
output = "default:string",
|
||||
recipe = {{"default:paper", "default:paper"}},
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = "default:cobweb",
|
||||
recipe = {
|
||||
{"farming:string", "farming:string", "farming:string"},
|
||||
{"farming:string", "farming:string", "farming:string"},
|
||||
{"farming:string", "farming:string", "farming:string"},
|
||||
}
|
||||
})
|
|
@ -0,0 +1,234 @@
|
|||
-- mods/default/craftitems.lua
|
||||
|
||||
--
|
||||
-- Crafting items
|
||||
--
|
||||
|
||||
multicraft.register_craftitem("default:stick", {
|
||||
description = "Stick",
|
||||
inventory_image = "default_stick.png",
|
||||
stack_max = 64,
|
||||
groups = {materials = 1},
|
||||
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:paper", {
|
||||
description = "Paper",
|
||||
inventory_image = "default_paper.png",
|
||||
stack_max = 64,
|
||||
groups = {misc = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:book", {
|
||||
description = "Book",
|
||||
inventory_image = "default_book.png",
|
||||
stack_max = 64,
|
||||
groups = {misc = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:coal_lump", {
|
||||
description = "Coal Lump",
|
||||
inventory_image = "default_coal_lump.png",
|
||||
stack_max = 64,
|
||||
groups = {materials = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:charcoal_lump", {
|
||||
description = "Charcoal Lump",
|
||||
inventory_image = "default_charcoal_lump.png",
|
||||
stack_max = 64,
|
||||
groups = {materials = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:gold_nugget", {
|
||||
description = "Gold Nugget",
|
||||
inventory_image = "default_gold_nugget.png",
|
||||
stack_max = 64,
|
||||
groups = {materials = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:diamond", {
|
||||
description = "Diamond",
|
||||
inventory_image = "default_diamond.png",
|
||||
stack_max = 64,
|
||||
groups = {materials = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:clay_lump", {
|
||||
description = "Clay Lump",
|
||||
inventory_image = "default_clay_lump.png",
|
||||
stack_max = 64,
|
||||
groups = {materials = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:steel_ingot", {
|
||||
description = "Steel Ingot",
|
||||
inventory_image = "default_steel_ingot.png",
|
||||
stack_max = 64,
|
||||
groups = {materials = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:gold_ingot", {
|
||||
description = "Gold Ingot",
|
||||
inventory_image = "default_gold_ingot.png",
|
||||
stack_max = 64,
|
||||
groups = {materials = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:emerald", {
|
||||
description = "Emerald",
|
||||
inventory_image = "default_emerald.png",
|
||||
stack_max = 64,
|
||||
groups = {materials = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:clay_brick", {
|
||||
description = "Clay Brick",
|
||||
inventory_image = "default_clay_brick.png",
|
||||
stack_max = 64,
|
||||
groups = {materials = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:flint", {
|
||||
description = "Flint",
|
||||
inventory_image = "default_flint.png",
|
||||
stack_max = 64,
|
||||
groups = {materials = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:gunpowder", {
|
||||
description = "Gunpowder",
|
||||
inventory_image = "default_gunpowder.png",
|
||||
stack_max = 64,
|
||||
groups = {materials = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:bone", {
|
||||
description = "Bone",
|
||||
inventory_image = "default_bone.png",
|
||||
stack_max = 64,
|
||||
groups = {materials = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:glowstone_dust", {
|
||||
description = "Glowstone Dust",
|
||||
inventory_image = "default_glowstone_dust.png",
|
||||
stack_max = 64,
|
||||
groups = {materials = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:fish_raw", {
|
||||
description = "Raw Fish",
|
||||
groups = {},
|
||||
inventory_image = "default_fish.png",
|
||||
on_use = multicraft.item_eat(2),
|
||||
stack_max = 64,
|
||||
groups = {foodstuffs = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:fish", {
|
||||
description = "Cooked Fish",
|
||||
groups = {},
|
||||
inventory_image = "default_fish_cooked.png",
|
||||
on_use = multicraft.item_eat(4),
|
||||
stack_max = 64,
|
||||
groups = {foodstuffs = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:sugar", {
|
||||
description = "Sugar",
|
||||
inventory_image = "default_sugar.png",
|
||||
stack_max = 64,
|
||||
groups = {materials = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:string",{
|
||||
description = "String",
|
||||
inventory_image = "default_string.png",
|
||||
stack_max = 64,
|
||||
groups = {materials = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:prismarine_cry", {
|
||||
description = "Prismarine Crystals",
|
||||
inventory_image = "default_prismarine_crystals.png",
|
||||
stack_max = 64,
|
||||
groups = {materials = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:prismarine_shard", {
|
||||
description = "Prismarine Shard",
|
||||
inventory_image = "default_prismarine_shard.png",
|
||||
stack_max = 64,
|
||||
groups = {materials = 1},
|
||||
})
|
||||
|
||||
multicraft.register_craftitem("default:quartz_crystal", {
|
||||
description = "Quartz Crystal",
|
||||
inventory_image = "default_quartz_crystal.png",
|
||||
stack_max = 64,
|
||||
groups = {materials = 1},
|
||||
})
|
||||
|
||||
|
||||
multicraft.register_craftitem('default:rotten_flesh', {
|
||||
description = "Rotten flesh",
|
||||
inventory_image = "zombie_flesh",
|
||||
on_use = multicraft.item_eat(1),
|
||||
})
|
||||
|
||||
|
||||
multicraft.register_craftitem('default:milk', {
|
||||
description = "A bucket of milk",
|
||||
inventory_image = "default_milk.png",
|
||||
on_use = multicraft.item_eat(1),
|
||||
})
|
||||
|
||||
multicraft.register_craftitem('default:beef_raw', {
|
||||
description = "Beef",
|
||||
inventory_image = "mobs_meat_raw.png",
|
||||
on_use = multicraft.item_eat(1),
|
||||
})
|
||||
|
||||
multicraft.register_craftitem('default:steak', {
|
||||
description = "Steak",
|
||||
inventory_image = "mobs_meat.png",
|
||||
on_use = multicraft.item_eat(1),
|
||||
})
|
||||
|
||||
multicraft.register_craftitem('default:chicken_raw', {
|
||||
description = "Chicken",
|
||||
inventory_image = "mobs_chicken_raw.png",
|
||||
on_use = multicraft.item_eat(1),
|
||||
})
|
||||
|
||||
multicraft.register_craftitem('default:chicken_cooked', {
|
||||
description = "Cooked chicken",
|
||||
inventory_image = "mobs_chicken_cooked.png",
|
||||
on_use = multicraft.item_eat(1),
|
||||
})
|
||||
|
||||
multicraft.register_craftitem('default:porkchop_raw', {
|
||||
description = "Porkchop",
|
||||
inventory_image = "mobs_meat_raw.png",
|
||||
on_use = multicraft.item_eat(1),
|
||||
})
|
||||
|
||||
multicraft.register_craftitem('default:porkchop_cooked', {
|
||||
description = "Cooked porkchop",
|
||||
inventory_image = "mobs_meat.png",
|
||||
on_use = multicraft.item_eat(1),
|
||||
})
|
||||
|
||||
multicraft.register_craftitem('default:leather', {
|
||||
description = "Leather",
|
||||
inventory_image = "default_leather.png",
|
||||
-- on_use = multicraft.item_eat(1),
|
||||
})
|
||||
|
||||
multicraft.register_craftitem('default:egg', {
|
||||
description = "Egg",
|
||||
inventory_image = "adbs_chicken_spawn_egg.png",
|
||||
-- on_use = multicraft.item_eat(1),
|
||||
})
|
||||
|
|
@ -0,0 +1,885 @@
|
|||
--
|
||||
-- On Die
|
||||
--
|
||||
--if multicraft.setting_get("keepInventory") == false then
|
||||
multicraft.register_on_dieplayer(function(player)
|
||||
local inv = player:get_inventory()
|
||||
local pos = player:getpos()
|
||||
for i,stack in ipairs(inv:get_list("main")) do
|
||||
local x = math.random(0, 9)/3
|
||||
local z = math.random(0, 9)/3
|
||||
pos.x = pos.x + x
|
||||
pos.z = pos.z + z
|
||||
multicraft.add_item(pos, stack)
|
||||
stack:clear()
|
||||
inv:set_stack("main", i, stack)
|
||||
pos.x = pos.x - x
|
||||
pos.z = pos.z - z
|
||||
end
|
||||
end)
|
||||
--end
|
||||
|
||||
--
|
||||
-- Lavacooling
|
||||
--
|
||||
|
||||
default.cool_lava_source = function(pos)
|
||||
multicraft.set_node(pos, {name="default:obsidian"})
|
||||
end
|
||||
|
||||
default.cool_lava_flowing = function(pos)
|
||||
multicraft.set_node(pos, {name="default:stone"})
|
||||
end
|
||||
|
||||
multicraft.register_abm({
|
||||
nodenames = {"default:lava_flowing"},
|
||||
neighbors = {"group:water"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
default.cool_lava_flowing(pos, node, active_object_count, active_object_count_wider)
|
||||
end,
|
||||
})
|
||||
|
||||
multicraft.register_abm({
|
||||
nodenames = {"default:lava_source"},
|
||||
neighbors = {"group:water"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
default.cool_lava_source(pos, node, active_object_count, active_object_count_wider)
|
||||
end,
|
||||
})
|
||||
|
||||
--
|
||||
-- Papyrus and cactus growing
|
||||
--
|
||||
|
||||
-- Functions
|
||||
grow_cactus = function(pos, node)
|
||||
pos.y = pos.y-1
|
||||
local name = multicraft.get_node(pos).name
|
||||
if multicraft.get_item_group(name, "sand") ~= 0 then
|
||||
pos.y = pos.y+1
|
||||
local height = 0
|
||||
while multicraft.get_node(pos).name == "default:cactus" and height < 4 do
|
||||
height = height+1
|
||||
pos.y = pos.y+1
|
||||
end
|
||||
if height < 4 then
|
||||
if multicraft.get_node(pos).name == "air" then
|
||||
multicraft.set_node(pos, {name="default:cactus"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
grow_reeds = function(pos, node)
|
||||
pos.y = pos.y-1
|
||||
local name = multicraft.get_node(pos).name
|
||||
if name == "default:dirt" or name == "default:dirt_with_grass" then
|
||||
if multicraft.find_node_near(pos, 3, {"group:water"}) == nil then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
local height = 0
|
||||
while multicraft.get_node(pos).name == "default:reeds" and height < 3 do
|
||||
height = height+1
|
||||
pos.y = pos.y+1
|
||||
end
|
||||
if height < 3 then
|
||||
if multicraft.get_node(pos).name == "air" then
|
||||
multicraft.set_node(pos, {name="default:reeds"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- ABMs
|
||||
multicraft.register_abm({
|
||||
nodenames = {"default:cactus"},
|
||||
neighbors = {"group:sand"},
|
||||
interval = 25,
|
||||
chance = 10,
|
||||
action = function(pos)
|
||||
grow_cactus(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
multicraft.register_abm({
|
||||
nodenames = {"default:reeds"},
|
||||
neighbors = {"default:dirt", "default:dirt_with_grass"},
|
||||
interval = 25,
|
||||
chance = 10,
|
||||
action = function(pos)
|
||||
grow_reeds(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
--
|
||||
-- Papyrus and cactus drop
|
||||
--
|
||||
|
||||
local timber_nodenames={"default:reeds", "default:cactus"}
|
||||
|
||||
multicraft.register_on_dignode(function(pos, node)
|
||||
local i=1
|
||||
while timber_nodenames[i]~=nil do
|
||||
if node.name==timber_nodenames[i] then
|
||||
np={x=pos.x, y=pos.y+1, z=pos.z}
|
||||
while multicraft.get_node(np).name==timber_nodenames[i] do
|
||||
multicraft.remove_node(np)
|
||||
multicraft.add_item(np, timber_nodenames[i])
|
||||
np={x=np.x, y=np.y+1, z=np.z}
|
||||
end
|
||||
end
|
||||
i=i+1
|
||||
end
|
||||
end)
|
||||
|
||||
--
|
||||
-- Flint and Steel
|
||||
--
|
||||
|
||||
function get_nodedef_field(nodename, fieldname)
|
||||
if not multicraft.registered_nodes[nodename] then
|
||||
return nil
|
||||
end
|
||||
return multicraft.registered_nodes[nodename][fieldname]
|
||||
end
|
||||
|
||||
function set_fire(pointed_thing)
|
||||
local n = multicraft.get_node(pointed_thing.above)
|
||||
if n.name ~= "" and n.name == "air" and not multicraft.is_protected(pointed_thing.above, "fire") then
|
||||
multicraft.add_node(pointed_thing.above, {name="fire:basic_flame"})
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- Fire Particles
|
||||
--
|
||||
|
||||
function add_fire(pos)
|
||||
local null = {x=0, y=0, z=0}
|
||||
pos.y = pos.y+0.19
|
||||
multicraft.add_particle(pos, null, null, 1.1,
|
||||
1.5, true, "default_fire_particle"..tostring(math.random(1,2)) ..".png")
|
||||
pos.y = pos.y +0.01
|
||||
multicraft.add_particle(pos, null, null, 0.8,
|
||||
1.5, true, "default_fire_particle"..tostring(math.random(1,2)) ..".png")
|
||||
end
|
||||
|
||||
--
|
||||
-- Bone Meal
|
||||
--
|
||||
|
||||
local n
|
||||
local n2
|
||||
local pos
|
||||
|
||||
function apple_leave()
|
||||
if math.random(0, 10) == 3 then
|
||||
return {name = "default:apple"}
|
||||
else
|
||||
return {name = "default:leaves"}
|
||||
end
|
||||
end
|
||||
|
||||
function air_leave()
|
||||
if math.random(0, 50) == 3 then
|
||||
return {name = "air"}
|
||||
else
|
||||
return {name = "default:leaves"}
|
||||
end
|
||||
end
|
||||
|
||||
function generate_tree(pos, trunk, leaves, typearbre)
|
||||
pos.y = pos.y-1
|
||||
local nodename = multicraft.get_node(pos).name
|
||||
|
||||
pos.y = pos.y+1
|
||||
if not multicraft.get_node_light(pos) then
|
||||
return
|
||||
end
|
||||
if typearbre == nil or typearbre == 1 then
|
||||
node = {name = ""}
|
||||
for dy=1,4 do
|
||||
pos.y = pos.y+dy
|
||||
if multicraft.get_node(pos).name ~= "air" then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y-dy
|
||||
end
|
||||
node = {name = trunk}
|
||||
for dy=0,4 do
|
||||
pos.y = pos.y+dy
|
||||
if multicraft.get_node(pos).name == "air" then
|
||||
multicraft.add_node(pos, node)
|
||||
end
|
||||
pos.y = pos.y-dy
|
||||
end
|
||||
|
||||
node = {name = leaves}
|
||||
pos.y = pos.y+3
|
||||
local rarity = 0
|
||||
if math.random(0, 10) == 3 then
|
||||
rarity = 1
|
||||
end
|
||||
for dx=-2,2 do
|
||||
for dz=-2,2 do
|
||||
for dy=0,3 do
|
||||
pos.x = pos.x+dx
|
||||
pos.y = pos.y+dy
|
||||
pos.z = pos.z+dz
|
||||
|
||||
if dx == 0 and dz == 0 and dy==3 then
|
||||
if multicraft.get_node(pos).name == "air" and math.random(1, 5) <= 4 then
|
||||
multicraft.add_node(pos, node)
|
||||
if rarity == 1 then
|
||||
multicraft.add_node(pos, apple_leave())
|
||||
else
|
||||
multicraft.add_node(pos, air_leave())
|
||||
end
|
||||
end
|
||||
elseif dx == 0 and dz == 0 and dy==4 then
|
||||
if multicraft.get_node(pos).name == "air" and math.random(1, 5) <= 4 then
|
||||
multicraft.add_node(pos, node)
|
||||
if rarity == 1 then
|
||||
multicraft.add_node(pos, apple_leave())
|
||||
else
|
||||
multicraft.add_node(pos, air_leave())
|
||||
end
|
||||
end
|
||||
elseif math.abs(dx) ~= 2 and math.abs(dz) ~= 2 then
|
||||
if multicraft.get_node(pos).name == "air" then
|
||||
multicraft.add_node(pos, node)
|
||||
if rarity == 1 then
|
||||
multicraft.add_node(pos, apple_leave())
|
||||
else
|
||||
multicraft.add_node(pos, air_leave())
|
||||
end
|
||||
end
|
||||
else
|
||||
if math.abs(dx) ~= 2 or math.abs(dz) ~= 2 then
|
||||
if multicraft.get_node(pos).name == "air" and math.random(1, 5) <= 4 then
|
||||
multicraft.add_node(pos, node)
|
||||
if rarity == 1 then
|
||||
multicraft.add_node(pos, apple_leave())
|
||||
else
|
||||
multicraft.add_node(pos, air_leave())
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
pos.x = pos.x-dx
|
||||
pos.y = pos.y-dy
|
||||
pos.z = pos.z-dz
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif typearbre == 2 then
|
||||
node = {name = ""}
|
||||
|
||||
-- can place big tree ?
|
||||
local tree_size = math.random(15, 25)
|
||||
for dy=1,4 do
|
||||
pos.y = pos.y+dy
|
||||
if multicraft.get_node(pos).name ~= "air" then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y-dy
|
||||
end
|
||||
|
||||
--Cheak for placing big tree
|
||||
pos.y = pos.y-1
|
||||
for dz=0,1 do
|
||||
pos.z = pos.z + dz
|
||||
--> 0
|
||||
if multicraft.get_node(pos).name == "default:dirt_with_grass"
|
||||
or multicraft.get_node(pos).name == "default:dirt" then else
|
||||
return
|
||||
end
|
||||
pos.x = pos.x+1
|
||||
--> 1
|
||||
if multicraft.get_node(pos).name == "default:dirt_with_grass"
|
||||
or multicraft.get_node(pos).name == "default:dirt" then else
|
||||
return
|
||||
end
|
||||
pos.x = pos.x-1
|
||||
pos.z = pos.z - dz
|
||||
end
|
||||
pos.y = pos.y+1
|
||||
|
||||
|
||||
-- Make tree with vine
|
||||
node = {name = trunk}
|
||||
for dy=0,tree_size do
|
||||
pos.y = pos.y+dy
|
||||
|
||||
for dz=-1,2 do
|
||||
if dz == -1 then
|
||||
pos.z = pos.z + dz
|
||||
if math.random(1, 3) == 1 and multicraft.get_node(pos).name == "air" then
|
||||
multicraft.add_node(pos, {name = "default:vine", param2 = 4})
|
||||
end
|
||||
pos.x = pos.x+1
|
||||
if math.random(1, 3) == 1 and multicraft.get_node(pos).name == "air" then
|
||||
multicraft.add_node(pos, {name = "default:vine", param2 = 4})
|
||||
end
|
||||
pos.x = pos.x-1
|
||||
pos.z = pos.z - dz
|
||||
elseif dz == 2 then
|
||||
pos.z = pos.z + dz
|
||||
if math.random(1, 3) == 1 and multicraft.get_node(pos).name == "air"then
|
||||
multicraft.add_node(pos, {name = "default:vine", param2 = 5})
|
||||
end
|
||||
pos.x = pos.x+1
|
||||
if math.random(1, 3) == 1 and multicraft.get_node(pos).name == "air" then
|
||||
multicraft.add_node(pos, {name = "default:vine", param2 = 5})
|
||||
end
|
||||
pos.x = pos.x-1
|
||||
pos.z = pos.z - dz
|
||||
else
|
||||
pos.z = pos.z + dz
|
||||
pos.x = pos.x-1
|
||||
if math.random(1, 3) == 1 and multicraft.get_node(pos).name == "air" then
|
||||
multicraft.add_node(pos, {name = "default:vine", param2 = 2})
|
||||
end
|
||||
pos.x = pos.x+1
|
||||
if multicraft.get_node(pos).name == "air" then
|
||||
multicraft.add_node(pos, {name = trunk, param2=2})
|
||||
end
|
||||
pos.x = pos.x+1
|
||||
if multicraft.get_node(pos).name == "air" then
|
||||
multicraft.add_node(pos, {name = trunk, param2=2})
|
||||
end
|
||||
pos.x = pos.x+1
|
||||
if math.random(1, 3) == 1 and multicraft.get_node(pos).name == "air" then
|
||||
multicraft.add_node(pos, {name = "default:vine", param2 = 3})
|
||||
end
|
||||
pos.x = pos.x-2
|
||||
pos.z = pos.z - dz
|
||||
end
|
||||
end
|
||||
|
||||
pos.y = pos.y-dy
|
||||
end
|
||||
|
||||
-- make leaves
|
||||
node = {name = leaves}
|
||||
pos.y = pos.y+tree_size-4
|
||||
for dx=-5,5 do
|
||||
for dz=-5,5 do
|
||||
for dy=0,3 do
|
||||
pos.x = pos.x+dx
|
||||
pos.y = pos.y+dy
|
||||
pos.z = pos.z+dz
|
||||
|
||||
if dx == 0 and dz == 0 and dy==3 then
|
||||
if multicraft.get_node(pos).name == "air" or multicraft.get_node(pos).name == "default:vine" and math.random(1, 2) == 1 then
|
||||
multicraft.add_node(pos, node)
|
||||
end
|
||||
elseif dx == 0 and dz == 0 and dy==4 then
|
||||
if multicraft.get_node(pos).name == "air" or multicraft.get_node(pos).name == "default:vine" and math.random(1, 5) == 1 then
|
||||
multicraft.add_node(pos, node)
|
||||
multicraft.add_node(pos, air_leave())
|
||||
end
|
||||
elseif math.abs(dx) ~= 2 and math.abs(dz) ~= 2 then
|
||||
if multicraft.get_node(pos).name == "air" or multicraft.get_node(pos).name == "default:vine" then
|
||||
multicraft.add_node(pos, node)
|
||||
end
|
||||
else
|
||||
if math.abs(dx) ~= 2 or math.abs(dz) ~= 2 then
|
||||
if multicraft.get_node(pos).name == "air" or multicraft.get_node(pos).name == "default:vine" and math.random(1, 3) == 1 then
|
||||
multicraft.add_node(pos, node)
|
||||
end
|
||||
else
|
||||
if math.random(1, 5) == 1 and multicraft.get_node(pos).name == "air" then
|
||||
multicraft.add_node(pos, node)
|
||||
end
|
||||
end
|
||||
end
|
||||
pos.x = pos.x-dx
|
||||
pos.y = pos.y-dy
|
||||
pos.z = pos.z-dz
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local plant_tab = {}
|
||||
local rnd_max = 5
|
||||
multicraft.after(0.5, function()
|
||||
plant_tab[0] = "air"
|
||||
plant_tab[1] = "default:grass"
|
||||
plant_tab[2] = "default:grass"
|
||||
plant_tab[3] = "default:grass"
|
||||
plant_tab[4] = "default:grass"
|
||||
plant_tab[5] = "default:grass"
|
||||
|
||||
if multicraft.get_modpath("flowers") ~= nil then
|
||||
rnd_max = 16
|
||||
plant_tab[6] = "flowers:dandelion_yellow"
|
||||
plant_tab[7] = "flowers:rose"
|
||||
plant_tab[8] = "flowers:oxeye_daisy"
|
||||
plant_tab[9] = "flowers:tulip_orange"
|
||||
plant_tab[10] = "flowers:tulip_red"
|
||||
plant_tab[11] = "flowers:tulip_white"
|
||||
plant_tab[12] = "flowers:tulip_pink"
|
||||
plant_tab[13] = "flowers:allium"
|
||||
plant_tab[14] = "flowers:paeonia"
|
||||
plant_tab[15] = "flowers:houstonia"
|
||||
plant_tab[16] = "flowers:blue_orchid"
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
function duengen(pointed_thing)
|
||||
pos = pointed_thing.under
|
||||
n = multicraft.get_node(pos)
|
||||
if n.name == "" then return end
|
||||
local stage = ""
|
||||
if n.name == "default:sapling" then
|
||||
multicraft.add_node(pos, {name="air"})
|
||||
generate_tree(pos, "default:tree", "default:leaves", 1)
|
||||
elseif string.find(n.name, "farming:wheat_") ~= nil then
|
||||
stage = string.sub(n.name, 15)
|
||||
if stage == "3" then
|
||||
multicraft.add_node(pos, {name="farming:wheat"})
|
||||
elseif math.random(1,5) < 3 then
|
||||
multicraft.add_node(pos, {name="farming:wheat"})
|
||||
else
|
||||
multicraft.add_node(pos, {name="farming:wheat_"..math.random(2,3)})
|
||||
end
|
||||
elseif string.find(n.name, "farming:potato_") ~= nil then
|
||||
stage = tonumber(string.sub(n.name, 16))
|
||||
if stage == 1 then
|
||||
multicraft.add_node(pos, {name="farming:potato_"..math.random(stage,2)})
|
||||
else
|
||||
multicraft.add_node(pos, {name="farming:potato"})
|
||||
end
|
||||
elseif string.find(n.name, "farming:carrot_") ~= nil then
|
||||
stage = tonumber(string.sub(n.name, 16))
|
||||
if stage == 1 then
|
||||
multicraft.add_node(pos, {name="farming:carrot_"..math.random(stage,2)})
|
||||
else
|
||||
multicraft.add_node(pos, {name="farming:carrot"})
|
||||
end
|
||||
elseif string.find(n.name, "farming:pumpkin_") ~= nil then
|
||||
stage = tonumber(string.sub(n.name, 17))
|
||||
if stage == 1 then
|
||||
multicraft.add_node(pos, {name="farming:pumpkin_"..math.random(stage,2)})
|
||||
else
|
||||
multicraft.add_node(pos, {name="farming:pumpkintige_unconnect"})
|
||||
end
|
||||
elseif string.find(n.name, "farming:melontige_") ~= nil then
|
||||
stage = tonumber(string.sub(n.name, 18))
|
||||
if stage == 1 then
|
||||
multicraft.add_node(pos, {name="farming:melontige_"..math.random(stage,2)})
|
||||
else
|
||||
multicraft.add_node(pos, {name="farming:melontige_unconnect"})
|
||||
end
|
||||
elseif n.name ~= "" and n.name == "default:junglesapling" then
|
||||
multicraft.add_node(pos, {name="air"})
|
||||
generate_tree(pos, "default:jungletree", "default:jungleleaves", 2)
|
||||
elseif n.name ~="" and n.name == "default:reeds" then
|
||||
grow_reeds(pos)
|
||||
elseif n.name ~="" and n.name == "default:cactus" then
|
||||
grow_cactus(pos)
|
||||
elseif n.name == "default:dirt_with_grass" then
|
||||
for i = -2, 3, 1 do
|
||||
for j = -3, 2, 1 do
|
||||
pos = pointed_thing.above
|
||||
pos = {x=pos.x+i, y=pos.y, z=pos.z+j}
|
||||
n = multicraft.get_node(pos)
|
||||
n2 = multicraft.get_node({x=pos.x, y=pos.y-1, z=pos.z})
|
||||
|
||||
if n.name ~= "" and n.name == "air" and n2.name == "default:dirt_with_grass" then
|
||||
if math.random(0,5) > 3 then
|
||||
multicraft.add_node(pos, {name=plant_tab[math.random(0, rnd_max)]})
|
||||
else
|
||||
multicraft.add_node(pos, {name=plant_tab[math.random(0, 5)]})
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
------------------------------
|
||||
-- Try generate grass dirt ---
|
||||
------------------------------
|
||||
-- turn dirt to dirt with grass
|
||||
multicraft.register_abm({
|
||||
nodenames = {"default:dirt"},
|
||||
neighbors = {"air"},
|
||||
interval = 30,
|
||||
chance = 20,
|
||||
action = function(pos)
|
||||
local can_change = 0
|
||||
for i=1,4 do
|
||||
local p = {x=pos.x, y=pos.y+i, z=pos.z}
|
||||
local n = multicraft.get_node(p)
|
||||
-- On verifie si il y a de l'air
|
||||
if (n.name=="air") then
|
||||
can_change = can_change + 1
|
||||
end
|
||||
end
|
||||
if can_change > 3 then
|
||||
local light = multicraft.get_node_light(pos)
|
||||
if light or light > 10 then
|
||||
multicraft.add_node(pos, {name="default:dirt_with_grass"})
|
||||
end
|
||||
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
--------------------------
|
||||
-- Try generate tree ---
|
||||
--------------------------
|
||||
-- Normal tree
|
||||
multicraft.register_abm({
|
||||
nodenames = {"default:sapling"},
|
||||
neighbors = {"default:dirt", "default:dirt_with_grass"},
|
||||
interval = 30,
|
||||
chance = 15,
|
||||
action = function(pos)
|
||||
local light = multicraft.get_node_light(pos)
|
||||
if light or light > 10 then
|
||||
multicraft.add_node(pos, {name="air"})
|
||||
generate_tree(pos, "default:tree", "default:leaves", 1)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Jungle Tree
|
||||
multicraft.register_abm({
|
||||
nodenames = {"default:junglesapling"},
|
||||
neighbors = {"default:dirt", "default:dirt_with_grass"},
|
||||
interval = 30,
|
||||
chance = 15,
|
||||
action = function(pos)
|
||||
local light = multicraft.get_node_light(pos)
|
||||
if light or light > 10 then
|
||||
multicraft.add_node(pos, {name="air"})
|
||||
generate_tree(pos, "default:jungletree", "default:jungleleaves", 2)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
---------------------
|
||||
-- Vine generating --
|
||||
---------------------
|
||||
multicraft.register_abm({
|
||||
nodenames = {"default:vine"},
|
||||
interval = 80,
|
||||
chance = 5,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local newpos = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local n = multicraft.get_node(newpos)
|
||||
if n.name == "air" then
|
||||
walldir = node.param2
|
||||
multicraft.add_node(newpos, {name = "default:vine", param2 = walldir})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- Snowballs
|
||||
--
|
||||
|
||||
snowball_GRAVITY=9
|
||||
snowball_VELOCITY=19
|
||||
|
||||
--Shoot snowball.
|
||||
snow_shoot_snowball=function (item, player, pointed_thing)
|
||||
local playerpos=player:getpos()
|
||||
local obj=multicraft.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, "default:snowball_entity")
|
||||
local dir=player:get_look_dir()
|
||||
obj:setvelocity({x=dir.x*snowball_VELOCITY, y=dir.y*snowball_VELOCITY, z=dir.z*snowball_VELOCITY})
|
||||
obj:setacceleration({x=dir.x*-3, y=-snowball_GRAVITY, z=dir.z*-3})
|
||||
item:take_item()
|
||||
return item
|
||||
end
|
||||
|
||||
--The snowball Entity
|
||||
snowball_ENTITY={
|
||||
physical = false,
|
||||
timer=0,
|
||||
textures = {"default_snowball.png"},
|
||||
lastpos={},
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
}
|
||||
|
||||
--Snowball_entity.on_step()--> called when snowball is moving.
|
||||
snowball_ENTITY.on_step = function(self, dtime)
|
||||
self.timer=self.timer+dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = multicraft.get_node(pos)
|
||||
|
||||
--Become item when hitting a node.
|
||||
if self.lastpos.x~=nil then --If there is no lastpos for some reason.
|
||||
if node.name ~= "air" then
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z} -- Set lastpos-->Node will be added at last pos outside the node
|
||||
end
|
||||
|
||||
multicraft.register_entity("default:snowball_entity", snowball_ENTITY)
|
||||
|
||||
-- Global environment step function
|
||||
function on_step(dtime)
|
||||
-- print("on_step")
|
||||
end
|
||||
multicraft.register_globalstep(on_step)
|
||||
|
||||
function on_placenode(p, node)
|
||||
--print("on_placenode")
|
||||
end
|
||||
multicraft.register_on_placenode(on_placenode)
|
||||
|
||||
function on_dignode(p, node)
|
||||
--print("on_dignode")
|
||||
end
|
||||
multicraft.register_on_dignode(on_dignode)
|
||||
|
||||
function on_punchnode(p, node)
|
||||
end
|
||||
multicraft.register_on_punchnode(on_punchnode)
|
||||
|
||||
-- END
|
||||
|
||||
-- Support old code
|
||||
function default.spawn_falling_node(p, nodename)
|
||||
spawn_falling_node(p, nodename)
|
||||
end
|
||||
|
||||
-- Horrible crap to support old code
|
||||
-- Don't use this and never do what this does, it's completely wrong!
|
||||
-- (More specifically, the client and the C++ code doesn't get the group)
|
||||
function default.register_falling_node(nodename, texture)
|
||||
multicraft.log("error", debug.traceback())
|
||||
multicraft.log('error', "WARNING: default.register_falling_node is deprecated")
|
||||
if multicraft.registered_nodes[nodename] then
|
||||
multicraft.registered_nodes[nodename].groups.falling_node = 1
|
||||
end
|
||||
end
|
||||
|
||||
--Sounds
|
||||
|
||||
|
||||
--
|
||||
-- Sounds
|
||||
--
|
||||
|
||||
function default.node_sound_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="", gain=1.0}
|
||||
table.dug = table.dug or
|
||||
{name="default_dug_node", gain=0.25}
|
||||
table.place = table.place or
|
||||
{name="default_place_node_hard", gain=1.0}
|
||||
return table
|
||||
end
|
||||
|
||||
function default.node_sound_stone_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_hard_footstep", gain=0.5}
|
||||
table.dug = table.dug or
|
||||
{name="default_hard_footstep", gain=1.0}
|
||||
default.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function default.node_sound_dirt_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_dirt_footstep", gain=1.0}
|
||||
table.dug = table.dug or
|
||||
{name="default_dirt_footstep", gain=1.5}
|
||||
table.place = table.place or
|
||||
{name="default_place_node", gain=1.0}
|
||||
default.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function default.node_sound_sand_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_sand_footstep", gain=0.5}
|
||||
table.dug = table.dug or
|
||||
{name="default_sand_footstep", gain=1.0}
|
||||
table.place = table.place or
|
||||
{name="default_place_node", gain=1.0}
|
||||
default.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function default.node_sound_wood_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_wood_footstep", gain=0.5}
|
||||
table.dug = table.dug or
|
||||
{name="default_wood_footstep", gain=1.0}
|
||||
default.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function default.node_sound_leaves_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_grass_footstep", gain=0.35}
|
||||
table.dug = table.dug or
|
||||
{name="default_grass_footstep", gain=0.85}
|
||||
table.dig = table.dig or
|
||||
{name="default_dig_crumbly", gain=0.4}
|
||||
table.place = table.place or
|
||||
{name="default_place_node", gain=1.0}
|
||||
default.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
||||
function default.node_sound_glass_defaults(table)
|
||||
table = table or {}
|
||||
table.footstep = table.footstep or
|
||||
{name="default_glass_footstep", gain=0.5}
|
||||
table.dug = table.dug or
|
||||
{name="default_break_glass", gain=1.0}
|
||||
default.node_sound_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
||||
-- Leaf Decay
|
||||
|
||||
-- To enable leaf decay for a node, add it to the "leafdecay" group.
|
||||
--
|
||||
-- The rating of the group determines how far from a node in the group "tree"
|
||||
-- the node can be without decaying.
|
||||
--
|
||||
-- If param2 of the node is ~= 0, the node will always be preserved. Thus, if
|
||||
-- the player places a node of that kind, you will want to set param2=1 or so.
|
||||
--
|
||||
-- If the node is in the leafdecay_drop group then the it will always be dropped
|
||||
-- as an item
|
||||
|
||||
default.leafdecay_trunk_cache = {}
|
||||
default.leafdecay_enable_cache = true
|
||||
-- Spread the load of finding trunks
|
||||
default.leafdecay_trunk_find_allow_accumulator = 0
|
||||
|
||||
multicraft.register_globalstep(function(dtime)
|
||||
local finds_per_second = 5000
|
||||
default.leafdecay_trunk_find_allow_accumulator =
|
||||
math.floor(dtime * finds_per_second)
|
||||
end)
|
||||
|
||||
multicraft.register_abm({
|
||||
nodenames = {"group:leafdecay"},
|
||||
neighbors = {"air", "group:liquid"},
|
||||
-- A low interval and a high inverse chance spreads the load
|
||||
interval = 2,
|
||||
chance = 5,
|
||||
|
||||
action = function(p0, node, _, _)
|
||||
--print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")")
|
||||
local do_preserve = false
|
||||
local d = multicraft.registered_nodes[node.name].groups.leafdecay
|
||||
if not d or d == 0 then
|
||||
--print("not groups.leafdecay")
|
||||
return
|
||||
end
|
||||
local n0 = multicraft.get_node(p0)
|
||||
if n0.param2 ~= 0 then
|
||||
--print("param2 ~= 0")
|
||||
return
|
||||
end
|
||||
local p0_hash = nil
|
||||
if default.leafdecay_enable_cache then
|
||||
p0_hash = multicraft.hash_node_position(p0)
|
||||
local trunkp = default.leafdecay_trunk_cache[p0_hash]
|
||||
if trunkp then
|
||||
local n = multicraft.get_node(trunkp)
|
||||
local reg = multicraft.registered_nodes[n.name]
|
||||
-- Assume ignore is a trunk, to make the thing work at the border of the active area
|
||||
if n.name == "ignore" or (reg and reg.groups.tree and reg.groups.tree ~= 0) then
|
||||
--print("cached trunk still exists")
|
||||
return
|
||||
end
|
||||
--print("cached trunk is invalid")
|
||||
-- Cache is invalid
|
||||
table.remove(default.leafdecay_trunk_cache, p0_hash)
|
||||
end
|
||||
end
|
||||
if default.leafdecay_trunk_find_allow_accumulator <= 0 then
|
||||
return
|
||||
end
|
||||
default.leafdecay_trunk_find_allow_accumulator =
|
||||
default.leafdecay_trunk_find_allow_accumulator - 1
|
||||
-- Assume ignore is a trunk, to make the thing work at the border of the active area
|
||||
local p1 = multicraft.find_node_near(p0, d, {"ignore", "group:tree"})
|
||||
if p1 then
|
||||
do_preserve = true
|
||||
if default.leafdecay_enable_cache then
|
||||
--print("caching trunk")
|
||||
-- Cache the trunk
|
||||
default.leafdecay_trunk_cache[p0_hash] = p1
|
||||
end
|
||||
end
|
||||
if not do_preserve then
|
||||
-- Drop stuff other than the node itself
|
||||
itemstacks = multicraft.get_node_drops(n0.name)
|
||||
for _, itemname in ipairs(itemstacks) do
|
||||
if multicraft.get_item_group(n0.name, "leafdecay_drop") ~= 0 or
|
||||
itemname ~= n0.name then
|
||||
local p_drop = {
|
||||
x = p0.x - 0.5 + math.random(),
|
||||
y = p0.y - 0.5 + math.random(),
|
||||
z = p0.z - 0.5 + math.random(),
|
||||
}
|
||||
multicraft.add_item(p_drop, itemname)
|
||||
end
|
||||
end
|
||||
-- Remove node
|
||||
multicraft.remove_node(p0)
|
||||
nodeupdate(p0)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
------------------------
|
||||
-- Create Color Glass --
|
||||
------------------------
|
||||
function AddGlass(desc, recipeitem, color)
|
||||
|
||||
multicraft.register_node("default:glass"..color, {
|
||||
description = desc,
|
||||
drawtype = "glasslike",
|
||||
tile_images = {"xpanes_pane_glass"..color..".png"},
|
||||
inventory_image = multicraft.inventorycube("xpanes_pane_glass"..color..".png"),
|
||||
paramtype = "light",
|
||||
use_texture_alpha = true,
|
||||
stack_max = 64,
|
||||
groups = {cracky=3,oddly_breakable_by_hand=3, building = 1},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
drop = "",
|
||||
})
|
||||
|
||||
multicraft.register_craft({
|
||||
output = 'default:glass_'..color..'',
|
||||
recipe = {
|
||||
{'default:glass', 'group:dye,'..recipeitem}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
if not multicraft.get_modpath("check") then os.exit() end
|
||||
-- multicraft 0.4 mod: default
|
||||
-- See README.txt for licensing and other information.
|
||||
|
||||
-- The API documentation in here was moved into doc/lua_api.txt
|
||||
|
||||
WATER_ALPHA = 160
|
||||
WATER_VISC = 1
|
||||
LAVA_VISC = 7
|
||||
LIGHT_MAX = 20
|
||||
|
||||
-- Definitions made by this mod that other mods can use too
|
||||
default = {}
|
||||
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 = true
|
||||
exit = os.exit
|
||||
default.exit = exit
|
||||
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
|
||||
|
||||
-- Load files
|
||||
dofile(multicraft.get_modpath("default").."/functions.lua")
|
||||
dofile(multicraft.get_modpath("default").."/nodes.lua")
|
||||
dofile(multicraft.get_modpath("default").."/tools.lua")
|
||||
dofile(multicraft.get_modpath("default").."/craftitems.lua")
|
||||
dofile(multicraft.get_modpath("default").."/crafting.lua")
|
||||
dofile(multicraft.get_modpath("default").."/mapgen.lua")
|
||||
dofile(multicraft.get_modpath("default").."/player.lua")
|
||||
|
||||
-- Aliases
|
||||
multicraft.register_alias("default:desert_sand", "default:sand")
|
||||
multicraft.register_alias("default:desert_stone", "default:sandstone")
|
||||
multicraft.register_alias("default:iron_lump", "default:stone_with_iron")
|
||||
multicraft.register_alias("default:gold_lump", "default:stone_with_gold")
|
|
@ -0,0 +1,512 @@
|
|||
-- mods/default/mapgen.lua
|
||||
|
||||
--
|
||||
-- Aliases for map generator outputs
|
||||
--
|
||||
|
||||
multicraft.register_alias("mapgen_air", "air")
|
||||
multicraft.register_alias("mapgen_stone", "default:stone")
|
||||
multicraft.register_alias("mapgen_tree", "default:tree")
|
||||
multicraft.register_alias("mapgen_leaves", "default:leaves")
|
||||
multicraft.register_alias("mapgen_jungletree", "default:jungletree")
|
||||
multicraft.register_alias("mapgen_jungleleaves", "default:jungleleaves")
|
||||
multicraft.register_alias("mapgen_apple", "default:leaves")
|
||||
multicraft.register_alias("mapgen_water_source", "default:water_source")
|
||||
multicraft.register_alias("mapgen_dirt", "default:dirt")
|
||||
multicraft.register_alias("mapgen_sand", "default:sand")
|
||||
multicraft.register_alias("mapgen_gravel", "default:gravel")
|
||||
multicraft.register_alias("mapgen_clay", "default:clay")
|
||||
multicraft.register_alias("mapgen_lava_source", "default:lava_source")
|
||||
multicraft.register_alias("mapgen_cobble", "default:cobble")
|
||||
multicraft.register_alias("mapgen_mossycobble", "default:mossycobble")
|
||||
multicraft.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass")
|
||||
multicraft.register_alias("mapgen_junglegrass", "default:junglegrass")
|
||||
multicraft.register_alias("mapgen_stone_with_coal", "default:stone_with_coal")
|
||||
multicraft.register_alias("mapgen_stone_with_iron", "default:stone_with_iron")
|
||||
multicraft.register_alias("mapgen_desert_sand", "default:sand")
|
||||
multicraft.register_alias("mapgen_desert_stone", "default:sandstone")
|
||||
|
||||
--
|
||||
-- Ore generation
|
||||
--
|
||||
|
||||
--
|
||||
-- Coal
|
||||
--
|
||||
multicraft.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_coal",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 500,
|
||||
clust_num_ores = 8,
|
||||
clust_size = 3,
|
||||
height_min = -59,
|
||||
height_max = -12,
|
||||
})
|
||||
multicraft.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_coal",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 1000,
|
||||
clust_num_ores = 6,
|
||||
clust_size = 3,
|
||||
height_min = -11,
|
||||
height_max = 64,
|
||||
})
|
||||
multicraft.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_coal",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 5000,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 2,
|
||||
height_min = 65,
|
||||
height_max = 67,
|
||||
})
|
||||
|
||||
--
|
||||
-- Iron
|
||||
--
|
||||
multicraft.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_iron",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 830,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
height_min = -59,
|
||||
height_max = -10,
|
||||
})
|
||||
multicraft.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_iron",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 1660,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
height_min = -9,
|
||||
height_max = 0,
|
||||
})
|
||||
|
||||
--
|
||||
-- Gold
|
||||
--
|
||||
multicraft.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_gold",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 5000,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
height_min = -59,
|
||||
height_max = -35,
|
||||
})
|
||||
multicraft.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_gold",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 10000,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
height_min = -35,
|
||||
height_max = -33,
|
||||
})
|
||||
|
||||
--
|
||||
-- Diamond
|
||||
--
|
||||
multicraft.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_diamond",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 10000,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
height_min = -59,
|
||||
height_max = -48,
|
||||
})
|
||||
multicraft.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_diamond",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 5000,
|
||||
clust_num_ores = 2,
|
||||
clust_size = 2,
|
||||
height_min = -59,
|
||||
height_max = -48,
|
||||
})
|
||||
multicraft.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_diamond",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 10000,
|
||||
clust_num_ores = 8,
|
||||
clust_size = 3,
|
||||
height_min = -55,
|
||||
height_max = -52,
|
||||
})
|
||||
|
||||
--
|
||||
-- Redstone
|
||||
--
|
||||
|
||||
multicraft.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_redstone",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 10000,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
height_min = -59,
|
||||
height_max = -48,
|
||||
})
|
||||
|
||||
multicraft.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_redstone",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 10000,
|
||||
clust_num_ores = 10,
|
||||
clust_size = 4,
|
||||
height_min = -59,
|
||||
height_max = -48,
|
||||
})
|
||||
|
||||
--
|
||||
-- Emerald
|
||||
--
|
||||
|
||||
multicraft.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_emerald",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 10000,
|
||||
clust_num_ores = 1,
|
||||
clust_size = 2,
|
||||
height_min = -59,
|
||||
height_max = -35,
|
||||
})
|
||||
|
||||
multicraft.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_emerald",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 50000,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
height_min = -59,
|
||||
height_max = -35,
|
||||
})
|
||||
|
||||
--
|
||||
-- Lapis Lazuli
|
||||
--
|
||||
|
||||
multicraft.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_lapis",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 10000,
|
||||
clust_num_ores = 7,
|
||||
clust_size = 4,
|
||||
height_min = -50,
|
||||
height_max = -46,
|
||||
})
|
||||
|
||||
multicraft.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_lapis",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 10000,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 4,
|
||||
height_min = -59,
|
||||
height_max = -50,
|
||||
})
|
||||
|
||||
--
|
||||
-- Glowstone
|
||||
--
|
||||
multicraft.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:glowstone",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 50000,
|
||||
clust_num_ores = 10,
|
||||
clust_size = 5,
|
||||
height_min = -59,
|
||||
height_max = -0,
|
||||
})
|
||||
|
||||
function default.generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max)
|
||||
multicraft.log('action', "WARNING: default.generate_ore is deprecated")
|
||||
|
||||
if maxp.y < height_min or minp.y > height_max then
|
||||
return
|
||||
end
|
||||
local y_min = math.max(minp.y, height_min)
|
||||
local y_max = math.min(maxp.y, height_max)
|
||||
if chunk_size >= y_max - y_min + 1 then
|
||||
return
|
||||
end
|
||||
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
|
||||
local pr = PseudoRandom(seed)
|
||||
local num_chunks = math.floor(chunks_per_volume * volume)
|
||||
local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk)
|
||||
--print("generate_ore num_chunks: "..dump(num_chunks))
|
||||
for i=1,num_chunks do
|
||||
local y0 = pr:next(y_min, y_max-chunk_size+1)
|
||||
if y0 >= height_min and y0 <= height_max then
|
||||
local x0 = pr:next(minp.x, maxp.x-chunk_size+1)
|
||||
local z0 = pr:next(minp.z, maxp.z-chunk_size+1)
|
||||
local p0 = {x=x0, y=y0, z=z0}
|
||||
for x1=0,chunk_size-1 do
|
||||
for y1=0,chunk_size-1 do
|
||||
for z1=0,chunk_size-1 do
|
||||
if pr:next(1,inverse_chance) == 1 then
|
||||
local x2 = x0+x1
|
||||
local y2 = y0+y1
|
||||
local z2 = z0+z1
|
||||
local p2 = {x=x2, y=y2, z=z2}
|
||||
if multicraft.get_node(p2).name == wherein then
|
||||
multicraft.set_node(p2, {name=name})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--print("generate_ore done")
|
||||
end
|
||||
|
||||
function default.make_reeds(pos, size)
|
||||
for y=0,size-1 do
|
||||
local p = {x=pos.x, y=pos.y+y, z=pos.z}
|
||||
local nn = multicraft.get_node(p).name
|
||||
if multicraft.registered_nodes[nn] and
|
||||
multicraft.registered_nodes[nn].buildable_to then
|
||||
multicraft.set_node(p, {name="default:reeds"})
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function default.make_cactus(pos, size)
|
||||
for y=0,size-1 do
|
||||
local p = {x=pos.x, y=pos.y+y, z=pos.z}
|
||||
local nn = multicraft.get_node(p).name
|
||||
if multicraft.registered_nodes[nn] and
|
||||
multicraft.registered_nodes[nn].buildable_to or nn=='air' then
|
||||
multicraft.set_node(p, {name="default:cactus"})
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
multicraft.register_on_generated(function(minp, maxp, seed)
|
||||
if maxp.y >= 2 and minp.y <= 0 then
|
||||
-- Generate clay
|
||||
-- Assume X and Z lengths are equal
|
||||
local divlen = 4
|
||||
local divs = (maxp.x-minp.x)/divlen+1;
|
||||
for divx=0+1,divs-1-1 do
|
||||
for divz=0+1,divs-1-1 do
|
||||
local cx = minp.x + math.floor((divx+0.5)*divlen)
|
||||
local cz = minp.z + math.floor((divz+0.5)*divlen)
|
||||
if multicraft.get_node({x=cx,y=1,z=cz}).name == "default:water_source" and
|
||||
multicraft.get_node({x=cx,y=0,z=cz}).name == "default:sand" then
|
||||
local is_shallow = true
|
||||
local num_water_around = 0
|
||||
if multicraft.get_node({x=cx-divlen*2,y=1,z=cz+0}).name == "default:water_source" then
|
||||
num_water_around = num_water_around + 1 end
|
||||
if multicraft.get_node({x=cx+divlen*2,y=1,z=cz+0}).name == "default:water_source" then
|
||||
num_water_around = num_water_around + 1 end
|
||||
if multicraft.get_node({x=cx+0,y=1,z=cz-divlen*2}).name == "default:water_source" then
|
||||
num_water_around = num_water_around + 1 end
|
||||
if multicraft.get_node({x=cx+0,y=1,z=cz+divlen*2}).name == "default:water_source" then
|
||||
num_water_around = num_water_around + 1 end
|
||||
if num_water_around >= 2 then
|
||||
is_shallow = false
|
||||
end
|
||||
if is_shallow then
|
||||
for x1=-divlen,divlen do
|
||||
for z1=-divlen,divlen do
|
||||
if multicraft.get_node({x=cx+x1,y=0,z=cz+z1}).name == "default:sand" then
|
||||
multicraft.set_node({x=cx+x1,y=0,z=cz+z1}, {name="default:clay"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Generate reeds
|
||||
local perlin1 = multicraft.get_perlin(354, 3, 0.7, 100)
|
||||
-- Assume X and Z lengths are equal
|
||||
local divlen = 8
|
||||
local divs = (maxp.x-minp.x)/divlen+1;
|
||||
for divx=0,divs-1 do
|
||||
for divz=0,divs-1 do
|
||||
local x0 = minp.x + math.floor((divx+0)*divlen)
|
||||
local z0 = minp.z + math.floor((divz+0)*divlen)
|
||||
local x1 = minp.x + math.floor((divx+1)*divlen)
|
||||
local z1 = minp.z + math.floor((divz+1)*divlen)
|
||||
-- Determine reeds amount from perlin noise
|
||||
local reeds_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 45 - 20)
|
||||
-- Find random positions for reeds based on this random
|
||||
local pr = PseudoRandom(seed+1)
|
||||
for i=0,reeds_amount do
|
||||
local x = pr:next(x0, x1)
|
||||
local z = pr:next(z0, z1)
|
||||
if multicraft.get_node({x=x,y=1,z=z}).name == "default:dirt_with_grass" and
|
||||
multicraft.find_node_near({x=x,y=1,z=z}, 1, "default:water_source") then
|
||||
default.make_reeds({x=x,y=2,z=z}, pr:next(2, 4))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Generate cactuses
|
||||
local perlin1 = multicraft.get_perlin(230, 3, 0.6, 100)
|
||||
-- Assume X and Z lengths are equal
|
||||
local divlen = 14
|
||||
local divs = (maxp.x-minp.x)/divlen+1;
|
||||
for divx=0,divs-1 do
|
||||
for divz=0,divs-1 do
|
||||
local x0 = minp.x + math.floor((divx+0)*divlen)
|
||||
local z0 = minp.z + math.floor((divz+0)*divlen)
|
||||
local x1 = minp.x + math.floor((divx+1)*divlen)
|
||||
local z1 = minp.z + math.floor((divz+1)*divlen)
|
||||
-- Determine cactus amount from perlin noise
|
||||
local cactus_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 6 - 3)
|
||||
-- Find random positions for cactus based on this random
|
||||
local pr = PseudoRandom(seed+1)
|
||||
for i=0,cactus_amount do
|
||||
local x = pr:next(x0, x1)
|
||||
local z = pr:next(z0, z1)
|
||||
-- Find ground level (0...15)
|
||||
local ground_y = nil
|
||||
for y=30,0,-1 do
|
||||
if multicraft.get_node({x=x,y=y,z=z}).name ~= "air" then
|
||||
ground_y = y
|
||||
break
|
||||
end
|
||||
end
|
||||
-- If desert sand, make cactus
|
||||
local nm = multicraft.get_node({x=x,y=ground_y,z=z}).name
|
||||
if ground_y and (nm == "default:sand" or nm == 'default:desert_sand') then
|
||||
default.make_cactus({x=x,y=ground_y+1,z=z}, pr:next(2, 4))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Generate grass
|
||||
local perlin1 = multicraft.get_perlin(329, 3, 0.6, 100)
|
||||
-- Assume X and Z lengths are equal
|
||||
local divlen = 5
|
||||
local divs = (maxp.x-minp.x)/divlen+1;
|
||||
for divx=0,divs-1 do
|
||||
for divz=0,divs-1 do
|
||||
local x0 = minp.x + math.floor((divx+0)*divlen)
|
||||
local z0 = minp.z + math.floor((divz+0)*divlen)
|
||||
local x1 = minp.x + math.floor((divx+1)*divlen)
|
||||
local z1 = minp.z + math.floor((divz+1)*divlen)
|
||||
-- Determine grass amount from perlin noise
|
||||
local grass_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 9)
|
||||
-- Find random positions for grass based on this random
|
||||
local pr = PseudoRandom(seed+1)
|
||||
for i=0,grass_amount do
|
||||
local x = pr:next(x0, x1)
|
||||
local z = pr:next(z0, z1)
|
||||
-- Find ground level (0...15)
|
||||
local ground_y = nil
|
||||
for y=30,0,-1 do
|
||||
if multicraft.get_node({x=x,y=y,z=z}).name ~= "air" then
|
||||
ground_y = y
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if ground_y then
|
||||
local p = {x=x,y=ground_y+1,z=z}
|
||||
local nn = multicraft.get_node(p).name
|
||||
-- Check if the node can be replaced
|
||||
if multicraft.registered_nodes[nn] and
|
||||
multicraft.registered_nodes[nn].buildable_to then
|
||||
nn = multicraft.get_node({x=x,y=ground_y,z=z}).name
|
||||
-- If desert sand, add dry shrub
|
||||
if math.random()<0.1 then
|
||||
--if pr:next() < 5500 then -- the "proper" alternative
|
||||
if (nn == "default:sand" or nn == 'default:desert_sand') then
|
||||
multicraft.set_node(p,{name="default:dry_shrub"})
|
||||
end
|
||||
-- If dirt with grass, add grass
|
||||
elseif nn == "default:dirt_with_grass" then
|
||||
multicraft.set_node(p,{name="default:grass"})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Generate nyan cats
|
||||
--generate_nyancats(seed, minp, maxp)
|
||||
end)
|
||||
|
||||
local function replace(old, new, min, max)
|
||||
multicraft.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = new,
|
||||
wherein = old,
|
||||
clust_scarcity = 1,
|
||||
clust_num_ores = 1,
|
||||
clust_size = 1,
|
||||
height_min = min,
|
||||
height_max = max,
|
||||
})
|
||||
end
|
||||
replace("air", "default:bedrock", -90, -80)
|
||||
replace("air", "default:lava_source", -80, -70)
|
||||
replace("default:stone", "default:bedrock", -90, -80)
|
||||
replace("default:gravel", "default:bedrock", -90, -80)
|
||||
replace("default:dirt", "default:bedrock", -90, -80)
|
||||
replace("default:sand", "default:bedrock", -90, -80)
|
||||
replace("default:cobble", "default:bedrock", -90, -80)
|
||||
replace("default:mossycobble", "default:bedrock", -90, -80)
|
||||
replace("stairs:stair_cobble", "default:bedrock", -90, -80)
|
||||
replace("default:lava_source", "default:bedrock", -90, -80)
|
||||
replace("default:lava_flowing", "default:bedrock", -90, -80)
|
||||
replace("default:water_source", "default:bedrock", -90, -80)
|
||||
replace("default:water_flowing", "default:bedrock", -90, -80)
|
||||
|
||||
local function bedrock(old)
|
||||
multicraft.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:bedrock",
|
||||
wherein = old,
|
||||
clust_scarcity = 5,
|
||||
clust_num_ores = 3,
|
||||
clust_size = 2,
|
||||
height_min = -64,
|
||||
height_max = -60,
|
||||
})
|
||||
end
|
||||
bedrock("air")
|
||||
bedrock("default:stone")
|
||||
bedrock("default:gravel")
|
||||
bedrock("default:dirt")
|
||||
bedrock("default:sand")
|
||||
bedrock("default:cobble")
|
||||
bedrock("default:mossycobble")
|
||||
bedrock("stairs:stair_cobble")
|
||||
bedrock("default:lava_source")
|
||||
bedrock("default:lava_flowing")
|
||||
bedrock("default:water_source")
|
||||
bedrock("default:water_flowing")
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
|
@ -0,0 +1,359 @@
|
|||
xof 0303txt 0032
|
||||
|
||||
Frame Root {
|
||||
FrameTransformMatrix {
|
||||
1.000000, 0.000000, 0.000000, 0.000000,
|
||||
0.000000,-0.000000, 1.000000, 0.000000,
|
||||
0.000000, 1.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Frame Cube {
|
||||
FrameTransformMatrix {
|
||||
0.056399, 0.000000, 0.000000, 0.000000,
|
||||
0.000000, 0.056399, 0.000000, 0.000000,
|
||||
0.000000, 0.000000, 0.056399, 0.000000,
|
||||
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||
}
|
||||
Mesh { // Cube mesh
|
||||
104;
|
||||
-1.000000; 0.314103;-1.000000;,
|
||||
-1.000000;-0.314103;-1.000000;,
|
||||
-1.000000;-0.242418;-0.242418;,
|
||||
-1.000000; 0.242418;-0.242418;,
|
||||
-1.000000;-0.242418; 0.242418;,
|
||||
-1.000000; 0.242418; 0.242418;,
|
||||
-16.233685; 0.242418; 0.242418;,
|
||||
-16.233686;-0.242418; 0.242418;,
|
||||
-1.000000; 0.314103; 1.000000;,
|
||||
-1.000000; 0.314103;-1.000000;,
|
||||
-1.000000; 0.242418;-0.242418;,
|
||||
-1.000000; 0.242418; 0.242418;,
|
||||
-1.000000;-0.314103; 1.000000;,
|
||||
-1.000000; 0.314103; 1.000000;,
|
||||
-1.000000; 0.242418; 0.242418;,
|
||||
-1.000000;-0.242418; 0.242418;,
|
||||
-1.000000;-0.314103;-1.000000;,
|
||||
-1.000000;-0.314103; 1.000000;,
|
||||
-1.000000;-0.242418; 0.242418;,
|
||||
-1.000000;-0.242418;-0.242418;,
|
||||
-16.233685; 0.242418;-0.242418;,
|
||||
-16.233685;-0.242418;-0.242418;,
|
||||
-16.233685;-0.289522;-0.521628;,
|
||||
-16.233685; 0.289522;-0.521628;,
|
||||
-1.000000; 0.242418; 0.242418;,
|
||||
-1.000000; 0.242418;-0.242418;,
|
||||
-16.233685; 0.242418;-0.242418;,
|
||||
-16.233685; 0.242418; 0.242418;,
|
||||
-1.000000;-0.242418;-0.242418;,
|
||||
-1.000000;-0.242418; 0.242418;,
|
||||
-16.233686;-0.242418; 0.242418;,
|
||||
-16.233685;-0.242418;-0.242418;,
|
||||
-1.000000; 0.242418;-0.242418;,
|
||||
-1.000000;-0.242418;-0.242418;,
|
||||
-16.233685;-0.242418;-0.242418;,
|
||||
-16.233685; 0.242418;-0.242418;,
|
||||
-16.233686;-0.242418; 0.242418;,
|
||||
-16.233685; 0.242418; 0.242418;,
|
||||
-16.233685; 0.289522; 0.521628;,
|
||||
-16.233688;-0.289522; 0.521628;,
|
||||
-16.233685; 0.242418; 0.242418;,
|
||||
-16.233685; 0.242418;-0.242418;,
|
||||
-16.233685; 0.289522;-0.521628;,
|
||||
-16.233685; 0.289522; 0.521628;,
|
||||
-16.233685;-0.242418;-0.242418;,
|
||||
-16.233686;-0.242418; 0.242418;,
|
||||
-16.233688;-0.289522; 0.521628;,
|
||||
-16.233685;-0.289522;-0.521628;,
|
||||
-16.233685; 0.289522; 0.521628;,
|
||||
-16.233685; 0.289522;-0.521628;,
|
||||
-17.729048; 0.000000;-0.768652;,
|
||||
-17.729050; 0.000000; 0.768652;,
|
||||
-16.233685;-0.289522;-0.521628;,
|
||||
-16.233688;-0.289522; 0.521628;,
|
||||
-17.729050; 0.000000; 0.768652;,
|
||||
-17.729048; 0.000000;-0.768652;,
|
||||
-16.233688;-0.289522; 0.521628;,
|
||||
-16.233685; 0.289522; 0.521628;,
|
||||
-17.729050; 0.000000; 0.768652;,
|
||||
-16.233685; 0.289522;-0.521628;,
|
||||
-16.233685;-0.289522;-0.521628;,
|
||||
-17.729048; 0.000000;-0.768652;,
|
||||
-16.233685; 0.242418; 0.242418;,
|
||||
-16.233685; 0.242418;-0.242418;,
|
||||
-16.233685; 0.521628;-0.289522;,
|
||||
-16.233685; 0.521628; 0.289522;,
|
||||
-16.233686;-0.242418;-0.242418;,
|
||||
-16.233685;-0.242418; 0.242418;,
|
||||
-16.233685;-0.521628; 0.289522;,
|
||||
-16.233688;-0.521628;-0.289522;,
|
||||
-16.233685;-0.242418; 0.242418;,
|
||||
-16.233685; 0.242418; 0.242418;,
|
||||
-16.233685; 0.521628; 0.289522;,
|
||||
-16.233685;-0.521628; 0.289522;,
|
||||
-16.233685; 0.242418;-0.242418;,
|
||||
-16.233686;-0.242418;-0.242418;,
|
||||
-16.233688;-0.521628;-0.289522;,
|
||||
-16.233685; 0.521628;-0.289522;,
|
||||
-16.233685;-0.521628; 0.289522;,
|
||||
-16.233685; 0.521628; 0.289522;,
|
||||
-17.729048; 0.768652; 0.000000;,
|
||||
-17.729050;-0.768652;-0.000000;,
|
||||
-16.233685; 0.521628;-0.289522;,
|
||||
-16.233688;-0.521628;-0.289522;,
|
||||
-17.729050;-0.768652;-0.000000;,
|
||||
-17.729048; 0.768652; 0.000000;,
|
||||
-16.233688;-0.521628;-0.289522;,
|
||||
-16.233685;-0.521628; 0.289522;,
|
||||
-17.729050;-0.768652;-0.000000;,
|
||||
-16.233685; 0.521628; 0.289522;,
|
||||
-16.233685; 0.521628;-0.289522;,
|
||||
-17.729048; 0.768652; 0.000000;,
|
||||
1.000000;-0.000000; 0.000000;,
|
||||
-1.000000;-0.314103;-1.000000;,
|
||||
-1.000000; 0.314103;-1.000000;,
|
||||
1.000000;-0.000000; 0.000000;,
|
||||
-1.000000; 0.314103; 1.000000;,
|
||||
-1.000000;-0.314103; 1.000000;,
|
||||
1.000000;-0.000000; 0.000000;,
|
||||
-1.000000;-0.314103; 1.000000;,
|
||||
-1.000000;-0.314103;-1.000000;,
|
||||
1.000000;-0.000000; 0.000000;,
|
||||
-1.000000; 0.314103;-1.000000;,
|
||||
-1.000000; 0.314103; 1.000000;;
|
||||
28;
|
||||
4;3,2,1,0;,
|
||||
4;7,6,5,4;,
|
||||
4;11,10,9,8;,
|
||||
4;15,14,13,12;,
|
||||
4;19,18,17,16;,
|
||||
4;23,22,21,20;,
|
||||
4;27,26,25,24;,
|
||||
4;31,30,29,28;,
|
||||
4;35,34,33,32;,
|
||||
4;39,38,37,36;,
|
||||
4;43,42,41,40;,
|
||||
4;47,46,45,44;,
|
||||
4;51,50,49,48;,
|
||||
4;55,54,53,52;,
|
||||
3;58,57,56;,
|
||||
3;61,60,59;,
|
||||
4;65,64,63,62;,
|
||||
4;69,68,67,66;,
|
||||
4;73,72,71,70;,
|
||||
4;77,76,75,74;,
|
||||
4;81,80,79,78;,
|
||||
4;85,84,83,82;,
|
||||
3;88,87,86;,
|
||||
3;91,90,89;,
|
||||
3;94,93,92;,
|
||||
3;97,96,95;,
|
||||
3;100,99,98;,
|
||||
3;103,102,101;;
|
||||
MeshNormals { // Cube normals
|
||||
28;
|
||||
-1.000000; 0.000001;-0.000000;,
|
||||
-0.000000; 0.000000; 1.000000;,
|
||||
-1.000000; 0.000002;-0.000000;,
|
||||
-1.000000; 0.000000;-0.000000;,
|
||||
-1.000000; 0.000002;-0.000000;,
|
||||
1.000000; 0.000000;-0.000000;,
|
||||
0.000000; 1.000000; 0.000000;,
|
||||
0.000000;-1.000000; 0.000000;,
|
||||
0.000000; 0.000000;-1.000000;,
|
||||
1.000000;-0.000005; 0.000003;,
|
||||
1.000000; 0.000000; 0.000000;,
|
||||
1.000000;-0.000020; 0.000004;,
|
||||
-0.190083; 0.981768;-0.000000;,
|
||||
-0.190083;-0.981768;-0.000000;,
|
||||
0.162984;-0.000001; 0.986629;,
|
||||
0.162984; 0.000000;-0.986629;,
|
||||
1.000000; 0.000000; 0.000000;,
|
||||
1.000000;-0.000003;-0.000005;,
|
||||
1.000000; 0.000000; 0.000000;,
|
||||
1.000000;-0.000004;-0.000020;,
|
||||
-0.190083; 0.000000; 0.981768;,
|
||||
-0.190083; 0.000000;-0.981768;,
|
||||
0.162984;-0.986629;-0.000001;,
|
||||
0.162984; 0.986629; 0.000000;,
|
||||
0.447214;-0.000000;-0.894427;,
|
||||
0.447214;-0.000000; 0.894427;,
|
||||
0.155150;-0.987891; 0.000000;,
|
||||
0.155150; 0.987891; 0.000000;;
|
||||
28;
|
||||
4;0,0,0,0;,
|
||||
4;1,1,1,1;,
|
||||
4;2,2,2,2;,
|
||||
4;3,3,3,3;,
|
||||
4;4,4,4,4;,
|
||||
4;5,5,5,5;,
|
||||
4;6,6,6,6;,
|
||||
4;7,7,7,7;,
|
||||
4;8,8,8,8;,
|
||||
4;9,9,9,9;,
|
||||
4;10,10,10,10;,
|
||||
4;11,11,11,11;,
|
||||
4;12,12,12,12;,
|
||||
4;13,13,13,13;,
|
||||
3;14,14,14;,
|
||||
3;15,15,15;,
|
||||
4;16,16,16,16;,
|
||||
4;17,17,17,17;,
|
||||
4;18,18,18,18;,
|
||||
4;19,19,19,19;,
|
||||
4;20,20,20,20;,
|
||||
4;21,21,21,21;,
|
||||
3;22,22,22;,
|
||||
3;23,23,23;,
|
||||
3;24,24,24;,
|
||||
3;25,25,25;,
|
||||
3;26,26,26;,
|
||||
3;27,27,27;;
|
||||
} // End of Cube normals
|
||||
MeshTextureCoords { // Cube UV coordinates
|
||||
104;
|
||||
0.369363; 0.189428;,
|
||||
0.319790; 0.189428;,
|
||||
0.325447; 0.129647;,
|
||||
0.363706; 0.129647;,
|
||||
1.000000; 0.531250;,
|
||||
1.000000; 0.500000;,
|
||||
0.000000; 0.500000;,
|
||||
0.000000; 0.531250;,
|
||||
0.369363; 0.031606;,
|
||||
0.369363; 0.189428;,
|
||||
0.363706; 0.129647;,
|
||||
0.363706; 0.091387;,
|
||||
0.319790; 0.031606;,
|
||||
0.369363; 0.031606;,
|
||||
0.363706; 0.091387;,
|
||||
0.325447; 0.091387;,
|
||||
0.319790; 0.189428;,
|
||||
0.319790; 0.031606;,
|
||||
0.325447; 0.091387;,
|
||||
0.325447; 0.129647;,
|
||||
0.129567; 0.130972;,
|
||||
0.087434; 0.130972;,
|
||||
0.083340; 0.155236;,
|
||||
0.133660; 0.155236;,
|
||||
1.000000; 0.531250;,
|
||||
1.000000; 0.500000;,
|
||||
0.000000; 0.500000;,
|
||||
0.000000; 0.531250;,
|
||||
1.000000; 0.500000;,
|
||||
1.000000; 0.468750;,
|
||||
0.000000; 0.468750;,
|
||||
0.000000; 0.500000;,
|
||||
1.000000; 0.500000;,
|
||||
1.000000; 0.531250;,
|
||||
0.000000; 0.531250;,
|
||||
0.000000; 0.500000;,
|
||||
0.087434; 0.088839;,
|
||||
0.129567; 0.088839;,
|
||||
0.133660; 0.064576;,
|
||||
0.083340; 0.064576;,
|
||||
0.129567; 0.088839;,
|
||||
0.129567; 0.130972;,
|
||||
0.133660; 0.155236;,
|
||||
0.133660; 0.064576;,
|
||||
0.087434; 0.130972;,
|
||||
0.087434; 0.088839;,
|
||||
0.083340; 0.064576;,
|
||||
0.083340; 0.155236;,
|
||||
0.133660; 0.064576;,
|
||||
0.133660; 0.155236;,
|
||||
0.108500; 0.176703;,
|
||||
0.108500; 0.043109;,
|
||||
0.083340; 0.155236;,
|
||||
0.083340; 0.064576;,
|
||||
0.108500; 0.043109;,
|
||||
0.108500; 0.176703;,
|
||||
0.083340; 0.064576;,
|
||||
0.133660; 0.064576;,
|
||||
0.108500; 0.043109;,
|
||||
0.133660; 0.155236;,
|
||||
0.083340; 0.155236;,
|
||||
0.108500; 0.176703;,
|
||||
0.129567; 0.088839;,
|
||||
0.129567; 0.130972;,
|
||||
0.153830; 0.135065;,
|
||||
0.153830; 0.084746;,
|
||||
0.087434; 0.130972;,
|
||||
0.087434; 0.088839;,
|
||||
0.063170; 0.084746;,
|
||||
0.063170; 0.135065;,
|
||||
0.087434; 0.088839;,
|
||||
0.129567; 0.088839;,
|
||||
0.153830; 0.084746;,
|
||||
0.063170; 0.084746;,
|
||||
0.129567; 0.130972;,
|
||||
0.087434; 0.130972;,
|
||||
0.063170; 0.135065;,
|
||||
0.153830; 0.135065;,
|
||||
0.063170; 0.084746;,
|
||||
0.153830; 0.084746;,
|
||||
0.175297; 0.109906;,
|
||||
0.041704; 0.109906;,
|
||||
0.153830; 0.135065;,
|
||||
0.063170; 0.135065;,
|
||||
0.041704; 0.109906;,
|
||||
0.175297; 0.109906;,
|
||||
0.063170; 0.135065;,
|
||||
0.063170; 0.084746;,
|
||||
0.041704; 0.109906;,
|
||||
0.153830; 0.084746;,
|
||||
0.153830; 0.135065;,
|
||||
0.175297; 0.109906;,
|
||||
0.490842; 0.110144;,
|
||||
0.317628; 0.180029;,
|
||||
0.317709; 0.182778;,
|
||||
0.490842; 0.110144;,
|
||||
0.316335; 0.034761;,
|
||||
0.314880; 0.036135;,
|
||||
0.495482; 0.109968;,
|
||||
0.312500; 0.031250;,
|
||||
0.312500; 0.187500;,
|
||||
0.495482; 0.109968;,
|
||||
0.312500; 0.187500;,
|
||||
0.312500; 0.031250;;
|
||||
} // End of Cube UV coordinates
|
||||
MeshMaterialList { // Cube material list
|
||||
1;
|
||||
28;
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0;;
|
||||
Material Material {
|
||||
0.640000; 0.640000; 0.640000; 1.000000;;
|
||||
96.078431;
|
||||
0.500000; 0.500000; 0.500000;;
|
||||
0.000000; 0.000000; 0.000000;;
|
||||
}
|
||||
} // End of Cube material list
|
||||
} // End of Cube mesh
|
||||
} // End of Cube
|
||||
} // End of Root
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,403 @@
|
|||
xof 0302txt 0064
|
||||
// File created by CINEMA 4D
|
||||
|
||||
template Header {
|
||||
<3D82AB43-62DA-11cf-AB39-0020AF71E433>
|
||||
SWORD major;
|
||||
SWORD minor;
|
||||
DWORD flags;
|
||||
}
|
||||
|
||||
template Vector {
|
||||
<3D82AB5E-62DA-11cf-AB39-0020AF71E433>
|
||||
FLOAT x;
|
||||
FLOAT y;
|
||||
FLOAT z;
|
||||
}
|
||||
|
||||
template Coords2d {
|
||||
<F6F23F44-7686-11cf-8F52-0040333594A3>
|
||||
FLOAT u;
|
||||
FLOAT v;
|
||||
}
|
||||
|
||||
template Matrix4x4 {
|
||||
<F6F23F45-7686-11cf-8F52-0040333594A3>
|
||||
array FLOAT matrix[16];
|
||||
}
|
||||
|
||||
template ColorRGBA {
|
||||
<35FF44E0-6C7C-11cf-8F52-0040333594A3>
|
||||
FLOAT red;
|
||||
FLOAT green;
|
||||
FLOAT blue;
|
||||
FLOAT alpha;
|
||||
}
|
||||
|
||||
template ColorRGB {
|
||||
<D3E16E81-7835-11cf-8F52-0040333594A3>
|
||||
FLOAT red;
|
||||
FLOAT green;
|
||||
FLOAT blue;
|
||||
}
|
||||
|
||||
template IndexedColor {
|
||||
<1630B820-7842-11cf-8F52-0040333594A3>
|
||||
DWORD index;
|
||||
ColorRGBA indexColor;
|
||||
}
|
||||
|
||||
template Boolean {
|
||||
<4885AE61-78E8-11cf-8F52-0040333594A3>
|
||||
SWORD truefalse;
|
||||
}
|
||||
|
||||
template Boolean2d {
|
||||
<4885AE63-78E8-11cf-8F52-0040333594A3>
|
||||
Boolean u;
|
||||
Boolean v;
|
||||
}
|
||||
|
||||
template MaterialWrap {
|
||||
<4885AE60-78E8-11cf-8F52-0040333594A3>
|
||||
Boolean u;
|
||||
Boolean v;
|
||||
}
|
||||
|
||||
template TextureFilename {
|
||||
<A42790E1-7810-11cf-8F52-0040333594A3>
|
||||
STRING filename;
|
||||
}
|
||||
|
||||
template Material {
|
||||
<3D82AB4D-62DA-11cf-AB39-0020AF71E433>
|
||||
ColorRGBA faceColor;
|
||||
FLOAT power;
|
||||
ColorRGB specularColor;
|
||||
ColorRGB emissiveColor;
|
||||
[...]
|
||||
}
|
||||
|
||||
template MeshFace {
|
||||
<3D82AB5F-62DA-11cf-AB39-0020AF71E433>
|
||||
DWORD nFaceVertexIndices;
|
||||
array DWORD faceVertexIndices[nFaceVertexIndices];
|
||||
}
|
||||
|
||||
template MeshFaceWraps {
|
||||
<4885AE62-78E8-11cf-8F52-0040333594A3>
|
||||
DWORD nFaceWrapValues;
|
||||
Boolean2d faceWrapValues;
|
||||
}
|
||||
|
||||
template MeshTextureCoords {
|
||||
<F6F23F40-7686-11cf-8F52-0040333594A3>
|
||||
DWORD nTextureCoords;
|
||||
array Coords2d textureCoords[nTextureCoords];
|
||||
}
|
||||
|
||||
template MeshMaterialList {
|
||||
<F6F23F42-7686-11cf-8F52-0040333594A3>
|
||||
DWORD nMaterials;
|
||||
DWORD nFaceIndexes;
|
||||
array DWORD faceIndexes[nFaceIndexes];
|
||||
[Material]
|
||||
}
|
||||
|
||||
template MeshNormals {
|
||||
<F6F23F43-7686-11cf-8F52-0040333594A3>
|
||||
DWORD nNormals;
|
||||
array Vector normals[nNormals];
|
||||
DWORD nFaceNormals;
|
||||
array MeshFace faceNormals[nFaceNormals];
|
||||
}
|
||||
|
||||
template MeshVertexColors {
|
||||
<1630B821-7842-11cf-8F52-0040333594A3>
|
||||
DWORD nVertexColors;
|
||||
array IndexedColor vertexColors[nVertexColors];
|
||||
}
|
||||
|
||||
template Mesh {
|
||||
<3D82AB44-62DA-11cf-AB39-0020AF71E433>
|
||||
DWORD nVertices;
|
||||
array Vector vertices[nVertices];
|
||||
DWORD nFaces;
|
||||
array MeshFace faces[nFaces];
|
||||
[...]
|
||||
}
|
||||
|
||||
template FrameTransformMatrix {
|
||||
<F6F23F41-7686-11cf-8F52-0040333594A3>
|
||||
Matrix4x4 frameMatrix;
|
||||
}
|
||||
|
||||
template Frame {
|
||||
<3D82AB46-62DA-11cf-AB39-0020AF71E433>
|
||||
[...]
|
||||
}
|
||||
|
||||
Header {
|
||||
1;
|
||||
0;
|
||||
1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Mesh CINEMA4D_Mesh {
|
||||
40;
|
||||
// Boat
|
||||
-4.57;1.138;5.672;,
|
||||
-4.57;4.55;5.672;,
|
||||
-5.707;1.138;5.668;,
|
||||
-5.707;4.55;5.668;,
|
||||
-5.668;1.138;-5.707;,
|
||||
-5.668;4.55;-5.707;,
|
||||
-4.53;1.138;-5.703;,
|
||||
-4.53;4.55;-5.703;,
|
||||
4.57;1.138;-5.672;,
|
||||
4.57;4.55;-5.672;,
|
||||
5.707;1.138;-5.668;,
|
||||
5.707;4.55;-5.668;,
|
||||
5.668;1.138;5.707;,
|
||||
5.668;4.55;5.707;,
|
||||
4.53;1.138;5.703;,
|
||||
4.53;4.55;5.703;,
|
||||
5.668;1.138;5.707;,
|
||||
5.668;4.55;5.707;,
|
||||
5.664;1.138;6.845;,
|
||||
5.664;4.55;6.845;,
|
||||
-5.711;1.138;6.805;,
|
||||
-5.711;4.55;6.805;,
|
||||
-5.707;1.138;5.668;,
|
||||
-5.707;4.55;5.668;,
|
||||
-5.668;1.138;-5.707;,
|
||||
-5.668;4.55;-5.707;,
|
||||
-5.664;1.138;-6.845;,
|
||||
-5.664;4.55;-6.845;,
|
||||
5.711;1.138;-6.805;,
|
||||
5.711;4.55;-6.805;,
|
||||
5.707;1.138;-5.668;,
|
||||
5.707;4.55;-5.668;,
|
||||
-4.574;-1.138;6.809;,
|
||||
-4.574;1.138;6.809;,
|
||||
-4.526;-1.138;-6.841;,
|
||||
-4.526;1.138;-6.841;,
|
||||
4.574;-1.138;-6.809;,
|
||||
4.574;1.138;-6.809;,
|
||||
4.526;-1.138;6.841;,
|
||||
4.526;1.138;6.841;;
|
||||
|
||||
30;
|
||||
// Boat
|
||||
4;0,1,3,2;,
|
||||
4;2,3,5,4;,
|
||||
4;4,5,7,6;,
|
||||
4;6,7,1,0;,
|
||||
4;1,7,5,3;,
|
||||
4;6,0,2,4;,
|
||||
4;8,9,11,10;,
|
||||
4;10,11,13,12;,
|
||||
4;12,13,15,14;,
|
||||
4;14,15,9,8;,
|
||||
4;9,15,13,11;,
|
||||
4;14,8,10,12;,
|
||||
4;16,17,19,18;,
|
||||
4;18,19,21,20;,
|
||||
4;20,21,23,22;,
|
||||
4;22,23,17,16;,
|
||||
4;17,23,21,19;,
|
||||
4;22,16,18,20;,
|
||||
4;24,25,27,26;,
|
||||
4;26,27,29,28;,
|
||||
4;28,29,31,30;,
|
||||
4;30,31,25,24;,
|
||||
4;25,31,29,27;,
|
||||
4;30,24,26,28;,
|
||||
4;32,33,35,34;,
|
||||
4;34,35,37,36;,
|
||||
4;36,37,39,38;,
|
||||
4;38,39,33,32;,
|
||||
4;33,39,37,35;,
|
||||
4;38,32,34,36;;
|
||||
|
||||
MeshNormals {
|
||||
40;
|
||||
// Boat
|
||||
0.035;-0.108;0.361;,
|
||||
0.035;0.108;0.361;,
|
||||
-0.037;-0.108;0.361;,
|
||||
-0.037;0.108;0.361;,
|
||||
-0.035;-0.108;-0.361;,
|
||||
-0.035;0.108;-0.361;,
|
||||
0.037;-0.108;-0.361;,
|
||||
0.037;0.108;-0.361;,
|
||||
-0.035;-0.108;-0.361;,
|
||||
-0.035;0.108;-0.361;,
|
||||
0.037;-0.108;-0.361;,
|
||||
0.037;0.108;-0.361;,
|
||||
0.035;-0.108;0.361;,
|
||||
0.035;0.108;0.361;,
|
||||
-0.037;-0.108;0.361;,
|
||||
-0.037;0.108;0.361;,
|
||||
0.003;-0.002;-0.625;,
|
||||
0.003;0.002;-0.625;,
|
||||
-0.002;-0.002;0.625;,
|
||||
-0.002;0.002;0.625;,
|
||||
-0.003;-0.002;0.625;,
|
||||
-0.003;0.002;0.625;,
|
||||
0.002;-0.002;-0.625;,
|
||||
0.002;0.002;-0.625;,
|
||||
-0.003;-0.002;0.625;,
|
||||
-0.003;0.002;0.625;,
|
||||
0.002;-0.002;-0.625;,
|
||||
0.002;0.002;-0.625;,
|
||||
0.003;-0.002;-0.625;,
|
||||
0.003;0.002;-0.625;,
|
||||
-0.002;-0.002;0.625;,
|
||||
-0.002;0.002;0.625;,
|
||||
-0.011;-0.028;0.611;,
|
||||
-0.011;0.028;0.611;,
|
||||
-0.007;-0.028;-0.611;,
|
||||
-0.007;0.028;-0.611;,
|
||||
0.011;-0.028;-0.611;,
|
||||
0.011;0.028;-0.611;,
|
||||
0.007;-0.028;0.611;,
|
||||
0.007;0.028;0.611;;
|
||||
|
||||
30;
|
||||
// Boat
|
||||
4;0,1,3,2;,
|
||||
4;2,3,5,4;,
|
||||
4;4,5,7,6;,
|
||||
4;6,7,1,0;,
|
||||
4;1,7,5,3;,
|
||||
4;6,0,2,4;,
|
||||
4;8,9,11,10;,
|
||||
4;10,11,13,12;,
|
||||
4;12,13,15,14;,
|
||||
4;14,15,9,8;,
|
||||
4;9,15,13,11;,
|
||||
4;14,8,10,12;,
|
||||
4;16,17,19,18;,
|
||||
4;18,19,21,20;,
|
||||
4;20,21,23,22;,
|
||||
4;22,23,17,16;,
|
||||
4;17,23,21,19;,
|
||||
4;22,16,18,20;,
|
||||
4;24,25,27,26;,
|
||||
4;26,27,29,28;,
|
||||
4;28,29,31,30;,
|
||||
4;30,31,25,24;,
|
||||
4;25,31,29,27;,
|
||||
4;30,24,26,28;,
|
||||
4;32,33,35,34;,
|
||||
4;34,35,37,36;,
|
||||
4;36,37,39,38;,
|
||||
4;38,39,33,32;,
|
||||
4;33,39,37,35;,
|
||||
4;38,32,34,36;;
|
||||
|
||||
}
|
||||
MeshTextureCoords {
|
||||
40;
|
||||
// Boat
|
||||
0.375;0.25;,
|
||||
0.688;0.25;,
|
||||
0.375;0.062;,
|
||||
0.688;0.062;,
|
||||
0.688;0.062;,
|
||||
0.375;0.062;,
|
||||
0.688;0.25;,
|
||||
0.375;0.25;,
|
||||
0.375;0.25;,
|
||||
0.688;0.25;,
|
||||
0.375;0.062;,
|
||||
0.688;0.062;,
|
||||
0.688;0.062;,
|
||||
0.375;0.062;,
|
||||
0.688;0.25;,
|
||||
0.375;0.25;,
|
||||
0.375;0.25;,
|
||||
0.688;0.25;,
|
||||
0.375;0.062;,
|
||||
0.688;0.062;,
|
||||
0.688;0.062;,
|
||||
0.375;0.062;,
|
||||
0.688;0.25;,
|
||||
0.375;0.25;,
|
||||
0.375;0.25;,
|
||||
0.688;0.25;,
|
||||
0.375;0.062;,
|
||||
0.688;0.062;,
|
||||
0.688;0.062;,
|
||||
0.375;0.062;,
|
||||
0.688;0.25;,
|
||||
0.375;0.25;,
|
||||
0.688;0.25;,
|
||||
0.375;0.25;,
|
||||
0.375;0.25;,
|
||||
0.688;0.25;,
|
||||
0.375;0.062;,
|
||||
0.688;0.062;,
|
||||
0.688;0.062;,
|
||||
0.375;0.062;;
|
||||
}
|
||||
MeshMaterialList {
|
||||
3;
|
||||
30;
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1;
|
||||
|
||||
Material C4DMAT_NONE {
|
||||
1.0;1.0;1.0;1.0;;
|
||||
1.0;
|
||||
0.0;0.0;0.0;;
|
||||
0.0;0.0;0.0;;
|
||||
}
|
||||
Material C4DMAT_boat_png {
|
||||
1.0;1.0;1.0;1.0;;
|
||||
1.0;
|
||||
0.0;0.0;0.0;;
|
||||
0.0;0.0;0.0;;
|
||||
}
|
||||
|
||||
Material C4DMAT_Mat_riau_Ciel {
|
||||
1.0;1.0;1.0;1.0;;
|
||||
1.0;
|
||||
0.2;0.2;0.2;;
|
||||
0.0;0.0;0.0;;
|
||||
}
|
||||
|
||||
{C4DMAT_boat_png}
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue