new structure format which is kinda broke.

master
Auri 2020-11-28 17:40:10 -08:00
parent 6f2e9e3bea
commit eda8fe4a37
267 changed files with 2349 additions and 78 deletions

View File

@ -161,7 +161,6 @@ add_library(Zepha_Core
lua/LuaParser.cpp
lua/LuaParser.h
lua/modules/BaseModule.h
lua/modules/create_structure.h
lua/modules/Dimension.cpp
lua/modules/Dimension.h
lua/modules/mSetGui.h
@ -316,6 +315,6 @@ add_library(Zepha_Core
world/ServerWorld.h
world/World.cpp
world/World.h
util/net/Address.cpp util/Bounds.cpp util/Bounds.h lua/register/CreateRegister.h lua/register/CreateRegister.cpp)
util/net/Address.cpp util/Bounds.cpp util/Bounds.h lua/register/CreateRegister.h lua/register/CreateRegister.cpp lua/modules/Structure.cpp lua/modules/Structure.h)
target_include_directories(Zepha_Core PUBLIC .)

View File

@ -26,8 +26,7 @@
// Modules
#include "modules/Time.h"
#include "modules/Dimension.h"
#include "modules/create_structure.h"
#include "modules/Structure.h"
// Util
#include "lua/register/CreateRegister.h"
@ -79,6 +78,7 @@ void LocalLuaParser::loadApi(WorldPtr world, PlayerPtr player) {
// Modules
modules.emplace_back(std::make_unique<Api::Module::Time>(Api::State::CLIENT, lua, core));
modules.emplace_back(std::make_unique<Api::Module::Dimension>(Api::State::CLIENT, core, game, **world));
modules.emplace_back(std::make_unique<Api::Module::Structure>(Api::State::CLIENT, core, game, **world));
// Register
auto& game = static_cast<LocalSubgame&>(this->game);
@ -109,11 +109,9 @@ void LocalLuaParser::loadApi(WorldPtr world, PlayerPtr player) {
bindModules();
Api::create_structure(lua, core);
// Create sandboxed runfile()
lua["dofile"] = lua["loadfile"] = sol::nil;
lua.set_function("runfile", &LocalLuaParser::runFileSandboxedWithEnv, this);
lua.set_function("runfile", &LocalLuaParser::runFileSandboxed, this);
}
sol::protected_function_result LocalLuaParser::errorCallback(sol::protected_function_result r) const {
@ -177,30 +175,4 @@ sol::protected_function_result LocalLuaParser::runFileSandboxed(const std::strin
throw std::runtime_error("Error opening \"" + file + "\", file not found.");
}
throw std::runtime_error("Error opening \"" + file + "\", mod not found.");
}
sol::protected_function_result LocalLuaParser::runFileSandboxedWithEnv(sol::this_environment cEnv, const std::string& file) {
size_t modname_length = file.find('/');
if (modname_length == std::string::npos)
throw std::runtime_error("Error opening \"" + file + "\", specified file is invalid.");
std::string modname = file.substr(0, modname_length);
for (const LuaMod& mod : handler.cGetMods()) {
if (modname != mod.config.name) continue;
for (const LuaMod::File& f : mod.files) {
if (f.path != file) continue;
sol::environment currentEnv = cEnv;
sol::environment env(lua, sol::create, currentEnv.get<sol::table>("_G"));
env["_PATH"] = f.path.substr(0, f.path.find_last_of('/') + 1);
env["_FILE"] = f.path;
env["_MODNAME"] = mod.config.name;
return lua.safe_script(f.file, env, std::bind(&LocalLuaParser::errorCallback, this, std::placeholders::_2),
"@" + f.path, sol::load_mode::text);
}
throw std::runtime_error("Error opening \"" + file + "\", file not found.");
}
throw std::runtime_error("Error opening \"" + file + "\", mod not found.");
}

View File

@ -31,7 +31,6 @@ class LocalLuaParser : public LuaParser {
virtual sol::protected_function_result errorCallback(sol::protected_function_result r) const override;
sol::protected_function_result runFileSandboxed(const std::string& file);
sol::protected_function_result runFileSandboxedWithEnv(sol::this_environment env, const std::string& file);
LuaKeybindHandler keybinds;
LocalModHandler handler;

View File

@ -27,8 +27,7 @@
// Modules
#include "lua/modules/Time.h"
#include "lua/modules/Dimension.h"
#include "modules/create_structure.h"
#include "lua/modules/Structure.h"
// Util
#include "lua/register/CreateRegister.h"
@ -109,6 +108,7 @@ void ServerLuaParser::loadApi(WorldPtr world) {
// Modules
modules.emplace_back(std::make_unique<Api::Module::Time>(Api::State::SERVER, lua, core));
modules.emplace_back(std::make_unique<Api::Module::Dimension>(Api::State::SERVER, core, game, *world.s()));
modules.emplace_back(std::make_unique<Api::Module::Structure>(Api::State::SERVER, core, game, *world.s()));
// Register
auto& game = static_cast<ServerSubgame&>(this->game);
@ -136,8 +136,6 @@ void ServerLuaParser::loadApi(WorldPtr world) {
}
}
Api::create_structure(lua, core);
bindModules();
// Create sandboxed runfile()

View File

@ -1,7 +1,3 @@
//
// Created by aurailus on 2020-07-30.
//
#pragma once
#include "SubgameModule.h"
@ -10,12 +6,12 @@
namespace Api::Module {
class Dimension : public Api::Module::SubgameModule {
public:
public:
using SubgameModule::SubgameModule;
void bind() override;
protected:
protected:
Api::Usertype::Dimension createDimension(const std::string& identifier, sol::table data);
sol::object getDimension(sol::this_state s, const std::string& identifier);

View File

@ -0,0 +1,36 @@
#include "Structure.h"
#include "lua/Lua.h"
#include "game/Subgame.h"
#include "util/Schematic.h"
#include "game/def/BlockDef.h"
#include "game/atlas/DefinitionAtlas.h"
void Api::Module::Structure::bind() {
core.set_function("create_structure", Util::bind_this(this, &Structure::create_structure));
}
sol::object Api::Module::Structure::create_structure(sol::table data) {
auto origin = data.get<sol::optional<glm::vec3>>("origin");
auto schematic = data.get<sol::table>("schematic");
auto probability = data.get<float>("probability");
unsigned int yWid = schematic.size();
unsigned int zWid = schematic.get<sol::table>(1).size();
unsigned int xWid = schematic.get<sol::table>(1).get<sol::table>(1).size();
auto s = std::make_shared<::Schematic>();
s->dimensions = { xWid, yWid, zWid };
s->origin = origin ? glm::ivec3 { *origin } : glm::ivec3 {};
s->blocks.reserve(xWid * yWid * zWid);
s->probability = probability;
for (unsigned int x = 1; x <= yWid; x++)
for (unsigned int y = 1; y <= zWid; y++)
for (unsigned int z = 1; z <= xWid; z++)
s->blocks.push_back(game.getDefs().blockFromStr(schematic.
get<sol::table>(y).get<sol::table>(z).get_or<std::string>(x, "")).index);
return sol::make_object<std::shared_ptr<Schematic>>(lua, s);
}

View File

@ -0,0 +1,15 @@
#pragma once
#include "SubgameModule.h"
namespace Api::Module {
class Structure : public Api::Module::SubgameModule {
public:
using SubgameModule::SubgameModule;
void bind() override;
protected:
sol::object create_structure(sol::table data);
};
}

View File

@ -13,12 +13,12 @@ class Subgame;
namespace Api {
namespace Module {
class SubgameModule : public BaseModule {
public:
public:
SubgameModule(State state, sol::table& core, Subgame& game, World& world);
virtual void bind() = 0;
protected:
protected:
State state;
World& world;

View File

@ -1,7 +1,3 @@
//
// Created by aurailus on 2020-07-26.
//
#include "Time.h"
#include "../Lua.h"
@ -12,7 +8,7 @@ void Api::Module::Time::bind() {
time.set_function("ns", Util::bind_this(this, &Time::ns));
time.set_function("ms", Util::bind_this(this, &Time::ms));
time.set_function("s", Util::bind_this(this, &Time::s));
time.set_function("s", Util::bind_this(this, &Time::s));
}
float Api::Module::Time::ns() {

View File

@ -1,22 +1,16 @@
//
// Created by aurailus on 2020-07-26.
//
#pragma once
#include <glm/vec3.hpp>
#include "SubgameModule.h"
#include "../../util/Timer.h"
namespace Api::Module {
class Time : public Api::Module::BaseModule {
public:
public:
using BaseModule::BaseModule;
void bind() override;
protected:
protected:
float ns();
float ms();

View File

@ -7,17 +7,6 @@
#include "game/def/BlockDef.h"
#include "game/atlas/DefinitionAtlas.h"
void Schematic::process(DefinitionAtlas& atlas) {
blocks.reserve(stringData.size());
for (auto& string : stringData) blocks.push_back(atlas.blockFromStr(string).index);
stringData.clear();
stringData.shrink_to_fit();
processed = true;
}
glm::ivec3 Schematic::getOffset(unsigned int ind) {
glm::ivec3 vec{};

View File

@ -11,16 +11,15 @@
class DefinitionAtlas;
struct Schematic {
std::vector<std::string> stringData{};
bool processed = false;
glm::ivec3 origin {};
glm::ivec3 dimensions {};
std::vector<unsigned int> blocks {};
std::vector<unsigned int> blocks{};
glm::ivec3 dimensions{};
glm::ivec3 origin{};
float probability = 0;
void process(DefinitionAtlas& atlas);
inline unsigned int length() { return blocks.size(); }
inline unsigned int length() {
return blocks.size();
}
glm::ivec3 getOffset(unsigned int ind);

View File

@ -0,0 +1,6 @@
{
"name": "@aurailus:basictools",
"description": "Basic tools for Zepha.",
"version": "0.0.1",
"depends": ["zeus:materials", "@aurailus:crafting", "@aurailus:hot_wheel"]
}

View File

@ -0,0 +1,87 @@
zepha.register_item("@aurailus:basictools:flint_pickaxe", {
name = "Flint Pick",
textures = {
"@aurailus:basictools:flint_pickaxe"
}
})
crafting.register_recipe({
output = "@aurailus:basictools:flint_pickaxe",
recipe = {
{"zeus:materials:flint_pickaxe_head", "zeus:materials:plant_twine"},
{"zeus:materials:stick", ""}
}
})
zepha.register_item("@aurailus:basictools:flint_hatchet", {
name = "Flint Hatchet",
textures = {
"@aurailus:basictools:flint_hatchet"
}
})
crafting.register_recipe({
output = "@aurailus:basictools:flint_hatchet",
recipe = {
{"zeus:materials:flint_axe_head", "zeus:materials:plant_twine"},
{"zeus:materials:stick", ""}
}
})
zepha.register_item("@aurailus:basictools:flint_shovel", {
name = "Flint Spade",
textures = {
"@aurailus:basictools:flint_shovel"
},
tool_props = {
interval = 0.4,
damage_groups = {
scoop = 7
}
}
});
crafting.register_recipe({
output = "@aurailus:basictools:flint_shovel",
recipe = {
{"zeus:materials:flint_shovel_head", "zeus:materials:plant_twine"},
{"zeus:materials:stick", ""}
}
})
zepha.register_item("@aurailus:basictools:wooden_pickaxe", {
name = "Wooden Pick",
textures = {
"@aurailus:basictools:wooden_pickaxe"
}
});
zepha.register_item("@aurailus:basictools:wooden_hatchet", {
name = "Wooden Hatchet",
textures = {
"@aurailus:basictools:wooden_hatchet"
}
});
zepha.register_item("@aurailus:basictools:wooden_shovel", {
name = "Wooden Shovel",
textures = {
"@aurailus:basictools:wooden_shovel"
},
tool_props = {
interval = 0.45,
damage_groups = {
scoop = 5
}
}
});
if zepha.server then
zepha.bind("new_player", function(player)
local inv = player:get_inventory():get_list("hot_wheel_1");
inv:add_stack({"@aurailus:basictools:flint_pickaxe", 1})
-- inv:add_stack({"@aurailus:basictools:wooden_hatchet", 1})
-- inv:add_stack({"@aurailus:basictools:wooden_shovel", 1})
inv:add_stack({"@aurailus:basictools:flint_shovel", 1})
end)
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 559 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

View File

@ -0,0 +1,6 @@
{
"name": "@aurailus:crafting",
"description": "Basic grid-crafting system for Zepha.",
"version": "1.0.0",
"depends": []
}

View File

@ -0,0 +1,60 @@
_G["crafting"] = {}
crafting.registered_recipes = {}
function crafting.register_recipe(tbl)
table.insert(crafting.registered_recipes, tbl)
end
function crafting.bind(craft_input, craft_output)
local width = craft_input.width
local length = craft_input.length
local crafting_changed = function()
local items = {}
local matched_any = false
for _,r in crafting.registered_recipes do
local matches = true
for i = 1, length do
local x = (i - 1) % width + 1
local y = math.floor((i - 1) / width) + 1
local recipe_item_name = ""
if y <= #(r.recipe) and x <= #(r.recipe[y]) then
recipe_item_name = r.recipe[y][x]
end
if recipe_item_name ~= craft_input:get_stack(i).name then
matches = false
break
end
end
if matches then
craft_output:set_stack(1, {r.output, 1})
matched_any = true
break
end
end
if not matched_any then
craft_output:set_stack(1, {"invalid", 0})
end
end
-- craft_input.on_put = crafting_changed
-- craft_input.on_take = crafting_changed
-- craft_output.allow_put = function()
-- return 0
-- end
--
-- craft_output.on_take = function()
-- for i = 1, length do
-- craft_input:remove_stack(i, 1)
-- end
-- crafting_changed()
-- end
end

View File

@ -0,0 +1,5 @@
{
"name": "@aurailus:hot_wheel",
"description": "A speedy way to select items from your inventory :3",
"version": "0.0.1"
}

View File

@ -0,0 +1,10 @@
_G["aurailus_hot_wheel"] = {}
if zepha.server then
runfile(_PATH .. "register")
end
if zepha.client then
runfile(_PATH .. "ui")
runfile(_PATH .. "keys")
end

View File

@ -0,0 +1,92 @@
local api = aurailus_hot_wheel
local r = 6.28319 / 6
local currentRotation = 0
local desiredRotation = 0
local rotating = false
local mod = false
local slot = 1
local item = 1
local function position()
rotating = true
zepha.after(function()
currentRotation = currentRotation + (desiredRotation - currentRotation) / 2
for i, list in ipairs(api.lists) do
list.position = { 32.5 + 22 * math.sin(currentRotation - (r * (i + 3))), 32.5 + 22 * math.cos(currentRotation - (r * (i + 3))) } end
for i, label in ipairs(api.labels) do
label.position = { 37 + 35 * math.sin(currentRotation - (r * (i + 3))), 36 + 35 * math.cos(currentRotation - (r * (i + 3))) } end
if currentRotation == desiredRotation then
rotating = false
return false
elseif math.abs(currentRotation - desiredRotation) < 0.033 then
currentRotation = desiredRotation
return true
else return true end
end, 1/60)
end
local function select_slot(n)
slot = n
local offset = n - 1
desiredRotation = offset * r
api.list_expanded.list = "hot_wheel_" .. n
for i, list in ipairs(api.lists) do list.visible = i ~= n end
for i, label in ipairs(api.labels) do label.visible = i ~= n end
zepha.player:set_wield_list("hot_wheel_" .. slot);
if not rotating then position() end
end
local function select_item(n)
item = ((item + n) - 1) % 5 + 1
local offset = slot - 1
api.list_expanded_indicator.position = { 2 + 18 * (item - 1), 0 }
zepha.player:set_wield_index(item)
end
select_slot(1)
select_item(0)
local function key(n)
select_slot(n)
end
local function scroll(n)
if mod then select_slot(((slot + n - 1) % 6) + 1)
else select_item(n) end
end
for i = 1, 6 do
zepha.register_keybind("@aurailus:hot_wheel:select_slot_" .. i, {
description = "Select Slot " .. i,
default = zepha.keys[tostring(i)],
on_press = function() key(i) end
})
end
zepha.register_keybind("@aurailus:hot_wheel:item_down", {
description = "Cycle Item Down",
default = zepha.keys.scrolldown,
on_press = function() scroll(1) end
})
zepha.register_keybind("@aurailus:hot_wheel:item_up", {
description = "Cycle Item Up",
default = zepha.keys.scrollup,
on_press = function() scroll(-1) end
})
zepha.register_keybind("@aurailus:hot_wheel:mod", {
description = "Modifier Key",
default = zepha.keys.leftshift,
on_press = function() mod = true end,
on_release = function() mod = false end
})

View File

@ -0,0 +1,31 @@
zepha.bind("new_player", function(p)
local inv = p:get_inventory()
inv:add_list("hot_wheel_1", 5, 5)
inv:add_list("hot_wheel_2", 5, 5)
inv:add_list("hot_wheel_3", 5, 5)
inv:add_list("hot_wheel_4", 5, 5)
inv:add_list("hot_wheel_5", 5, 5)
inv:add_list("hot_wheel_6", 5, 5)
-- -- Get hot wheel
-- local invs = {
-- inv:get_list("hot_wheel_1"),
-- inv:get_list("hot_wheel_2"),
-- inv:get_list("hot_wheel_3"),
-- inv:get_list("hot_wheel_4"),
-- inv:get_list("hot_wheel_5"),
-- inv:get_list("hot_wheel_6")
-- }
--
-- for _,inv in pairs(invs) do
-- inv.allow_take = function() return 0 end
--
-- inv.allow_put = function(slot, item)
-- zepha.after(function()
-- -- This delay is necessary to avoid the engine overwriting it with nothing
-- inv:set_stack(slot, item)
-- end, 0)
-- return 0
-- end
-- end
end)

View File

@ -0,0 +1,130 @@
local api = aurailus_hot_wheel
local hud = zepha.player:get_hud()
hud:append(function()
local root = Gui.Rect {
key = "hot_wheel_root",
size = { 140, 80 },
position = { "0%", "100%" },
position_anchor = { "-10%", "110%" },
Gui.Rect {
size = { 94, 18 },
position = { 52, 19 },
background = "@aurailus:hot_wheel:hot_wheel_line",
Gui.Rect {
key = "expanded_indicator",
size = { 18, 18 },
position = { 2, 0 },
background = "@aurailus:hot_wheel:hot_wheel_selection"
},
Gui.InventoryList {
key = "list_expanded",
position = { 3, 1 },
slot_spacing = { 2, 2 },
length = 6,
source = "current_player",
list = "hot_wheel_1",
}
},
Gui.Rect {
size = { 80, 80 },
background = "@aurailus:hot_wheel:hot_wheel_circle",
Gui.InventoryList {
key = "list_1",
slot_spacing = { 2, 2 },
length = 1,
source = "current_player",
list = "hot_wheel_1",
},
Gui.InventoryList {
key = "list_2",
slot_spacing = { 2, 2 },
length = 1,
source = "current_player",
list = "hot_wheel_2",
},
Gui.InventoryList {
key = "list_3",
slot_spacing = { 2, 2 },
length = 1,
source = "current_player",
list = "hot_wheel_3",
},
Gui.InventoryList {
key = "list_4",
slot_spacing = { 2, 2 },
length = 1,
source = "current_player",
list = "hot_wheel_4",
},
Gui.InventoryList {
key = "list_5",
slot_spacing = { 2, 2 },
length = 1,
source = "current_player",
list = "hot_wheel_5",
},
Gui.InventoryList {
key = "list_6",
slot_spacing = { 2, 2 },
length = 1,
source = "current_player",
list = "hot_wheel_6",
},
Gui.Text {
key = "label_1",
content = "1"
},
Gui.Text {
key = "label_2",
content = "2"
},
Gui.Text {
key = "label_3",
content = "3"
},
Gui.Text {
key = "label_4",
content = "4"
},
Gui.Text {
key = "label_5",
content = "5"
},
Gui.Text {
key = "label_6",
content = "6"
}
}
}
api.labels = {
root:get("label_1"),
root:get("label_2"),
root:get("label_3"),
root:get("label_4"),
root:get("label_5"),
root:get("label_6")
}
api.lists = {
root:get("list_1"),
root:get("list_2"),
root:get("list_3"),
root:get("list_4"),
root:get("list_5"),
root:get("list_6")
}
api.list_expanded = root:get("list_expanded")
api.list_expanded_indicator = root:get("expanded_indicator")
return root
end)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 931 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

View File

@ -0,0 +1,50 @@
# Item Collection
**By Auri Collings (Aurailus)**
## Description
Item Collection is a mod that enables blocks to yield zero or more items when broken.
## Technical Information
### Mode Setting
Item Collection can be configured to yield items in multiple ways:
1. Adding blocks directly to the user's inventory. `"direct"`
2. Creating a dropped-item entity that can be picked up by a player standing nearby. `"ent_nearby"`
3. Creating a dropped-item entity that can be picked up by interacting with it. `"ent_interact"`
This can be configured using the `/item_collection:set_mode` chat command, or by setting the `mode` parameter inside of the config file. (UNIMPLEMENTED)
### Inventory
Item Collection will, by default, attempt to add all items to a `main` list inside of the player's inventory. This can be configured using the `/item_collection:set_list` chat command, or by setting the `list` parameter inside of the config file. (UNIMPLEMENTED)
### Block Definition
Item Collection will look for a `yields` parameter in the definition of the block broken. This field can either be a string containing an item name, an item name followed by a number denoting how many of the item to yield, or a function which returns a string in one of the two previous formats. The following code blocks are examples of valid formats:
Drop a dirt block:
```lua
yields = "zeus:default:dirt"
```
Drop four dirt blocks:
```lua
yields = "zeus:default:dirt 4"
```
Drop a dirt block 50% of the time:
```lua
yields = function(pos)
if math.random() >= 0.5 then
return "zeus:default:dirt"
else
return ""
end
end
```
If the key is missing, or the value or returned value is `nil` or an empty string, no item will be yielded.

View File

@ -0,0 +1,5 @@
{
"name": "@aurailus:item_collection",
"description": "A mod to enable collecting items from blocks when mined. Can be configured to use dropped items or just directly add to inventory.",
"version": "0.0.1"
}

View File

@ -0,0 +1,94 @@
local function collides(entity)
return entity.dim:get_block((entity.pos - V{0, 0.5, 0}):floor()) ~= "air"
end
zepha.register_entity("@aurailus:item_collection:dropped_item", {
display = "gameobject",
display_object = "invalid",
on_create = function(self, static)
static = static or {}
self.item = static.item or self.display_object
self.object:set_display_type("gameobject", self.item)
self.tick = 0
self.time = static.time or 0
self.speed = static.speed or 15
self.delete = false
self.scooping = false
local angle = math.random() * (math.pi*2)
local amp = (math.random() + 0.5) * 5
local x = math.sin(angle) * amp
local z = math.cos(angle) * amp
self.vel = static.vel or V(x, -85, z)
if not zepha.registered_blocks[self.item] then self.object.scale = 1/2
else self.object.scale = 1/3 end
end,
on_update = function(self, delta)
self.object.yaw = self.object.yaw + self.speed
if self.speed > 1 then self.speed = self.speed * 0.92 end
self.tick = self.tick + delta
if self.time > 5 * 60 then
zepha.remove_entity(self)
return
end
if self.scooping then return end
if not collides(self.object) then
self.vel.y = math.min(self.vel.y + 300 * delta, 480)
end
local iter = 1
while not collides(self.object) and iter <= math.abs(self.vel.y * delta) do
local interval = 1/16
if self.vel.y > 0 then interval = -1/16 end
self.object.pos = self.object.pos + V{0, interval, 0}
iter = iter + 0.25
end
self.object.pos = self.object.pos + V(self.vel.x, 0, self.vel.z) * delta
self.vel.x = self.vel.x * 0.6
self.vel.z = self.vel.z * 0.6
self.object.visual_offset = V{0, math.sin(self.time * 2) / 8, 0}
if collides(self.object) then
self.vel.y = 0
self.time = self.time + delta
end
if self.tick > 0.15 then
self.tick = 0
self:check_collect()
end
end,
check_collect = function(self)
for _,p in pairs(zepha.players) do
if p.pos:distance(self.object.pos) < 2 then
self.object.pos = p.pos + V{0, 0.90, 0}
self.scooping = true
zepha.after(function()
p:get_inventory():get_list("main"):add_stack({self.item, 1})
self.object.dim:remove_entity(self)
end, 2/20)
end
end
end,
on_serialize = function(self)
return {
vel = self.vel,
time = self.time,
speed = self.speed
}
end
})

View File

@ -0,0 +1,10 @@
return function(dim, pos)
local def = zepha.registered_blocks[dim:get_block(pos)]
if def == nil then return nil end
local yields = def.yields
if type(yields) == "function" then yields = yields(pos) end
if yields == nil or type(yields) ~= "string" then return nil end
return yields
end

View File

@ -0,0 +1,6 @@
runfile("@aurailus:item_collection/dropped_item")
local DROP_ENTITY = true
if DROP_ENTITY then runfile("@aurailus:item_collection/mode/entity")
else runfile("@aurailus:item_collection/mode/direct") end

View File

@ -0,0 +1,10 @@
local get_yield = runfile("@aurailus:item_collection/get_yield")
if zepha.server then
zepha.bind("on_break", function(pos, player)
local yields = get_yield(pos)
if yields == nil then return end
player:get_inventory():get_list("main"):add_stack({yields, 1})
end)
end

View File

@ -0,0 +1,9 @@
local get_yield = runfile("@aurailus:item_collection/get_yield")
if zepha.server then
zepha.bind("on_break", function(dim, pos)
local yields = get_yield(dim, pos)
if yields == nil then return end
dim:add_entity(pos + 0.5, "@aurailus:item_collection:dropped_item", { item = yields });
end)
end

View File

@ -0,0 +1 @@
Add the most delicious treat to your Minetest game with the Chocolate mod. Adds cocoa and craftable chocolate bars that can be eaten 8 times before they run out.

View File

@ -0,0 +1,3 @@
# Chocolate
A Minetest mod to add farmable chocolate to the game.

View File

@ -0,0 +1,7 @@
{
"name": "minetest:chocolate",
"description": "Chocolate.",
"version": "0.0.1",
"depends": ["minetest:_polyfill"]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

View File

@ -0,0 +1,161 @@
--Items
minetest.register_craftitem("chocolate:chocolate_bar_1", {
description = "Chocolate Bar",
inventory_image = "chocolate_chocolate_bar_1.png",
on_use = minetest.item_eat(2)
})
minetest.register_craftitem("chocolate:chocolate_bar_2", {
description = "Chocolate Bar",
inventory_image = "chocolate_chocolate_bar_2.png",
on_use = minetest.item_eat(2, "chocolate:chocolate_bar_1")
})
minetest.register_craftitem("chocolate:chocolate_bar_3", {
description = "Chocolate Bar",
inventory_image = "chocolate_chocolate_bar_3.png",
on_use = minetest.item_eat(2, "chocolate:chocolate_bar_2")
})
minetest.register_craftitem("chocolate:chocolate_bar_4", {
description = "Chocolate Bar",
inventory_image = "chocolate_chocolate_bar_4.png",
on_use = minetest.item_eat(2, "chocolate:chocolate_bar_3")
})
minetest.register_craftitem("chocolate:chocolate_bar_5", {
description = "Chocolate Bar",
inventory_image = "chocolate_chocolate_bar_5.png",
on_use = minetest.item_eat(2, "chocolate:chocolate_bar_4")
})
minetest.register_craftitem("chocolate:chocolate_bar_6", {
description = "Chocolate Bar",
inventory_image = "chocolate_chocolate_bar_6.png",
on_use = minetest.item_eat(2, "chocolate:chocolate_bar_5")
})
minetest.register_craftitem("chocolate:chocolate_bar_7", {
description = "Chocolate Bar",
inventory_image = "chocolate_chocolate_bar_7.png",
on_use = minetest.item_eat(2, "chocolate:chocolate_bar_6")
})
minetest.register_craftitem("chocolate:chocolate_bar_8", {
description = "Chocolate Bar",
inventory_image = "chocolate_chocolate_bar_8.png",
on_use = minetest.item_eat(2, "chocolate:chocolate_bar_7")
})
minetest.register_craftitem("chocolate:chocolate_bar", {
description = "Chocolate Bar",
inventory_image = "chocolate_chocolate_bar_new.png",
on_use = minetest.item_eat(0, "chocolate:chocolate_bar_8")
})
--Recipes
minetest.register_craft({
output = "chocolate:chocolate_bar",
recipe = {
{"chocolate:cocoa", "chocolate:cocoa"},
{"chocolate:cocoa", "chocolate:cocoa"}
}
})
minetest.register_craft({
type = "shapeless",
output = "chocolate:chocolate_bar_2",
recipe = {"chocolate:chocolate_bar_1", "chocolate:chocolate_bar_1"}
})
minetest.register_craft({
type = "shapeless",
output = "chocolate:chocolate_bar_3",
recipe = {"chocolate:chocolate_bar_1", "chocolate:chocolate_bar_2"}
})
minetest.register_craft({
type = "shapeless",
output = "chocolate:chocolate_bar_4",
recipe = {"chocolate:chocolate_bar_1", "chocolate:chocolate_bar_3"}
})
minetest.register_craft({
type = "shapeless",
output = "chocolate:chocolate_bar_5",
recipe = {"chocolate:chocolate_bar_1", "chocolate:chocolate_bar_4"}
})
minetest.register_craft({
type = "shapeless",
output = "chocolate:chocolate_bar_6",
recipe = {"chocolate:chocolate_bar_1", "chocolate:chocolate_bar_5"}
})
minetest.register_craft({
type = "shapeless",
output = "chocolate:chocolate_bar_7",
recipe = {"chocolate:chocolate_bar_1", "chocolate:chocolate_bar_6"}
})
minetest.register_craft({
type = "shapeless",
output = "chocolate:chocolate_bar_8",
recipe = {"chocolate:chocolate_bar_1", "chocolate:chocolate_bar_7"}
})
minetest.register_craft({
type = "shapeless",
output = "chocolate:chocolate_bar_4",
recipe = {"chocolate:chocolate_bar_2", "chocolate:chocolate_bar_2"}
})
minetest.register_craft({
type = "shapeless",
output = "chocolate:chocolate_bar_5",
recipe = {"chocolate:chocolate_bar_2", "chocolate:chocolate_bar_3"}
})
minetest.register_craft({
type = "shapeless",
output = "chocolate:chocolate_bar_6",
recipe = {"chocolate:chocolate_bar_2", "chocolate:chocolate_bar_4"}
})
minetest.register_craft({
type = "shapeless",
output = "chocolate:chocolate_bar_7",
recipe = {"chocolate:chocolate_bar_2", "chocolate:chocolate_bar_5"}
})
minetest.register_craft({
type = "shapeless",
output = "chocolate:chocolate_bar_8",
recipe = {"chocolate:chocolate_bar_2", "chocolate:chocolate_bar_6"}
})
minetest.register_craft({
type = "shapeless",
output = "chocolate:chocolate_bar_6",
recipe = {"chocolate:chocolate_bar_3", "chocolate:chocolate_bar_3"}
})
minetest.register_craft({
type = "shapeless",
output = "chocolate:chocolate_bar_7",
recipe = {"chocolate:chocolate_bar_3", "chocolate:chocolate_bar_4"}
})
minetest.register_craft({
type = "shapeless",
output = "chocolate:chocolate_bar_8",
recipe = {"chocolate:chocolate_bar_3", "chocolate:chocolate_bar_5"}
})
minetest.register_craft({
type = "shapeless",
output = "chocolate:chocolate_bar_8",
recipe = {"chocolate:chocolate_bar_4", "chocolate:chocolate_bar_4"}
})

View File

@ -0,0 +1,102 @@
minetest.register_node("chocolate:cocoa_plant", {
description = "Cocoa Seed",
drawtype = "plantlike",
tiles = {"chocolate_cocoa_stalk.png"},
inventory_image = "chocolate_cocoa_seeds.png",
sunlight_propogates = true,
walkable = false,
-- waving = 1,
paramtype = "light",
drop = "chocolate:cocoa_plant",
groups = {snappy = 3, flora = 1, flammable = 2, plant = 1},
on_place = function(itemstack, placer, pointed_thing)
pos = minetest.get_pointed_thing_position(pointed_thing, true)
node = minetest.get_node({x = pos.x, y = pos.y-1, z = pos.z})
if node.name == "default:dirt_with_grass"
or node.name == "farming:soil_wet" then
minetest.item_place(itemstack, placer, pointed_thing)
end
return itemstack
end,
on_destruct = function(pos)
print("destruction")
if minetest.get_node({x = pos.x, y = pos.y+1, z = pos.z}).name == "chocolate:cocoa_plant"
or minetest.get_node({x = pos.x, y = pos.y+1, z = pos.z}).name == "chocolate:cocoa_plant_top"
or minetest.get_node({x = pos.x, y = pos.y+1, z = pos.z}).name == "chocolate:cocoa_plant_top_grown" then
minetest.dig_node({x = pos.x, y = pos.y+1, z = pos.z})
end
if minetest.get_node({x = pos.x, y = pos.y+2, z = pos.z}).name == "chocolate:cocoa_plant"
or minetest.get_node({x = pos.x, y = pos.y+2, z = pos.z}).name == "chocolate:cocoa_plant_top"
or minetest.get_node({x = pos.x, y = pos.y+2, z = pos.z}).name == "chocolate:cocoa_plant_top_grown" then
minetest.dig_node({x = pos.x, y = pos.y+2, z = pos.z})
end
if minetest.get_node({x = pos.x, y = pos.y+3, z = pos.z}).name == "chocolate:cocoa_plant"
or minetest.get_node({x = pos.x, y = pos.y+3, z = pos.z}).name == "chocolate:cocoa_plant_top"
or minetest.get_node({x = pos.x, y = pos.y+3, z = pos.z}).name == "chocolate:cocoa_plant_top_grown" then
minetest.dig_node({x = pos.x, y = pos.y+3, z = pos.z})
end
end
})
minetest.register_node("chocolate:cocoa_plant_top", {
description = "Cocoa Head",
drawtype = "plantlike",
tiles = {"chocolate_cocoa_head.png"},
sunlight_propogates = true,
walkable = false,
waving = 1,
paramtype = "light",
drop = "chocolate:cocoa_plant",
groups = {snappy = 3, flora = 1, flammable = 2, plant = 1, not_in_creative_inventory = 1}
})
minetest.register_node("chocolate:cocoa_plant_top_grown", {
description = "Cocoa Head",
drawtype = "plantlike",
tiles = {"chocolate_cocoa_head_grown.png"},
sunlight_propogates = true,
walkable = false,
waving = 1,
paramtype = "light",
drop = "chocolate:cocoa_plant",
on_punch = function(pos, node, player, pointed_thing)
n = math.floor(1 + (math.random()*3.4))
player:get_inventory():add_item("main", ("chocolate:cocoa " .. n))
minetest.set_node({x = pos.x, y = pos.y, z = pos.z}, {name = "chocolate:cocoa_plant_top"})
end,
groups = {snappy = 3, flora = 1, flammable = 2, plant = 1, not_in_creative_inventory = 1}
})
minetest.register_abm({
nodenames = {"chocolate:cocoa_plant"},
interval = 60,
chance = 8,
action = function(pos, node, active_object_count, active_object_count_wider)
if (minetest.get_node({ x = pos.x, y = pos.y-1, z = pos.z}).name ~= "chocolate:cocoa_plant"
or minetest.get_node({ x = pos.x, y = pos.y-2, z = pos.z}).name ~= "chocolate:cocoa_plant")
and minetest.get_node({ x = pos.x, y = pos.y+1, z = pos.z}).name == "air" then
minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z}, {name = "chocolate:cocoa_plant"})
elseif minetest.get_node({ x = pos.x, y = pos.y-3, z = pos.z}).name ~= "chocolate.cocoa_plant"
and minetest.get_node({x = pos.x, y = pos.y+1, z = pos.z}).name == "air" then
minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z}, {name = "chocolate:cocoa_plant_top"})
end
end
})
minetest.register_abm({
nodenames = {"chocolate:cocoa_plant_top"},
interval = 60,
chance = 8,
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.set_node(pos, {name = "chocolate:cocoa_plant_top_grown"})
end
})
minetest.register_craftitem("chocolate:cocoa", {
description = "Cocoa",
inventory_image = "chocolate_cocoa.png"
})

View File

@ -0,0 +1 @@
default

View File

@ -0,0 +1,17 @@
print("Hello, world! I am from chocolate init.lua!");
dofile(minetest.get_modpath("chocolate") .. "/cocoa.lua")
dofile(minetest.get_modpath("chocolate") .. "/chocolate.lua")
minetest.register_node("chocolate:testblock", {
description = "Testy",
tiles = {
"chocolate_cocoa_head_grown.png",
"chocolate_cocoa_head.png",
"chocolate_cocoa_stalk.png",
"chocolate_cocoa_stalk.png",
"chocolate_cocoa_stalk.png",
"chocolate_cocoa_stalk.png"
},
groups = {cracky = 1}
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 471 B

View File

@ -0,0 +1,6 @@
{
"name": "@aurailus:free_stuff",
"description": "Minetest shim for Zepha~",
"version": "0.0.1",
"depends": ["minetest:chocolate", "minetest:zythias_lantern"]
}

View File

@ -0,0 +1,21 @@
if zepha.server then
zepha.bind("new_player", function(player)
local main = player:get_inventory():get_list("main")
local hw = player:get_inventory():get_list("hot_wheel_2")
main:add_stack({"minetest:chocolate:cocoa", 1})
hw:add_stack({"minetest:chocolate:cocoa_plant", 5})
hw:add_stack({"minetest:chocolate:cocoa_plant_top", 5})
hw:add_stack({"minetest:chocolate:cocoa_plant_top_grown", 5})
hw:add_stack({"minetest:chocolate:testblock", 5})
-- hw:add_stack({"minetest:lantern:lantern", 5})
-- hw:add_stack({"minetest:lantern:airlight", 1})
for i = 1, 8 do
main:add_stack({"minetest:chocolate:chocolate_bar_" .. i, 1})
end
main:add_stack({"minetest:chocolate:chocolate_bar", 1})
end)
end

View File

@ -0,0 +1,6 @@
{
"name": "zeus:default",
"description": "Default mod for the Zeus subgame.",
"version": "0.0.1",
"depends": ["zeus:materials", "@aurailus:basictools", "@aurailus:crafting"]
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,12 @@
runfile(_PATH .. "bush_stem")
runfile(_PATH .. "cobblestone")
runfile(_PATH .. "dirt")
runfile(_PATH .. "grass")
runfile(_PATH .. "leaves")
runfile(_PATH .. "sand")
runfile(_PATH .. "sandstone")
runfile(_PATH .. "stone")
runfile(_PATH .. "tallgrass")
runfile(_PATH .. "water")
runfile(_PATH .. "wood")
runfile(_PATH .. "light")

View File

@ -0,0 +1,19 @@
zepha.register_block(":bush_stem", {
name = "Bush Stem",
culls = false,
model = "base:cross_large",
textures = { "zeus:default:bush_stem" },
far_render = false,
tool_props = {
health = 5,
multipliers = {
snap = 1.5,
grab = 1.0,
_other = 0.5
}
},
yields = "zeus:materials:stick"
})

View File

@ -0,0 +1,17 @@
zepha.register_block(":cobblestone", {
name = "Cobblestone",
model = "base:block",
textures = { "zeus:default:cobblestone" },
tool_props = {
health = 25,
multipliers = {
crack = 1.8,
smash = 2.0,
_other = 0.25
}
},
yields = "zeus:default:cobblestone"
})

View File

@ -0,0 +1,19 @@
zepha.register_block(":dirt", {
name = "Dirt",
model = "base:block",
textures = { "zeus:default:dirt" },
tool_props = {
health = 25,
multipliers = {
scoop = 2.0,
smash = 0,
}
},
yields = "zeus:default:dirt",
on_interact = function(dim, pos) dim:set_block(pos, "zeus:default:grass") end,
on_interact_client = function(dim, pos) dim:set_block(pos, "zeus:default:grass") end
})

View File

@ -0,0 +1,56 @@
zepha.register_block(":grass", {
name = "Grass",
model = "base:block_foliage",
textures = {
"tint(0, zeus:default:grass_top)",
"zeus:default:dirt",
"tint(0, zeus:default:grass_side_under, zeus:default:grass_side_under_mask)",
"tint(0, zeus:default:grass_floating)",
},
far_textures = {
"tint(0, zeus:default:grass_top)",
"zeus:default:dirt",
"tint(0, zeus:default:grass_side_ld, zeus:default:grass_side_ld_mask)"
},
tool_props = {
health = 25,
multipliers = {
scoop = 2.0,
smash = 0,
}
},
yields = function()
if math.random() >= 0.5 then return "zeus:default:dirt"
else return "zeus:materials:plant_fibre" end
end
})
-- zepha.register_block("zeus:default:grass_slab", {
-- name = "Grass Slab",
-- model = "base:block_slab_foliage",
-- textures = {
-- "tint(0, zeus:default:grass_top)",
-- "zeus:default:dirt",
-- "tint(0, zeus:default:grass_top)",
-- "tint(0, zeus:default:grass_top)",
-- "tint(0, zeus:default:grass_top)",
-- "tint(0, zeus:default:grass_top)",
-- "tint(0, zeus:default:grass_floating)",
-- },
-- culls = false,
-- toughness = {
-- hand = 3,
-- shovel = 1,
-- pick = 2
-- },
-- selection_box = {
-- {0, 0, 0, 1, 0.5, 1}
-- },
-- collision_box = {
-- {0, 0, 0, 1, 0.5, 1}
-- },
-- yields = "zeus:default:grass_slab"
-- })

View File

@ -0,0 +1,25 @@
zepha.register_block(":leaves", {
name = "Leaves",
culls = false,
model = "base:leaf_like",
textures = {
"tint(0, zeus:default:leaves)",
"tint(0, zeus:default:leaves_puff)"
},
far_textures = {
"tint(0, zeus:default:leaves_opaque)",
},
tool_props = {
health = 5,
multipliers = {
snap = 2.0,
cut = 2.0
}
},
light_propagates = true,
yields = "zeus:materials:stick"
})

View File

@ -0,0 +1,132 @@
-- zepha.register_block("zeus:default:light_light", {
-- name = "Light",
-- model = "base:block",
-- textures = {"zeus:default:light_blue"},
-- toughness = {
-- hand = 3,
-- shovel = 1,
-- pick = 2
-- },
-- yields = "zeus:default:light_light",
-- light_source = {10, 20, 31}
-- })
-- local light_types = {
-- V{0, 0, 31},
-- V{0, 31, 31},
-- V{0, 31, 0},
-- V{31, 31, 0},
-- V{31, 16, 0},
-- V{31, 0, 0},
-- V{31, 0, 31}
-- }
--
-- for n, c in pairs(light_types) do
-- local target = 1
--
-- zepha.register_block("zeus:default:light_" .. tostring(n), {
-- name = "Rainbow Light",
-- model = "base:block",
-- textures = {"zeus:default:light_blue"},
-- light_source = c / 2,
-- on_place_client = function(pos)
-- zepha.after(function()
-- target = target + 1
-- if target == 8 then target = 1 end
-- zepha.set_block(pos, "zeus:default:light_" .. tostring(target))
-- return true
-- end, 0.15)
-- end
-- })
-- end
zepha.register_block("zeus:default:light_blue", {
name = "Blue Light",
model = "base:block",
textures = {"zeus:default:light_blue"},
toughness = {
hand = 3,
shovel = 1,
pick = 2
},
yields = "zeus:default:light_blue",
light_source = {0, 0, 31}
})
zepha.register_block("zeus:default:light_teal", {
name = "Teal Light",
model = "base:block",
textures = {"zeus:default:light_blue"},
toughness = {
hand = 3,
shovel = 1,
pick = 2
},
yields = "zeus:default:light_teal",
light_source = {0, 31, 31}
})
zepha.register_block("zeus:default:light_green", {
name = "Green Light",
model = "base:block",
textures = {"zeus:default:light_green"},
toughness = {
hand = 3,
shovel = 1,
pick = 2
},
yields = "zeus:default:light_green",
light_source = {0, 31, 0}
})
zepha.register_block("zeus:default:light_yellow", {
name = "Yellow Light",
model = "base:block",
textures = {"zeus:default:light_green"},
toughness = {
hand = 3,
shovel = 1,
pick = 2
},
yields = "zeus:default:light_yellow",
light_source = {31, 31, 0}
})
zepha.register_block("zeus:default:light_orange", {
name = "Orange Light",
model = "base:block",
textures = {"zeus:default:light_red"},
toughness = {
hand = 3,
shovel = 1,
pick = 2
},
yields = "zeus:default:light_orange",
light_source = {31, 16, 0}
})
zepha.register_block("zeus:default:light_red", {
name = "Red Light",
model = "base:block",
textures = {"zeus:default:light_red"},
toughness = {
hand = 3,
shovel = 1,
pick = 2
},
yields = "zeus:default:light_red",
light_source = {31, 0, 0}
})
zepha.register_block("zeus:default:light_purple", {
name = "Purple Light",
model = "base:block",
textures = {"zeus:default:light_red"},
toughness = {
hand = 3,
shovel = 1,
pick = 2
},
yields = "zeus:default:light",
light_source = {31, 0, 31}
})

View File

@ -0,0 +1,16 @@
zepha.register_block(":sand", {
name = "Sand",
model = "base:block",
textures = { "zeus:default:sand" },
tool_props = {
health = 8,
multipliers = {
scoop = 2.0,
smash = 0
}
},
yields = "zeus:default:sand"
})

View File

@ -0,0 +1,21 @@
zepha.register_block(":sandstone", {
name = "Sandstone",
model = "base:block",
textures = {
"zeus:default:sandstone_top",
"zeus:default:sandstone_top",
"zeus:default:sandstone"
},
tool_props = {
health = 20,
multipliers = {
crack = 1.8,
smash = 2.0,
_other = 0.25
}
},
yields = "zeus:default:sand"
})

View File

@ -0,0 +1,20 @@
zepha.register_block(":stone", {
name = "Stone",
model = "base:block",
textures = {"zeus:default:stone"},
tool_props = {
health = 35,
multipliers = {
crack = 1.8,
smash = 1.0,
_other = 0
}
},
yields = function()
if math.random() >= 0.5 then return "zeus:default:cobblestone"
else return "zeus:materials:rock" end
end
})

View File

@ -0,0 +1,28 @@
for i = 1, 5, 1 do
zepha.register_block(":tall_grass_" .. i, {
name = "Tall Grass",
culls = false,
solid = false,
model = "base:cross_plant",
textures = { "tint(0, zeus:default:tallgrass_"..i..")" },
far_render = false,
selection_box = {{1/16, 0, 1/16, 15/16, 0.30 + i * 0.1, 15/16}},
tool_props = {
health = 5,
multipliers = {
snap = 1.8,
grab = 1.2,
_other = 0.35
}
},
light_propagates = true,
yields = function(pos)
if math.random() > 0.8 then return "zeus:materials:plant_fibre" end
end
})
end

View File

@ -0,0 +1,5 @@
zepha.register_block(":water", {
name = "Water",
model = "base:block",
textures = {"zeus:default:water"}
})

View File

@ -0,0 +1,22 @@
zepha.register_block(":wood", {
name = "Log",
model = "base:block",
textures = {
"zeus:default:oak_log_top",
"zeus:default:oak_log_top",
"zeus:default:oak_log_side"
},
tool_props = {
health = 30,
multipliers = {
chop = 2.0,
crack = 1.7,
grab = 0,
_other = 0.5
}
},
yields = "zeus:default:wood"
})

View File

@ -0,0 +1,4 @@
runfile(_PATH .. "rabbit")
runfile(_PATH .. "raven")
runfile(_PATH .. "bee")
runfile(_PATH .. "test")

View File

@ -0,0 +1,25 @@
zepha.register_entity("zeus:default:bee", {
display = "model",
display_object = "zeus:default:bee",
display_texture = "zeus:default:bee_shiny",
on_create = function(self)
self.object.scale = 1/12
self.object.anims:define({
fly = {1, 45}
})
self.object.anims:set_anim("fly"):play()
end,
on_update = function(self, delta)
self.object.pos = self.object.pos +
V(0.03 * math.sin(math.rad(self.object.yaw + 90)), 0, 0.03 * math.cos(math.rad(self.object.yaw + 90)))
self.object.yaw = self.object.yaw + 2
end
})
zepha.register_keybind("zeus:default:spawn_bee", {
description = "Spawn Bee",
default = zepha.keys.b,
on_press = function() zepha.player.dim:add_entity(zepha.player.pos + V(0, 1.7, 0), "zeus:default:bee") end
})

Some files were not shown because too many files have changed in this diff Show More