mods that hopefully work for a TechAge-based pack
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
unused_args = false
|
||||
allow_defined_top = false
|
||||
|
||||
globals = {
|
||||
"yl_canned_food_mtg"
|
||||
}
|
||||
|
||||
read_globals = {
|
||||
string = {fields = {"split"}},
|
||||
table = {fields = {"copy", "getn"}},
|
||||
|
||||
-- Core
|
||||
"minetest",
|
||||
"core",
|
||||
|
||||
-- Builtin
|
||||
"vector", "ItemStack",
|
||||
"dump", "DIR_DELIM", "VoxelArea", "Settings",
|
||||
|
||||
-- MTG
|
||||
"default", "sfinv", "creative",
|
||||
|
||||
-- dependency
|
||||
"yl_canned_food", "unified_inventory"
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
Creative Commons Legal Code
|
||||
|
||||
CC0 1.0 Universal
|
||||
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||
HEREUNDER.
|
||||
|
||||
Statement of Purpose
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer
|
||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||
authorship and/or a database (each, a "Work").
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for
|
||||
the purpose of contributing to a commons of creative, cultural and
|
||||
scientific works ("Commons") that the public can reliably and without fear
|
||||
of later claims of infringement build upon, modify, incorporate in other
|
||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||
and for any purposes, including without limitation commercial purposes.
|
||||
These owners may contribute to the Commons to promote the ideal of a free
|
||||
culture and the further production of creative, cultural and scientific
|
||||
works, or to gain reputation or greater distribution for their Work in
|
||||
part through the use and efforts of others.
|
||||
|
||||
For these and/or other purposes and motivations, and without any
|
||||
expectation of additional consideration or compensation, the person
|
||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||
|
||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||
protected by copyright and related or neighboring rights ("Copyright and
|
||||
Related Rights"). Copyright and Related Rights include, but are not
|
||||
limited to, the following:
|
||||
|
||||
i. the right to reproduce, adapt, distribute, perform, display,
|
||||
communicate, and translate a Work;
|
||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||
iii. publicity and privacy rights pertaining to a person's image or
|
||||
likeness depicted in a Work;
|
||||
iv. rights protecting against unfair competition in regards to a Work,
|
||||
subject to the limitations in paragraph 4(a), below;
|
||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||
in a Work;
|
||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||
European Parliament and of the Council of 11 March 1996 on the legal
|
||||
protection of databases, and under any national implementation
|
||||
thereof, including any amended or successor version of such
|
||||
directive); and
|
||||
vii. other similar, equivalent or corresponding rights throughout the
|
||||
world based on applicable law or treaty, and any national
|
||||
implementations thereof.
|
||||
|
||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||
of action, whether now known or unknown (including existing as well as
|
||||
future claims and causes of action), in the Work (i) in all territories
|
||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||
treaty (including future time extensions), (iii) in any current or future
|
||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||
including without limitation commercial, advertising or promotional
|
||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||
member of the public at large and to the detriment of Affirmer's heirs and
|
||||
successors, fully intending that such Waiver shall not be subject to
|
||||
revocation, rescission, cancellation, termination, or any other legal or
|
||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||
as contemplated by Affirmer's express Statement of Purpose.
|
||||
|
||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||
be judged legally invalid or ineffective under applicable law, then the
|
||||
Waiver shall be preserved to the maximum extent permitted taking into
|
||||
account Affirmer's express Statement of Purpose. In addition, to the
|
||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||
maximum duration provided by applicable law or treaty (including future
|
||||
time extensions), (iii) in any current or future medium and for any number
|
||||
of copies, and (iv) for any purpose whatsoever, including without
|
||||
limitation commercial, advertising or promotional purposes (the
|
||||
"License"). The License shall be deemed effective as of the date CC0 was
|
||||
applied by Affirmer to the Work. Should any part of the License for any
|
||||
reason be judged legally invalid or ineffective under applicable law, such
|
||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||
of the License, and in such case Affirmer hereby affirms that he or she
|
||||
will not (i) exercise any of his or her remaining Copyright and Related
|
||||
Rights in the Work or (ii) assert any associated claims and causes of
|
||||
action with respect to the Work, in either case contrary to Affirmer's
|
||||
express Statement of Purpose.
|
||||
|
||||
4. Limitations and Disclaimers.
|
||||
|
||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||
surrendered, licensed or otherwise affected by this document.
|
||||
b. Affirmer offers the Work as-is and makes no representations or
|
||||
warranties of any kind concerning the Work, express, implied,
|
||||
statutory or otherwise, including without limitation warranties of
|
||||
title, merchantability, fitness for a particular purpose, non
|
||||
infringement, or the absence of latent or other defects, accuracy, or
|
||||
the present or absence of errors, whether or not discoverable, all to
|
||||
the greatest extent permissible under applicable law.
|
||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||
that may apply to the Work or any use thereof, including without
|
||||
limitation any person's Copyright and Related Rights in the Work.
|
||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||
consents, permissions or other rights required for any use of the
|
||||
Work.
|
||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||
party to this document and has no duty or obligation with respect to
|
||||
this CC0 or use of the Work.
|
||||
@@ -0,0 +1,7 @@
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
# License
|
||||
|
||||
Copyright (c) 2024 AliasAlreadyTaken, Styxcolor
|
||||
|
||||
Code:
|
||||
|
||||
* [MIT](https://gitea.your-land.de/your-land/yl_canned_food_mtg/src/LICENSE-MIT) AliasAlreadyTaken
|
||||
|
||||
Media:
|
||||
|
||||
* screenshot.png [CC0](https://gitea.your-land.de/your-land/yl_canned_food_mtg/src/LICENSE-CC0) Styxcolor
|
||||
* yl_canned_food_mtg_unified_inventory_craft.png [CC0](https://gitea.your-land.de/your-land/yl_canned_food_mtg/src/LICENSE-CC0) Styxcolor
|
||||
@@ -0,0 +1,95 @@
|
||||
|
||||
# yl_canned_food_mtg
|
||||
|
||||
## Purpose
|
||||
|
||||
This mod brings crafting recipes, nutritional values and unified inventory integration for yl_canned_food
|
||||
|
||||
## Download
|
||||
|
||||
Get it from https://gitea.your-land.de/your-land/yl_canned_food_mtg
|
||||
|
||||
## Dependencies
|
||||
|
||||
See [mod.conf](https://gitea.your-land.de/your-land/yl_canned_food_mtg/src/branch/master/mod.conf)
|
||||
|
||||
* [yl_canned_food](https://gitea.your-land.de/your-land/yl_canned_food)
|
||||
|
||||
## Installation
|
||||
|
||||
1. Copy the "yl_canned_food_mtg" folder to your mod directory.
|
||||
2. Make sure the [dependencies](https://gitea.your-land.de/your-land/yl_canned_food_mtg#dependencies) are satisfied, if any.
|
||||
3. Enable the mod in your world.mt file.
|
||||
|
||||
## Configuration
|
||||
|
||||
```
|
||||
yl_canned_food_mtg.debug = false
|
||||
```
|
||||
Set to true to enable debug mode
|
||||
|
||||
```
|
||||
yl_canned_food_mtg.enable_recipes = true
|
||||
```
|
||||
Set this to true if you want to enable recipes. Set this to false if you create recipes of your own in a different mod.
|
||||
|
||||
```
|
||||
yl_canned_food_mtg.enable_eat = true
|
||||
```
|
||||
Set this to true if you want to enable eating. Set this to false if you create item_eat integration of your own in a different mod.
|
||||
|
||||
```
|
||||
yl_canned_food_mtg.enable_unified_inventory = true
|
||||
```
|
||||
Set this to true if you want to enable unified_inventory integration
|
||||
|
||||
```
|
||||
yl_canned_food_mtg.data_source = "default"
|
||||
```
|
||||
Set this to where the data shall be loaded from. Use "default" for a new world, "legacy" for a world where this mod replaces canned_food and "json" where you decide the data for yourself. Here is an example json: [yl_canned_food_mtg.json](https://gitea.your-land.de/your-land/yl_canned_food_mtg/src/branch/master/dev/yl_canned_food_mtg.json)
|
||||
|
||||
```
|
||||
yl_canned_food_mtg.save_path
|
||||
```
|
||||
Set this to where in the worldfolder you want the JSON files stored.
|
||||
|
||||
## Usage
|
||||
|
||||
This mod can be used in singleplayer and multiplayer. It adds crafting recipes, nutritional values and unified inventory integration for minetest_game. If your game is a different one, use their canned_food integration instead.
|
||||
|
||||
## Limitations
|
||||
|
||||
* No integrations for other games than those which are based on [minetest_game](https://github.com/minetest/minetest_game)
|
||||
|
||||
## Alternatives
|
||||
|
||||
* [canned_food](https://github.com/h-v-smacker/canned_food)
|
||||
|
||||
## Supported versions
|
||||
|
||||
If you use yl_canned_food_mtg, but something is wrong, please [file a bug](https://gitea.your-land.de/your-land/yl_canned_food_mtg/issues/new). PRs also welcome.
|
||||
|
||||
There is no reason to believe it doesn't work anywhere, but you never know.
|
||||
|
||||
## Allied projects
|
||||
|
||||
If you know a project that uses this mod tell us and we will add it to the list.
|
||||
|
||||
## Uninstall
|
||||
|
||||
Remove it from your mod folder or deactivate it in your world.mt
|
||||
|
||||
Mods that depend on it will cease to work, if the mod is removed without proper replacement.
|
||||
|
||||
## License
|
||||
|
||||
See [LICENSE.md](https://gitea.your-land.de/your-land/yl_canned_food_mtg/src/LICENSE.md)
|
||||
|
||||
* Code MIT AliasAlreadyTaken
|
||||
* Textures CC0 Styxcolor
|
||||
* Screenshot CC0 Styxcolor
|
||||
|
||||
## Thank you
|
||||
|
||||
* Styxcolor
|
||||
* tour
|
||||
@@ -0,0 +1,20 @@
|
||||
-- Setting a configuration, switch the order in which the settings shall take precedence. First valid one taken.
|
||||
yl_canned_food_mtg.settings = {}
|
||||
|
||||
yl_canned_food_mtg.settings.debug = minetest.settings:get_bool(
|
||||
"yl_canned_food_mtg.debug", false)
|
||||
|
||||
yl_canned_food_mtg.settings.enable_recipes =
|
||||
minetest.settings:get_bool("yl_canned_food_mtg.enable_recipes", true)
|
||||
|
||||
yl_canned_food_mtg.settings.enable_eat =
|
||||
minetest.settings:get_bool("yl_canned_food_mtg.enable_eat", true)
|
||||
|
||||
yl_canned_food_mtg.settings.enable_unified_inventory =
|
||||
minetest.settings:get_bool("yl_canned_food_mtg.enable_unified_inventory",
|
||||
true)
|
||||
|
||||
yl_canned_food_mtg.settings.data_source =
|
||||
minetest.settings:get("yl_canned_food_mtg.data_source") or "default"
|
||||
|
||||
yl_canned_food_mtg.settings.save_path = minetest.settings:get("yl_scheduler.yl_canned_food_mtg") or "yl_canned_food_mtg"
|
||||
@@ -0,0 +1,3 @@
|
||||
dofile(yl_canned_food_mtg.modpath .. "data_legacy.lua")
|
||||
dofile(yl_canned_food_mtg.modpath .. "data_recipes.lua")
|
||||
dofile(yl_canned_food_mtg.modpath .. "data_json.lua")
|
||||
@@ -0,0 +1,6 @@
|
||||
if (yl_canned_food_mtg.settings.data_source ~= "json") then
|
||||
return false
|
||||
end
|
||||
|
||||
-- filled by initialize
|
||||
yl_canned_food_mtg.json_recipes = {}
|
||||
@@ -0,0 +1,231 @@
|
||||
if (yl_canned_food_mtg.settings.data_source ~= "legacy") then
|
||||
return false
|
||||
end
|
||||
|
||||
yl_canned_food_mtg.legacy_recipes = {
|
||||
{
|
||||
additives = {},
|
||||
nutrition = 6,
|
||||
out = "canned_food:canned_mushrooms",
|
||||
base_mod = "flowers",
|
||||
base_item = "mushroom_brown",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 20,
|
||||
out = "canned_food:honey_jar",
|
||||
base_mod = "mobs",
|
||||
base_item = "honey",
|
||||
base_amount = 4
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 6,
|
||||
out = "canned_food:canned_potato",
|
||||
base_mod = "farming",
|
||||
base_item = "potato",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 6,
|
||||
out = "canned_food:canned_beetroot",
|
||||
base_mod = "farming",
|
||||
base_item = "beetroot",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 6,
|
||||
out = "canned_food:canned_pineapple",
|
||||
base_mod = "farming",
|
||||
base_item = "pineapple_ring",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 15,
|
||||
out = "canned_food:canned_cucumber",
|
||||
base_mod = "farming",
|
||||
base_item = "cucumber",
|
||||
base_amount = 3
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 10,
|
||||
out = "canned_food:pine_nuts_jar",
|
||||
base_mod = "ethereal",
|
||||
base_item = "pine_nuts",
|
||||
base_amount = 8
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 5,
|
||||
out = "canned_food:canned_onion",
|
||||
base_mod = "farming",
|
||||
base_item = "onion",
|
||||
base_amount = 4
|
||||
}, {
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 7,
|
||||
out = "canned_food:strawberry_jam",
|
||||
base_mod = "ethereal",
|
||||
base_item = "strawberry",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 15,
|
||||
out = "canned_food:canned_tomato",
|
||||
base_mod = "farming",
|
||||
base_item = "tomato",
|
||||
base_amount = 3
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 5,
|
||||
out = "canned_food:canned_garlic_cloves",
|
||||
base_mod = "farming",
|
||||
base_item = "garlic_clove",
|
||||
base_amount = 8
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 8,
|
||||
out = "canned_food:blueberry_jam",
|
||||
base_mod = "default",
|
||||
base_item = "blueberries",
|
||||
base_amount = 7
|
||||
},{
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 8,
|
||||
out = "canned_food:blueberry_jam",
|
||||
base_mod = "farming",
|
||||
base_item = "blueberries",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 7,
|
||||
out = "canned_food:canned_pumpkin",
|
||||
base_mod = "farming",
|
||||
base_item = "pumpkin_slice",
|
||||
base_amount = 3
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 11,
|
||||
out = "canned_food:canned_corn",
|
||||
base_mod = "farming",
|
||||
base_item = "corn",
|
||||
base_amount = 3
|
||||
}, {
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 8,
|
||||
out = "canned_food:blackberry_jam",
|
||||
base_mod = "farming",
|
||||
base_item = "blackberry",
|
||||
base_amount = 6
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 10,
|
||||
out = "canned_food:canned_peas",
|
||||
base_mod = "farming",
|
||||
base_item = "peas",
|
||||
base_amount = 8
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 7,
|
||||
out = "canned_food:canned_beans",
|
||||
base_mod = "farming",
|
||||
base_item = "beans",
|
||||
base_amount = 6
|
||||
}, {
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 8,
|
||||
out = "canned_food:raspberry_jam",
|
||||
base_mod = "farming",
|
||||
base_item = "raspberries",
|
||||
base_amount = 6
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 7,
|
||||
out = "canned_food:apple_jam",
|
||||
base_mod = "default",
|
||||
base_item = "apple",
|
||||
base_amount = 3
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 7,
|
||||
out = "canned_food:canned_chili_pepper",
|
||||
base_mod = "farming",
|
||||
base_item = "chili_pepper",
|
||||
base_amount = 6
|
||||
}, {
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 11,
|
||||
out = "canned_food:grape_jam",
|
||||
base_mod = "farming",
|
||||
base_item = "grapes",
|
||||
base_amount = 4
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 6,
|
||||
out = "canned_food:canned_coconut",
|
||||
base_mod = "ethereal",
|
||||
base_item = "coconut_slice",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 15,
|
||||
out = "canned_food:canned_carrot",
|
||||
base_mod = "farming",
|
||||
base_item = "carrot",
|
||||
base_amount = 3
|
||||
}, {
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 8,
|
||||
out = "canned_food:rhubarb_jam",
|
||||
base_mod = "farming",
|
||||
base_item = "rhubarb",
|
||||
base_amount = 6
|
||||
}, {
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 7,
|
||||
out = "canned_food:banana_jam",
|
||||
base_mod = "ethereal",
|
||||
base_item = "banana",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 6,
|
||||
out = "canned_food:dandelion_jam",
|
||||
base_mod = "flowers",
|
||||
base_item = "dandelion_yellow",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 8,
|
||||
out = "canned_food:melon_jam",
|
||||
base_mod = "farming",
|
||||
base_item = "melon_slice",
|
||||
base_amount = 3
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 6,
|
||||
out = "canned_food:rose_jam",
|
||||
base_mod = "flowers",
|
||||
base_item = "rose",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 8,
|
||||
out = "canned_food:orange_jam",
|
||||
base_mod = "ethereal",
|
||||
base_item = "orange",
|
||||
base_amount = 3
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 6,
|
||||
out = "canned_food:canned_cabbage",
|
||||
base_mod = "farming",
|
||||
base_item = "cabbage",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 6,
|
||||
out = "canned_food:lemon_jam",
|
||||
base_mod = "ethereal",
|
||||
base_item = "lemon",
|
||||
base_amount = 6
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
if (yl_canned_food_mtg.settings.data_source ~= "default") then
|
||||
return false
|
||||
end
|
||||
|
||||
yl_canned_food_mtg.default_recipes = {
|
||||
{
|
||||
additives = {},
|
||||
nutrition = 6,
|
||||
out = "yl_canned_food:canned_mushrooms",
|
||||
base_mod = "flowers",
|
||||
base_item = "mushroom_brown",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 20,
|
||||
out = "yl_canned_food:honey_jar",
|
||||
base_mod = "mobs",
|
||||
base_item = "honey",
|
||||
base_amount = 4
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 6,
|
||||
out = "yl_canned_food:canned_potato",
|
||||
base_mod = "farming",
|
||||
base_item = "potato",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 6,
|
||||
out = "yl_canned_food:canned_beetroot",
|
||||
base_mod = "farming",
|
||||
base_item = "beetroot",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 6,
|
||||
out = "yl_canned_food:canned_pineapple",
|
||||
base_mod = "farming",
|
||||
base_item = "pineapple_ring",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 15,
|
||||
out = "yl_canned_food:canned_cucumber",
|
||||
base_mod = "farming",
|
||||
base_item = "cucumber",
|
||||
base_amount = 3
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 10,
|
||||
out = "yl_canned_food:pine_nuts_jar",
|
||||
base_mod = "ethereal",
|
||||
base_item = "pine_nuts",
|
||||
base_amount = 8
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 5,
|
||||
out = "yl_canned_food:canned_onion",
|
||||
base_mod = "farming",
|
||||
base_item = "onion",
|
||||
base_amount = 4
|
||||
}, {
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 7,
|
||||
out = "yl_canned_food:strawberry_jam",
|
||||
base_mod = "ethereal",
|
||||
base_item = "strawberry",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 15,
|
||||
out = "yl_canned_food:canned_tomato",
|
||||
base_mod = "farming",
|
||||
base_item = "tomato",
|
||||
base_amount = 3
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 5,
|
||||
out = "yl_canned_food:canned_garlic_cloves",
|
||||
base_mod = "farming",
|
||||
base_item = "garlic_clove",
|
||||
base_amount = 8
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 8,
|
||||
out = "yl_canned_food:blueberry_jam",
|
||||
base_mod = "default",
|
||||
base_item = "blueberries",
|
||||
base_amount = 7
|
||||
},{
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 8,
|
||||
out = "yl_canned_food:blueberry_jam",
|
||||
base_mod = "farming",
|
||||
base_item = "blueberries",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 7,
|
||||
out = "yl_canned_food:canned_pumpkin",
|
||||
base_mod = "farming",
|
||||
base_item = "pumpkin_slice",
|
||||
base_amount = 3
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 11,
|
||||
out = "yl_canned_food:canned_corn",
|
||||
base_mod = "farming",
|
||||
base_item = "corn",
|
||||
base_amount = 3
|
||||
}, {
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 8,
|
||||
out = "yl_canned_food:blackberry_jam",
|
||||
base_mod = "farming",
|
||||
base_item = "blackberry",
|
||||
base_amount = 6
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 10,
|
||||
out = "yl_canned_food:canned_peas",
|
||||
base_mod = "farming",
|
||||
base_item = "peas",
|
||||
base_amount = 8
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 7,
|
||||
out = "yl_canned_food:canned_beans",
|
||||
base_mod = "farming",
|
||||
base_item = "beans",
|
||||
base_amount = 6
|
||||
}, {
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 8,
|
||||
out = "yl_canned_food:raspberry_jam",
|
||||
base_mod = "farming",
|
||||
base_item = "raspberries",
|
||||
base_amount = 6
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 7,
|
||||
out = "yl_canned_food:apple_jam",
|
||||
base_mod = "default",
|
||||
base_item = "apple",
|
||||
base_amount = 3
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 7,
|
||||
out = "yl_canned_food:canned_chili_pepper",
|
||||
base_mod = "farming",
|
||||
base_item = "chili_pepper",
|
||||
base_amount = 6
|
||||
}, {
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 11,
|
||||
out = "yl_canned_food:grape_jam",
|
||||
base_mod = "farming",
|
||||
base_item = "grapes",
|
||||
base_amount = 4
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 6,
|
||||
out = "yl_canned_food:canned_coconut",
|
||||
base_mod = "ethereal",
|
||||
base_item = "coconut_slice",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 15,
|
||||
out = "yl_canned_food:canned_carrot",
|
||||
base_mod = "farming",
|
||||
base_item = "carrot",
|
||||
base_amount = 3
|
||||
}, {
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 8,
|
||||
out = "yl_canned_food:rhubarb_jam",
|
||||
base_mod = "farming",
|
||||
base_item = "rhubarb",
|
||||
base_amount = 6
|
||||
}, {
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 7,
|
||||
out = "yl_canned_food:banana_jam",
|
||||
base_mod = "ethereal",
|
||||
base_item = "banana",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 6,
|
||||
out = "yl_canned_food:dandelion_jam",
|
||||
base_mod = "flowers",
|
||||
base_item = "dandelion_yellow",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 8,
|
||||
out = "yl_canned_food:melon_jam",
|
||||
base_mod = "farming",
|
||||
base_item = "melon_slice",
|
||||
base_amount = 3
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 6,
|
||||
out = "yl_canned_food:rose_jam",
|
||||
base_mod = "flowers",
|
||||
base_item = "rose",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 8,
|
||||
out = "yl_canned_food:orange_jam",
|
||||
base_mod = "ethereal",
|
||||
base_item = "orange",
|
||||
base_amount = 3
|
||||
}, {
|
||||
additives = {},
|
||||
nutrition = 6,
|
||||
out = "yl_canned_food:canned_cabbage",
|
||||
base_mod = "farming",
|
||||
base_item = "cabbage",
|
||||
base_amount = 5
|
||||
}, {
|
||||
additives = {"group:food_sugar"},
|
||||
nutrition = 6,
|
||||
out = "yl_canned_food:lemon_jam",
|
||||
base_mod = "ethereal",
|
||||
base_item = "lemon",
|
||||
base_amount = 6
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
This file holds a couple of editors notes regarding the mod.
|
||||
|
||||
Todo's can be noted here, known issues, the path to ressources or general annotations.
|
||||
|
||||
How to generate the JSON file from yl_canned_food_mtg.default_recipes:
|
||||
|
||||
local content = minetest.write_json(yl_canned_food_mtg.default_recipes)
|
||||
minetest.safe_file_write(yl_canned_food_mtg.worldpath .. "yl_canned_food_mtg.json", content)
|
||||
@@ -0,0 +1,278 @@
|
||||
[
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 5.0,
|
||||
"base_item": "mushroom_brown",
|
||||
"base_mod": "flowers",
|
||||
"nutrition": 6.0,
|
||||
"out": "yl_canned_food:canned_mushrooms"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 4.0,
|
||||
"base_item": "honey",
|
||||
"base_mod": "mobs",
|
||||
"nutrition": 20.0,
|
||||
"out": "yl_canned_food:honey_jar"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 5.0,
|
||||
"base_item": "potato",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 6.0,
|
||||
"out": "yl_canned_food:canned_potato"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 5.0,
|
||||
"base_item": "beetroot",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 6.0,
|
||||
"out": "yl_canned_food:canned_beetroot"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 5.0,
|
||||
"base_item": "pineapple_ring",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 6.0,
|
||||
"out": "yl_canned_food:canned_pineapple"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 3.0,
|
||||
"base_item": "cucumber",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 15.0,
|
||||
"out": "yl_canned_food:canned_cucumber"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 8.0,
|
||||
"base_item": "pine_nuts",
|
||||
"base_mod": "ethereal",
|
||||
"nutrition": 10.0,
|
||||
"out": "yl_canned_food:pine_nuts_jar"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 4.0,
|
||||
"base_item": "onion",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 5.0,
|
||||
"out": "yl_canned_food:canned_onion"
|
||||
},
|
||||
{
|
||||
"additives": [
|
||||
"group:food_sugar"
|
||||
],
|
||||
"base_amount": 5.0,
|
||||
"base_item": "strawberry",
|
||||
"base_mod": "ethereal",
|
||||
"nutrition": 7.0,
|
||||
"out": "yl_canned_food:strawberry_jam"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 3.0,
|
||||
"base_item": "tomato",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 15.0,
|
||||
"out": "yl_canned_food:canned_tomato"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 8.0,
|
||||
"base_item": "garlic_clove",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 5.0,
|
||||
"out": "yl_canned_food:canned_garlic_cloves"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 6.0,
|
||||
"base_item": "blueberries",
|
||||
"base_mod": "default",
|
||||
"nutrition": 8.0,
|
||||
"out": "yl_canned_food:blueberry_jam"
|
||||
},
|
||||
{
|
||||
"additives": [
|
||||
"group:food_sugar"
|
||||
],
|
||||
"base_amount": 6.0,
|
||||
"base_item": "blueberries",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 8.0,
|
||||
"out": "yl_canned_food:blueberry_jam"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 3.0,
|
||||
"base_item": "pumpkin_slice",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 7.0,
|
||||
"out": "yl_canned_food:canned_pumpkin"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 3.0,
|
||||
"base_item": "corn",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 11.0,
|
||||
"out": "yl_canned_food:canned_corn"
|
||||
},
|
||||
{
|
||||
"additives": [
|
||||
"group:food_sugar"
|
||||
],
|
||||
"base_amount": 6.0,
|
||||
"base_item": "blackberry",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 8.0,
|
||||
"out": "yl_canned_food:blackberry_jam"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 8.0,
|
||||
"base_item": "peas",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 10.0,
|
||||
"out": "yl_canned_food:canned_peas"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 6.0,
|
||||
"base_item": "beans",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 7.0,
|
||||
"out": "yl_canned_food:canned_beans"
|
||||
},
|
||||
{
|
||||
"additives": [
|
||||
"group:food_sugar"
|
||||
],
|
||||
"base_amount": 6.0,
|
||||
"base_item": "raspberries",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 8.0,
|
||||
"out": "yl_canned_food:raspberry_jam"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 3.0,
|
||||
"base_item": "apple",
|
||||
"base_mod": "default",
|
||||
"nutrition": 7.0,
|
||||
"out": "yl_canned_food:apple_jam"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 6.0,
|
||||
"base_item": "chili_pepper",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 7.0,
|
||||
"out": "yl_canned_food:canned_chili_pepper"
|
||||
},
|
||||
{
|
||||
"additives": [
|
||||
"group:food_sugar"
|
||||
],
|
||||
"base_amount": 4.0,
|
||||
"base_item": "grapes",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 11.0,
|
||||
"out": "yl_canned_food:grape_jam"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 5.0,
|
||||
"base_item": "coconut_slice",
|
||||
"base_mod": "ethereal",
|
||||
"nutrition": 6.0,
|
||||
"out": "yl_canned_food:canned_coconut"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 3.0,
|
||||
"base_item": "carrot",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 15.0,
|
||||
"out": "yl_canned_food:canned_carrot"
|
||||
},
|
||||
{
|
||||
"additives": [
|
||||
"group:food_sugar"
|
||||
],
|
||||
"base_amount": 6.0,
|
||||
"base_item": "rhubarb",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 8.0,
|
||||
"out": "yl_canned_food:rhubarb_jam"
|
||||
},
|
||||
{
|
||||
"additives": [
|
||||
"group:food_sugar"
|
||||
],
|
||||
"base_amount": 5.0,
|
||||
"base_item": "banana",
|
||||
"base_mod": "ethereal",
|
||||
"nutrition": 7.0,
|
||||
"out": "yl_canned_food:banana_jam"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 5.0,
|
||||
"base_item": "dandelion_yellow",
|
||||
"base_mod": "flowers",
|
||||
"nutrition": 6.0,
|
||||
"out": "yl_canned_food:dandelion_jam"
|
||||
},
|
||||
{
|
||||
"additives": [
|
||||
"group:food_sugar"
|
||||
],
|
||||
"base_amount": 3.0,
|
||||
"base_item": "melon_slice",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 8.0,
|
||||
"out": "yl_canned_food:melon_jam"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 5.0,
|
||||
"base_item": "rose",
|
||||
"base_mod": "flowers",
|
||||
"nutrition": 6.0,
|
||||
"out": "yl_canned_food:rose_jam"
|
||||
},
|
||||
{
|
||||
"additives": [
|
||||
"group:food_sugar"
|
||||
],
|
||||
"base_amount": 3.0,
|
||||
"base_item": "orange",
|
||||
"base_mod": "ethereal",
|
||||
"nutrition": 8.0,
|
||||
"out": "yl_canned_food:orange_jam"
|
||||
},
|
||||
{
|
||||
"additives": null,
|
||||
"base_amount": 5.0,
|
||||
"base_item": "cabbage",
|
||||
"base_mod": "farming",
|
||||
"nutrition": 6.0,
|
||||
"out": "yl_canned_food:canned_cabbage"
|
||||
},
|
||||
{
|
||||
"additives": [
|
||||
"group:food_sugar"
|
||||
],
|
||||
"base_amount": 6.0,
|
||||
"base_item": "lemon",
|
||||
"base_mod": "ethereal",
|
||||
"nutrition": 6.0,
|
||||
"out": "yl_canned_food:lemon_jam"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,29 @@
|
||||
-- item eat integration
|
||||
if (yl_canned_food_mtg.settings.enable_eat ~= true) then return false end
|
||||
|
||||
-- dependencies
|
||||
if (minetest.get_modpath("vessels") == nil) then
|
||||
yl_canned_food_mtg.log("feature item_eat enabled, but mod vessels not found")
|
||||
return false
|
||||
end
|
||||
|
||||
local amount = 0
|
||||
|
||||
for _, recipe in ipairs(yl_canned_food_mtg.data) do
|
||||
|
||||
-- normal
|
||||
local redefinition = {
|
||||
on_use = minetest.item_eat(recipe.nutrition, "vessels:glass_bottle")
|
||||
}
|
||||
minetest.override_item(recipe.out, redefinition)
|
||||
|
||||
-- pickled
|
||||
local redefinition_plus = {
|
||||
on_use = minetest.item_eat(recipe.nutrition * 2, "vessels:glass_bottle")
|
||||
}
|
||||
minetest.override_item(recipe.out .. "_plus", redefinition_plus)
|
||||
|
||||
amount = amount + 1
|
||||
end
|
||||
|
||||
yl_canned_food_mtg.log("item eat integration: " .. dump(amount))
|
||||
@@ -0,0 +1,88 @@
|
||||
-- recipes integration
|
||||
if (yl_canned_food_mtg.settings.enable_recipes ~= true) then return false end
|
||||
|
||||
local amount = 0
|
||||
|
||||
local function group_has_member(group)
|
||||
for itemname, _ in pairs(minetest.registered_items) do
|
||||
if minetest.get_item_group(itemname, group) ~= 0 then return true end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local itemcache = {}
|
||||
|
||||
local vessel = "vessels:glass_bottle"
|
||||
|
||||
itemcache[vessel] = true
|
||||
|
||||
for _, recipe in ipairs(yl_canned_food_mtg.data) do
|
||||
itemcache[recipe.out] = true
|
||||
|
||||
local ingredient = recipe.base_mod .. ":" .. recipe.base_item
|
||||
itemcache[ingredient] = true
|
||||
|
||||
for _, additive in ipairs(recipe.additives) do itemcache[additive] = true end
|
||||
end
|
||||
|
||||
local item_good = {}
|
||||
|
||||
for item, _ in pairs(itemcache) do
|
||||
local groupname = item:match("^group:(.*)")
|
||||
if (groupname == nil) then
|
||||
item_good[item] = (minetest.registered_items[item] ~= nil)
|
||||
else
|
||||
item_good[item] = group_has_member(groupname)
|
||||
end
|
||||
end
|
||||
|
||||
for _, recipe in ipairs(yl_canned_food_mtg.data) do
|
||||
|
||||
local crafting = {}
|
||||
local success = true
|
||||
|
||||
-- vessel
|
||||
table.insert(crafting, vessel)
|
||||
if (item_good[vessel] ~= false) then
|
||||
success = success and true
|
||||
else
|
||||
success = false
|
||||
end
|
||||
|
||||
-- additive
|
||||
for _, additive in ipairs(recipe.additives) do
|
||||
table.insert(crafting, additive)
|
||||
if (item_good[additive] ~= false) then
|
||||
success = success and true
|
||||
else
|
||||
success = false
|
||||
end
|
||||
end
|
||||
-- ingredient
|
||||
local ingredient = recipe.base_mod .. ":" .. recipe.base_item
|
||||
|
||||
for i = recipe.base_amount, 1, -1 do
|
||||
table.insert(crafting, ingredient)
|
||||
if (item_good[ingredient] ~= false) then
|
||||
success = success and true
|
||||
else
|
||||
success = false
|
||||
end
|
||||
end
|
||||
|
||||
if (success == true) then
|
||||
-- register the craft
|
||||
minetest.register_craft({
|
||||
output = recipe.out,
|
||||
type = "shapeless",
|
||||
recipe = crafting
|
||||
})
|
||||
|
||||
amount = amount + 1
|
||||
else
|
||||
minetest.log("warning",
|
||||
yl_canned_food_mtg.t("recipe_not_good", recipe.out))
|
||||
end
|
||||
end
|
||||
|
||||
yl_canned_food_mtg.log("recipes integration: " .. dump(amount))
|
||||
@@ -0,0 +1,38 @@
|
||||
-- unified_inventory integration
|
||||
if (yl_canned_food_mtg.settings.enable_unified_inventory ~= true) then
|
||||
return false
|
||||
end
|
||||
|
||||
-- dependencies
|
||||
if (minetest.get_modpath("unified_inventory") == nil) then
|
||||
yl_canned_food_mtg.log(
|
||||
"feature unfied_inventory enabled, but mod unfied_inventory not found")
|
||||
return false
|
||||
end
|
||||
|
||||
assert((type(unified_inventory.register_craft_type) == "function"),
|
||||
"register_craft_type does not exist in unified_inventory")
|
||||
assert((type(unified_inventory.register_craft) == "function"),
|
||||
"register_craft does not exist in unified_inventory")
|
||||
|
||||
unified_inventory.register_craft_type("yl_canned_food", {
|
||||
description = yl_canned_food_mtg.t(
|
||||
"unified_inventory_register_craft_type_description"),
|
||||
icon = "yl_canned_food_mtg_unified_inventory_craft.png",
|
||||
width = 1,
|
||||
height = 1,
|
||||
uses_crafting_grid = false
|
||||
})
|
||||
|
||||
local amount = 0
|
||||
|
||||
for _, recipe in ipairs(yl_canned_food_mtg.data) do
|
||||
unified_inventory.register_craft({
|
||||
output = recipe.out .. "_plus",
|
||||
type = "yl_canned_food",
|
||||
items = {recipe.out}
|
||||
})
|
||||
amount = amount + 1
|
||||
end
|
||||
|
||||
yl_canned_food_mtg.log("unfied_inventory integration: " .. dump(amount))
|
||||
@@ -0,0 +1,3 @@
|
||||
dofile(yl_canned_food_mtg.modpath .. "feature_recipes.lua")
|
||||
dofile(yl_canned_food_mtg.modpath .. "feature_eat.lua")
|
||||
dofile(yl_canned_food_mtg.modpath .. "feature_unified_inventory.lua")
|
||||
@@ -0,0 +1,7 @@
|
||||
yl_canned_food_mtg.information = {}
|
||||
yl_canned_food_mtg.information.version = "1.0.1"
|
||||
yl_canned_food_mtg.information.author = "AliasAlreadyTaken"
|
||||
yl_canned_food_mtg.information.license = "MIT"
|
||||
yl_canned_food_mtg.information.name = "yl_canned_food_mtg"
|
||||
yl_canned_food_mtg.information.source = "https://gitea.your-land.de/your-land/yl_canned_food_mtg"
|
||||
yl_canned_food_mtg.information.additional = yl_canned_food_mtg.t("information_additional")
|
||||
@@ -0,0 +1,29 @@
|
||||
-- Version 1.0.1
|
||||
-- Author AliasAlreadyTaken
|
||||
-- License MIT
|
||||
|
||||
-- Changelog
|
||||
-- 1.0.0 Release
|
||||
-- 1.0.1 Bugfix dependency
|
||||
|
||||
local mod_start_time = minetest.get_us_time()
|
||||
minetest.log("action", "[MOD] yl_canned_food_mtg loading")
|
||||
|
||||
yl_canned_food_mtg = {}
|
||||
yl_canned_food_mtg.error = {}
|
||||
yl_canned_food_mtg.modname = minetest.get_current_modname()
|
||||
-- yl_canned_food_mtg.modstorage = minetest.get_mod_storage()
|
||||
yl_canned_food_mtg.modpath = minetest.get_modpath("yl_canned_food_mtg") .. DIR_DELIM
|
||||
yl_canned_food_mtg.worldpath = minetest.get_worldpath() .. DIR_DELIM
|
||||
|
||||
dofile(yl_canned_food_mtg.modpath .. "texts.lua")
|
||||
dofile(yl_canned_food_mtg.modpath .. "information.lua")
|
||||
dofile(yl_canned_food_mtg.modpath .. "config.lua")
|
||||
dofile(yl_canned_food_mtg.modpath .. "setup.lua")
|
||||
dofile(yl_canned_food_mtg.modpath .. "data.lua")
|
||||
dofile(yl_canned_food_mtg.modpath .. "internal.lua")
|
||||
dofile(yl_canned_food_mtg.modpath .. "initialize.lua")
|
||||
dofile(yl_canned_food_mtg.modpath .. "features.lua")
|
||||
|
||||
local mod_end_time = (minetest.get_us_time() - mod_start_time) / 1000000
|
||||
minetest.log("action", "[MOD] yl_canned_food_mtg loaded in [" .. mod_end_time .. "s]")
|
||||
@@ -0,0 +1,8 @@
|
||||
-- Use this file to initialize variables once after server start and check everything is in place
|
||||
|
||||
local function run_each_serverstart()
|
||||
assert(yl_canned_food_mtg.check_settings_match(),yl_canned_food_mtg.t("settings_dont_match"))
|
||||
yl_canned_food_mtg.data = yl_canned_food_mtg.get_data()
|
||||
end
|
||||
|
||||
run_each_serverstart()
|
||||
@@ -0,0 +1,96 @@
|
||||
-- The functions and variables in this file are only for use in the mod itself.
|
||||
-- Those that do real work should be local and wrapped in public functions
|
||||
local function log(text)
|
||||
local logmessage = yl_canned_food_mtg.t("log_prefix", yl_canned_food_mtg.modname, text)
|
||||
if yl_canned_food_mtg.settings.debug then minetest.log("action", logmessage) end
|
||||
return logmessage
|
||||
end
|
||||
|
||||
function yl_canned_food_mtg.log(text) return log(text) end
|
||||
|
||||
local function get_savepath()
|
||||
local savepath = yl_canned_food_mtg.worldpath .. yl_canned_food_mtg.settings.save_path
|
||||
log(yl_canned_food_mtg.t("log_prefix", dump(savepath), ""))
|
||||
return savepath
|
||||
end
|
||||
|
||||
local function get_filepath(filename)
|
||||
local path_to_file = get_savepath() .. DIR_DELIM .. filename .. ".json"
|
||||
log(yl_canned_food_mtg.t("get_filepath", dump(filename), dump(path_to_file)))
|
||||
return path_to_file
|
||||
end
|
||||
|
||||
local function save_json(filename, content)
|
||||
if type(filename) ~= "string" or type(content) ~= "table" then
|
||||
return false
|
||||
end
|
||||
local savepath = get_filepath(filename)
|
||||
local savecontent = minetest.write_json(content)
|
||||
return minetest.safe_file_write(savepath, savecontent)
|
||||
end
|
||||
|
||||
local function load_json(path)
|
||||
local file = io.open(path, "r")
|
||||
if not file then
|
||||
return false, yl_canned_food_mtg.t("error_cannot_open_file", dump(path))
|
||||
end
|
||||
|
||||
local content = file:read("*all")
|
||||
file:close()
|
||||
|
||||
if not content then
|
||||
return false, yl_canned_food_mtg.t("error_cannot_read_file", dump(path))
|
||||
end
|
||||
|
||||
return true, minetest.parse_json(content)
|
||||
end
|
||||
|
||||
-- Public functions wrap the private ones, so they can be exchanged easily
|
||||
|
||||
function yl_canned_food_mtg.get_filepath(filename)
|
||||
return get_filepath(filename)
|
||||
end
|
||||
|
||||
function yl_canned_food_mtg.load(filename, ...) return load_json(filename, ...) end
|
||||
|
||||
function yl_canned_food_mtg.save(filename, content, ...)
|
||||
return save_json(filename, content, ...)
|
||||
end
|
||||
|
||||
-- Read data
|
||||
--
|
||||
|
||||
local function get_data()
|
||||
|
||||
local filename = yl_canned_food_mtg.settings.save_path
|
||||
local filepath = yl_canned_food_mtg.get_filepath(filename)
|
||||
yl_canned_food_mtg.json_recipes = yl_canned_food_mtg.load(filepath) or {}
|
||||
|
||||
return yl_canned_food_mtg.legacy_recipes or yl_canned_food_mtg.default_recipes or yl_canned_food_mtg.json_recipes
|
||||
end
|
||||
|
||||
function yl_canned_food_mtg.get_data()
|
||||
return get_data()
|
||||
end
|
||||
|
||||
-- Check sttings match
|
||||
--
|
||||
|
||||
local function check_settings_match()
|
||||
if (yl_canned_food.settings.legacy == true) and (yl_canned_food_mtg.settings.data_source == "legacy") then
|
||||
-- legacy: Nodenames looke like canned_food:apple_jam
|
||||
return true
|
||||
elseif (yl_canned_food.settings.legacy == false) and (yl_canned_food_mtg.settings.data_source == "default") then
|
||||
-- default: Nodenames looke like yl_canned_food:apple_jam
|
||||
return true
|
||||
elseif (yl_canned_food_mtg.settings.data_source == "json") then
|
||||
-- json: It's the user's responsibility to adjust the nodenames in the json
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function yl_canned_food_mtg.check_settings_match()
|
||||
return check_settings_match()
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
name = yl_canned_food_mtg
|
||||
description = Craft and eat yl_canned_food in mtg
|
||||
depends = yl_canned_food
|
||||
optional_depends = default, unified_inventory, vessels, bushes, ethereal, flowers, farming, mobs_animal
|
||||
author = AliasAlreadyTaken
|
||||
title = Canned Food MTG
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.7 MiB |
@@ -0,0 +1,31 @@
|
||||
[yl_canned_food_mtg]
|
||||
|
||||
# Debug
|
||||
# Set this to true to enable debug mode, it will output some more values to log
|
||||
# Optional, default is false
|
||||
yl_canned_food_mtg.debug (Debug mode) bool false
|
||||
|
||||
# Enable recipes
|
||||
# Set this to true if you want to enable recipes. Set this to false if you create recipes of your own in a different mod.
|
||||
# Optional, default is true
|
||||
yl_canned_food_mtg.enable_recipes (Enable recipes) bool true
|
||||
|
||||
# Enable eat
|
||||
# Set this to true if you want to enable eating. Set this to false if you create item_eat integration of your own in a different mod.
|
||||
# Optional, default is true
|
||||
yl_canned_food_mtg.enable_eat (Debug mode) bool true
|
||||
|
||||
# Enable unified_inventory integration
|
||||
# Set this to true if you want to enable unified_inventory integration. Set this to false to disable the integration.
|
||||
# Optional, default is true
|
||||
yl_canned_food_mtg.enable_unified_inventory (Enable unified_inventory integration) bool true
|
||||
|
||||
# Data source
|
||||
# Set this to where the data will be loaded from. Use "default" for a new world, "legacy" for a world where this mod replaces canned_food and "json" where you decide the data for yourself.
|
||||
# optional, default is "default"
|
||||
yl_canned_food_mtg.data_source (Data source) enum default default,legacy,json
|
||||
|
||||
# Save path
|
||||
# Set this to where in the worldfolder you want the JSON files stored.
|
||||
# Optional, default is yl_canned_food_mtg
|
||||
yl_canned_food_mtg.save_path (Save path) string yl_canned_food_mtg
|
||||
@@ -0,0 +1,19 @@
|
||||
if yl_canned_food_mtg.settings.data_source ~= "json" then
|
||||
return false
|
||||
end
|
||||
|
||||
local mkdir = minetest.mkdir
|
||||
local save_path = yl_canned_food_mtg.settings.save_path
|
||||
|
||||
local function run_once()
|
||||
local path = yl_canned_food_mtg.worldpath .. DIR_DELIM .. save_path
|
||||
local file = io.open(path, "r")
|
||||
if not file then
|
||||
mkdir(path)
|
||||
else
|
||||
file:close()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
run_once()
|
||||
@@ -0,0 +1,54 @@
|
||||
local S = minetest.get_translator(yl_canned_food_mtg.modname)
|
||||
|
||||
local texts = {}
|
||||
|
||||
--function yl_canned_food_mtg.t(key, ...) return S(texts[key], ...) or "" end
|
||||
function yl_canned_food_mtg.t(key, ...)
|
||||
if (texts[key] == nil) then
|
||||
minetest.log("warning","key " .. (key or "") .. " does not exist")
|
||||
return key
|
||||
end
|
||||
return S(texts[key], ...) or ""
|
||||
end
|
||||
|
||||
-- Fixed texts
|
||||
|
||||
texts["log_prefix"] = "[MOD] @1 : @2"
|
||||
|
||||
-- Translateable texts
|
||||
|
||||
texts["information_additional"] = "Craft and eat yl_canned_food in mtg"
|
||||
|
||||
texts["unified_inventory_register_craft_type_description"] = "Place in a dark room"
|
||||
|
||||
|
||||
texts["chatcommand_admin_description"] = "Admin Chatcommand description"
|
||||
texts["chatcommand_admin_parameters"] = "<name> <privilege>"
|
||||
texts["chatcommand_admin_success_message"] = "Sucess message"
|
||||
texts["chatcommand_admin_fail_message"] = "Fail message"
|
||||
|
||||
texts["chatcommand_player_description"] = "Player Chatcommand description"
|
||||
texts["chatcommand_player_parameters"] = "<name> <privilege>"
|
||||
texts["chatcommand_player_success_message"] = "Sucess message"
|
||||
texts["chatcommand_player_fail_message"] = "Fail message"
|
||||
|
||||
texts["api_sent_x_to_y"] = "Sent @1 to @2"
|
||||
|
||||
texts["privs_example_description"] = "Can do example task"
|
||||
texts["privs_example_grant_logmessage"] = "User @1 granted priv @2 to user @3"
|
||||
texts["privs_example_revoke_logmessage"] =
|
||||
"User @1 revoked priv @2 from user @3"
|
||||
|
||||
-- Errormessages
|
||||
|
||||
texts["error_not_a_string"] = "@1 not a string"
|
||||
texts["error_player_not_online"] = "@1 not an online player"
|
||||
texts["error_not_a_colorspec"] = "@1 not a ColorSpec"
|
||||
texts["error_not_a_position"] = "@1 not a position"
|
||||
texts["error_function_not_available"] = "@1 not available"
|
||||
|
||||
texts["error_cannot_open_file"] = "Error opening file: @1"
|
||||
texts["error_cannot_read_file"] = "Error reading file: @1"
|
||||
|
||||
texts["error_name_not_found"] = "Name not found: @1"
|
||||
texts["error_priv_not_found"] = "Priv not found: @1"
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 643 B |
Reference in New Issue
Block a user