Added Vector functionality, remove venus parser, add new blocks.
- Add colored lights to default for testing - Add vector divide function - Remove Venus Parsermaster
parent
41bb678eec
commit
d38b81705f
|
@ -46,6 +46,9 @@ local vector_mt = {
|
|||
__mul = function(tbl, o)
|
||||
return vector.multiply(tbl, o)
|
||||
end,
|
||||
__div = function(tbl, o)
|
||||
return vector.divide(tbl, o)
|
||||
end,
|
||||
__pow = function(tbl, power)
|
||||
return vector.pow(tbl, o)
|
||||
end,
|
||||
|
@ -145,6 +148,17 @@ vector.multiply = function(v1, m)
|
|||
end
|
||||
end
|
||||
|
||||
-- vector.divide
|
||||
-- Divice v1 by a vector or number
|
||||
vector.divide = function(v1, m)
|
||||
if not check_vector(v1) then return end
|
||||
if check_vector(m) then
|
||||
return create_vector(rawget(v1, 1) / rawget(m, 1), rawget(v1, 2) / rawget(m, 2), rawget(v1, 3) / rawget(m, 3))
|
||||
elseif type(m) == "number" then
|
||||
return create_vector(rawget(v1, 1) / m, rawget(v1, 2) / m, rawget(v1, 3) / m)
|
||||
end
|
||||
end
|
||||
|
||||
-- vector.pow
|
||||
-- Return v to the power of p
|
||||
vector.pow = function(v, m)
|
||||
|
|
|
@ -289,10 +289,8 @@ set(ZEPHA_SRC
|
|||
lua/api/class/LocalLuaAnimationManager.h
|
||||
lua/api/usertype/cAnimationManager.h
|
||||
game/scene/world/Schematic.cpp
|
||||
game/scene/world/Schematic.h
|
||||
lua/VenusParser.cpp
|
||||
lua/VenusParser.h
|
||||
lua/ErrorFormatter.cpp
|
||||
game/scene/world/Schematic.h
|
||||
lua/ErrorFormatter.cpp
|
||||
lua/ErrorFormatter.h
|
||||
util/RIE.h
|
||||
lua/api/class/ServerLuaPlayer.cpp
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
//
|
||||
// Created by aurailus on 2020-02-09.
|
||||
//
|
||||
|
||||
#include "VenusParser.h"
|
||||
#include "ErrorFormatter.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace {
|
||||
#ifdef _WIN32
|
||||
const static char* EXECUTABLE_NAME = "zepha-venus-win.exe";
|
||||
#else
|
||||
const static char* EXECUTABLE_NAME = "zepha-venus-linux";
|
||||
#define _popen popen
|
||||
#define _pclose pclose
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string VenusParser::parse(const std::string& fileName, const std::string& fileContents) {
|
||||
#ifdef _WIN32
|
||||
const static std::string path = "zepha-venus\\" + std::string(EXECUTABLE_NAME);
|
||||
#else
|
||||
const static std::string path = "../zepha-venus/" + std::string(EXECUTABLE_NAME);
|
||||
#endif
|
||||
|
||||
const static bool exists = cf_file_exists(path.data());
|
||||
if (!exists) throw std::runtime_error("Trying to compile a venus file when zepha-venus has not been built!");
|
||||
|
||||
std::unique_ptr<FILE, decltype(&_pclose)> pipe(_popen((path + " " + fileName).data(), "r"), _pclose);
|
||||
if (!pipe) throw std::runtime_error("popen() failed!");
|
||||
|
||||
std::string result;
|
||||
std::array<char, 1024> buffer;
|
||||
while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) result += buffer.data();
|
||||
|
||||
const static std::string errorHeader = "--ZEPHA_PARSING_ERROR--";
|
||||
if (result.length() < errorHeader.length() || result.substr(0, errorHeader.length()) != errorHeader) return result;
|
||||
|
||||
// There was an error in the node app, this is it:
|
||||
std::string error = result.substr(errorHeader.length() + 1, result.length() - errorHeader.length() - 1);
|
||||
|
||||
std::string::size_type lineNumStart = error.find('[');
|
||||
assert(lineNumStart != std::string::npos);
|
||||
std::string::size_type lineNumEnd = error.find_first_of(":]", lineNumStart + 1);
|
||||
assert(lineNumEnd != std::string::npos);
|
||||
|
||||
int lineNum = std::stoi(error.substr(lineNumStart + 1, lineNumEnd - lineNumStart - 1));
|
||||
|
||||
throw std::runtime_error(ErrorFormatter::formatError(fileName, lineNum,
|
||||
"Encountered an error compiling " + fileName + ": \n" + error, fileContents).data());
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
//
|
||||
// Created by aurailus on 2020-02-09.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <cute_files/cute_files.h>
|
||||
|
||||
class VenusParser {
|
||||
public:
|
||||
static std::string parse(const std::string& fileName, const std::string& fileContents);
|
||||
};
|
|
@ -6,7 +6,6 @@
|
|||
#include <json/json.hpp>
|
||||
#include <gzip/compress.hpp>
|
||||
|
||||
#include "../VenusParser.h"
|
||||
#include "../../def/ServerGame.h"
|
||||
#include "../../util/net/Serializer.h"
|
||||
|
||||
|
@ -108,15 +107,11 @@ std::vector<LuaMod> ServerModHandler::initializeLuaMods(const std::list<std::str
|
|||
if (scannedFile.is_dir) dirsToScan.emplace_back(scannedFile.path);
|
||||
else {
|
||||
char *dot = strrchr(scannedFile.path, '.');
|
||||
if (dot && (strncmp(dot, ".lua", 4) == 0 || strncmp(dot, ".venus", 6) == 0)) {
|
||||
luaFiles.emplace_back(scannedFile.path);
|
||||
}
|
||||
if (dot && (strncmp(dot, ".lua", 4) == 0)) luaFiles.emplace_back(scannedFile.path);
|
||||
}
|
||||
}
|
||||
|
||||
cf_dir_next(&dir);
|
||||
}
|
||||
|
||||
cf_dir_close(&dir);
|
||||
}
|
||||
|
||||
|
@ -151,28 +146,13 @@ std::vector<LuaMod> ServerModHandler::initializeLuaMods(const std::list<std::str
|
|||
|
||||
modPath.erase(rootPos, root.length());
|
||||
modPath.insert(0, conf.name);
|
||||
|
||||
const static std::string venusSubstr = ".venus";
|
||||
if (std::equal(venusSubstr.rbegin(), venusSubstr.rend(), file.rbegin())) {
|
||||
modPath.resize(modPath.size() - 6);
|
||||
|
||||
try {
|
||||
fileStr = VenusParser::parse(file, fileStr);
|
||||
}
|
||||
catch (const std::runtime_error& e) {
|
||||
std::cout << Log::err << "Encountered a venus compilation err" << std::endl << e.what() << Log::endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else modPath.resize(modPath.size() - 4);
|
||||
modPath.resize(modPath.size() - 4);
|
||||
|
||||
LuaModFile f {modPath, fileStr};
|
||||
mod.files.push_back(f);
|
||||
}
|
||||
|
||||
mods.push_back(mod);
|
||||
}
|
||||
|
||||
return mods;
|
||||
}
|
||||
|
||||
|
|
|
@ -157,8 +157,8 @@ void Dimension::calculateHorizontalEdge(std::shared_ptr<BlockChunk> a, std::shar
|
|||
auto lightA = a->getSunlight(Space::Block::index(aPos));
|
||||
auto lightB = b->getSunlight(Space::Block::index(bPos));
|
||||
|
||||
if (lightA > lightB + 1) setSunlight(b->pos * 16 + bPos, lightA - 1);
|
||||
else if (lightB > lightA + 1) setSunlight(a->pos * 16 + aPos, lightB - 1);
|
||||
if (lightA > lightB + 1) setAndReflowSunlight(b->pos * 16 + bPos, lightA - 1);
|
||||
else if (lightB > lightA + 1) setAndReflowSunlight(a->pos * 16 + aPos, lightB - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ void Dimension::removeSunlight(glm::ivec3 pos) {
|
|||
lightRemoveQueue[SUNLIGHT_CHANNEL].emplace(ind, light, chunk.get());
|
||||
}
|
||||
|
||||
void Dimension::setSunlight(glm::ivec3 pos, unsigned char level) {
|
||||
void Dimension::setAndReflowSunlight(glm::ivec3 pos, unsigned char level) {
|
||||
auto chunk = getChunk(Space::Chunk::world::fromBlock(pos));
|
||||
unsigned int ind = Space::Block::index(pos);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ private:
|
|||
|
||||
inline void reflowLight(glm::ivec3 pos);
|
||||
inline void removeSunlight(glm::ivec3 pos);
|
||||
inline void setSunlight(glm::ivec3 pos, unsigned char level);
|
||||
inline void setAndReflowSunlight(glm::ivec3 pos, unsigned char level);
|
||||
|
||||
struct LightAddNode {
|
||||
LightAddNode(unsigned short index, BlockChunk* chunk) : index(index), chunk(chunk) {};
|
||||
|
|
|
@ -2,59 +2,59 @@ _G["crafting"] = {}
|
|||
|
||||
crafting.registered_recipes = {}
|
||||
|
||||
crafting.register_recipe = fn(tbl) {
|
||||
crafting.register_recipe = function(tbl)
|
||||
table.insert(crafting.registered_recipes, tbl)
|
||||
}
|
||||
end
|
||||
|
||||
crafting.bind = fn(craft_input, craft_output) {
|
||||
crafting.bind = function(craft_input, craft_output)
|
||||
local width = craft_input.width
|
||||
local length = craft_input.length
|
||||
|
||||
local crafting_changed = fn() {
|
||||
local crafting_changed = function()
|
||||
local items = {}
|
||||
|
||||
local matched_any = false
|
||||
foreach r in crafting.registered_recipes {
|
||||
for _,r in crafting.registered_recipes do
|
||||
local matches = true
|
||||
for i = 1, length {
|
||||
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])) {
|
||||
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) {
|
||||
if recipe_item_name ~= craft_input:get_stack(i).name then
|
||||
matches = false
|
||||
break
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
if (matches) {
|
||||
if matches then
|
||||
craft_output:set_stack(1, {r.output, 1})
|
||||
matched_any = true
|
||||
break
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
if (not matched_any) {
|
||||
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 = fn() {
|
||||
craft_output.allow_put = function()
|
||||
return 0
|
||||
}
|
||||
end
|
||||
|
||||
craft_output.on_take = fn() {
|
||||
for i = 1, length {
|
||||
craft_output.on_take = function()
|
||||
for i = 1, length do
|
||||
craft_input:remove_stack(i, 1)
|
||||
}
|
||||
end
|
||||
crafting_changed()
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
|
@ -0,0 +1,94 @@
|
|||
local function collides(entity)
|
||||
return zepha.get_block(entity.pos + V{0, 0.5, 0}) ~= "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 vector.distance(p.pos, self.object.pos) < 2 then
|
||||
self.object.pos = p.pos + V{0, 0.90, 0}
|
||||
self.scooping = true
|
||||
|
||||
zepha.delay(function()
|
||||
p:get_inventory():get_list("main"):add_stack({self.item, 1})
|
||||
zepha.remove_entity(self)
|
||||
end, 2/20)
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_serialize = function(self)
|
||||
return {
|
||||
vel = self.vel,
|
||||
time = self.time,
|
||||
speed = self.speed
|
||||
}
|
||||
end
|
||||
})
|
|
@ -1,105 +0,0 @@
|
|||
local fn collides(entity) {
|
||||
return zepha.get_block({
|
||||
x = math.floor(entity.pos.x),
|
||||
y = math.floor(entity.pos.y - 0.5),
|
||||
z = math.floor(entity.pos.z)}) ~= "air"
|
||||
}
|
||||
|
||||
zepha.register_entity("@aurailus:item_collection:dropped_item", {
|
||||
display = "gameobject",
|
||||
display_object = "invalid",
|
||||
|
||||
on_create = fn(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]) {
|
||||
self.object.scale = 1/2
|
||||
}
|
||||
else {
|
||||
self.object.scale = 1/3
|
||||
}
|
||||
},
|
||||
on_update = fn(self, delta) {
|
||||
self.object.yaw += self.speed
|
||||
if (self.speed > 1) {
|
||||
self.speed *= 0.92
|
||||
}
|
||||
|
||||
self.tick += delta
|
||||
|
||||
if (self.time > 5 * 60) {
|
||||
zepha.remove_entity(self)
|
||||
return
|
||||
}
|
||||
|
||||
if (self.scooping) { return }
|
||||
|
||||
if (not collides(self.object)) {
|
||||
self.vel.y = math.min(self.vel.y + 300 * delta, 480)
|
||||
}
|
||||
|
||||
local iter = 1
|
||||
while (not collides(self.object) and iter <= math.abs(self.vel.y * delta)) {
|
||||
local interval = 1/16
|
||||
if (self.vel.y > 0) {
|
||||
interval = -1/16
|
||||
}
|
||||
|
||||
self.object.pos += V(0, interval, 0)
|
||||
iter += 0.25
|
||||
}
|
||||
|
||||
self.object.pos += V(self.vel.x, 0, self.vel.z) * delta
|
||||
self.vel.x *= 0.6
|
||||
self.vel.z *= 0.6
|
||||
|
||||
self.object.visual_offset = V(0, math.sin(self.time * 2) / 8, 0)
|
||||
|
||||
if (collides(self.object)) {
|
||||
self.vel.y = 0
|
||||
self.time += delta
|
||||
}
|
||||
|
||||
if (self.tick > 0.15) {
|
||||
self.tick = 0
|
||||
self:check_collect()
|
||||
}
|
||||
},
|
||||
check_collect = fn(self) {
|
||||
foreach p in zepha.players {
|
||||
if (vector.distance(p.pos, self.object.pos) < 2) {
|
||||
self.object.pos = p.pos + V(0, 0.90, 0)
|
||||
self.scooping = true
|
||||
|
||||
zepha.delay(() => {
|
||||
p:get_inventory():get_list("main"):add_stack({self.item, 1})
|
||||
zepha.remove_entity(self)
|
||||
}, 2/20)
|
||||
}
|
||||
}
|
||||
},
|
||||
on_serialize = fn(self) {
|
||||
return {
|
||||
vel = self.vel,
|
||||
time = self.time,
|
||||
speed = self.speed
|
||||
}
|
||||
}
|
||||
})
|
|
@ -0,0 +1,10 @@
|
|||
return function(pos)
|
||||
local def = zepha.registered_blocks[zepha.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
|
|
@ -1,10 +0,0 @@
|
|||
return fn(pos) {
|
||||
local def = zepha.registered_blocks[zepha.get_block(pos)]
|
||||
if (def == nil) { return nil }
|
||||
local yields = def.yields
|
||||
|
||||
if (type(yields) == "function") { yields = yields(pos) }
|
||||
if (yields == nil or type(yields) ~= "string") { return nil }
|
||||
|
||||
return yields
|
||||
}
|
|
@ -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
|
|
@ -1,9 +0,0 @@
|
|||
runfile("@aurailus:item_collection/dropped_item")
|
||||
|
||||
local DROP_ENTITY = true
|
||||
if (DROP_ENTITY) {
|
||||
runfile("@aurailus:item_collection/mode/entity")
|
||||
}
|
||||
else {
|
||||
runfile("@aurailus:item_collection/mode/direct")
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
local get_yield = runfile("@aurailus:item_collection/get_yield")
|
||||
|
||||
if (zepha.server) {
|
||||
zepha.register_on("break", (pos, player) => {
|
||||
if zepha.server then
|
||||
zepha.register_on("break", function(pos, player)
|
||||
local yields = get_yield(pos)
|
||||
if (yields == nil) { return }
|
||||
if yields == nil then return end
|
||||
|
||||
player:get_inventory():get_list("main"):add_stack({yields, 1})
|
||||
})
|
||||
}
|
||||
end)
|
||||
end
|
|
@ -1,10 +1,10 @@
|
|||
local get_yield = runfile("@aurailus:item_collection/get_yield")
|
||||
|
||||
if (zepha.server) {
|
||||
zepha.register_on("break", (pos) => {
|
||||
if zepha.server then
|
||||
zepha.register_on("break", function(pos)
|
||||
local yields = get_yield(pos)
|
||||
if (yields == nil) { return }
|
||||
if yields == nil then return end
|
||||
|
||||
zepha.add_entity("@aurailus:item_collection:dropped_item", pos + 0.5, { item = yields });
|
||||
})
|
||||
}
|
||||
end)
|
||||
end
|
|
@ -12,16 +12,16 @@ zepha.register_block("@aurailus:tnt:tnt", {
|
|||
pick = 2
|
||||
},
|
||||
drop = "@aurailus:tnt:tnt",
|
||||
on_break = fn(pos) {
|
||||
on_break = function(pos)
|
||||
local amp = 20
|
||||
for i = -amp, amp {
|
||||
for j = -amp, amp {
|
||||
for k = -amp, amp {
|
||||
if (V(i, j, k):distance(V()) < amp) {
|
||||
for i = -amp, amp do
|
||||
for j = -amp, amp do
|
||||
for k = -amp, amp do
|
||||
if V{i, j, k}:distance(V{}) < amp then
|
||||
zepha.set_block(pos + offset, "air")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
|
@ -17,14 +17,10 @@ zepha.register_block("zeus:default:grass", {
|
|||
shovel = 1,
|
||||
pick = 2
|
||||
},
|
||||
yields = fn() {
|
||||
if (math.random() >= 0.5) {
|
||||
return "zeus:default:dirt"
|
||||
}
|
||||
else {
|
||||
return "zeus:materials:plant_fibre"
|
||||
}
|
||||
}
|
||||
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", {
|
|
@ -1,12 +1,132 @@
|
|||
zepha.register_block("zeus:default:light", {
|
||||
name = "Lightbulb Lol",
|
||||
-- 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.delay(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"},
|
||||
textures = {"zeus:default:light_blue"},
|
||||
toughness = {
|
||||
hand = 3,
|
||||
shovel = 1,
|
||||
pick = 2
|
||||
},
|
||||
yields = "zeus:default:light",
|
||||
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}
|
||||
})
|
|
@ -6,12 +6,8 @@ zepha.register_block("zeus:default:stone", {
|
|||
hand = 14,
|
||||
pick = 3
|
||||
},
|
||||
yields = fn() {
|
||||
if (math.random() >= 0.5) {
|
||||
return "zeus:default:cobblestone"
|
||||
}
|
||||
else {
|
||||
return "zeus:materials:rock"
|
||||
}
|
||||
}
|
||||
yields = function()
|
||||
if math.random() >= 0.5 then return "zeus:default:cobblestone"
|
||||
else return "zeus:materials:rock" end
|
||||
end
|
||||
})
|
|
@ -1,4 +1,4 @@
|
|||
for i = 1, 5, 1 {
|
||||
for i = 1, 5, 1 do
|
||||
zepha.register_block("zeus:default:tallgrass_" .. i, {
|
||||
culls = false,
|
||||
solid = false,
|
||||
|
@ -14,10 +14,8 @@ for i = 1, 5, 1 {
|
|||
toughness = {
|
||||
hand = 0
|
||||
},
|
||||
yields = fn(pos) {
|
||||
if (math.random() > 0.8) {
|
||||
return "zeus:materials:plant_fibre"
|
||||
}
|
||||
}
|
||||
yields = function(pos)
|
||||
if math.random() > 0.8 then return "zeus:materials:plant_fibre" end
|
||||
end
|
||||
})
|
||||
}
|
||||
end
|
|
@ -3,26 +3,25 @@ zepha.register_entity("zeus:default:bee", {
|
|||
display_object = "zeus:default:bee",
|
||||
display_texture = "zeus:default:bee",
|
||||
|
||||
on_create = (self) => {
|
||||
on_create = function(self)
|
||||
self.object.scale = 1/12
|
||||
self.object.anims:define({
|
||||
fly = {1, 45}
|
||||
})
|
||||
|
||||
self.object.anims:set_anim("fly"):play()
|
||||
},
|
||||
|
||||
on_update = (self, delta) => {
|
||||
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 += 2
|
||||
}
|
||||
self.object.yaw = self.object.yaw + 2
|
||||
end
|
||||
})
|
||||
|
||||
zepha.register_keybind("zeus:default:spawn_bee", {
|
||||
description = "Spawn Bee",
|
||||
default = zepha.keys.b,
|
||||
on_press = () => {
|
||||
on_press = function()
|
||||
zepha.add_entity("zeus:default:bee", vector.add(zepha.player.pos, V(0, 1.7, 0)))
|
||||
}
|
||||
end
|
||||
})
|
|
@ -5,7 +5,7 @@ zepha.register_entity("zeus:default:rabbit", {
|
|||
display_object = "zeus:default:rabbit",
|
||||
display_texture = "zeus:default:rabbit",
|
||||
|
||||
on_create = fn(self) {
|
||||
on_create = function(self)
|
||||
self.object:set_scale(1/16)
|
||||
|
||||
self.object.anims:define({
|
||||
|
@ -16,58 +16,56 @@ zepha.register_entity("zeus:default:rabbit", {
|
|||
})
|
||||
|
||||
self.object.anims:set_anim("run"):play()
|
||||
},
|
||||
on_update = fn(self, delta) {
|
||||
end,
|
||||
on_update = function(self, delta)
|
||||
local dist = vector.distance(zepha.player.pos, self.object.pos)
|
||||
|
||||
if (friendly) {
|
||||
if (dist > 3 and dist < 7 and not self.targeting) {
|
||||
if friendly then
|
||||
if dist > 3 and dist < 7 and not self.targeting then
|
||||
self.targeting = true
|
||||
self.object.anims:set_anim("run"):play()
|
||||
elseif (dist < 2 or dist > 7 and self.targeting) {
|
||||
elseif dist < 2 or dist > 7 and self.targeting then
|
||||
self.targeting = false
|
||||
self.object.anims:set_anim("idle"):play()
|
||||
}
|
||||
end
|
||||
|
||||
if (self.targeting) {
|
||||
if self.targeting then
|
||||
self.object.pos = self.object.pos +
|
||||
V(0.08 * math.sin(math.rad(self.object.yaw)), 0, 0.08 * math.cos(math.rad(self.object.yaw)))
|
||||
self.object.yaw = math.deg(math.atan2(zepha.player.pos.x - self.object.pos.x, zepha.player.pos.z - self.object.pos.z))
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (dist < 5 and not self.targeting) {
|
||||
end
|
||||
else
|
||||
if dist < 5 and not self.targeting then
|
||||
self.targeting = true
|
||||
self.object.anims:set_anim("run"):play()
|
||||
elseif (dist > 6 and self.targeting) {
|
||||
elseif dist > 6 and self.targeting then
|
||||
self.targeting = false
|
||||
self.object.anims:set_anim("idle"):play()
|
||||
}
|
||||
end
|
||||
|
||||
if (self.targeting) {
|
||||
if self.targeting then
|
||||
self.object.pos = self.object.pos +
|
||||
V(0.08 * math.sin(math.rad(self.object.yaw)), 0, 0.08 * math.cos(math.rad(self.object.yaw)))
|
||||
self.object.yaw = math.deg(math.atan2(zepha.player.pos.x - self.object.pos.x, zepha.player.pos.z - self.object.pos.z)) + 180
|
||||
}
|
||||
else {
|
||||
else
|
||||
self.object.yaw = math.deg(math.atan2(zepha.player.pos.x - self.object.pos.x, zepha.player.pos.z - self.object.pos.z))
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
zepha.register_keybind("zeus:default:spawn_rabbit", {
|
||||
description = "Spawn Rabbit",
|
||||
default = zepha.keys.y,
|
||||
on_press = fn() {
|
||||
on_press = function()
|
||||
zepha.add_entity("zeus:default:rabbit", zepha.player.pos)
|
||||
}
|
||||
end
|
||||
})
|
||||
|
||||
zepha.register_keybind("zeus:default:change_rabbit_behavior", {
|
||||
description = "Change rabbit behavior",
|
||||
default = zepha.keys.u,
|
||||
on_press = fn() {
|
||||
on_press = function()
|
||||
friendly = not friendly
|
||||
}
|
||||
end
|
||||
})
|
|
@ -5,7 +5,7 @@ zepha.register_entity("zeus:default:raven", {
|
|||
display_object = "zeus:default:bird",
|
||||
display_texture = "zeus:default:raven",
|
||||
|
||||
on_create = fn(self) {
|
||||
on_create = function(self)
|
||||
self.object:set_scale(1/16)
|
||||
|
||||
self.object.anims:define({
|
||||
|
@ -15,37 +15,34 @@ zepha.register_entity("zeus:default:raven", {
|
|||
})
|
||||
|
||||
self.object.anims:set_anim("hover"):play()
|
||||
},
|
||||
on_update = fn(self, delta) {
|
||||
end,
|
||||
on_update = function(self, delta)
|
||||
local dist = vector.distance(zepha.player.pos, self.object.pos)
|
||||
|
||||
if (dist < 5 and not self.targeting) {
|
||||
if dist < 5 and not self.targeting then
|
||||
self.targeting = true
|
||||
self.object.anims:set_anim("fly"):play()
|
||||
elseif (dist > 6 and self.targeting) {
|
||||
elseif dist > 6 and self.targeting then
|
||||
self.targeting = false
|
||||
self.object.anims:set_anim("hover"):play()
|
||||
}
|
||||
end
|
||||
|
||||
if (self.targeting) {
|
||||
self.object.pos = V(
|
||||
if self.targeting then
|
||||
self.object.pos = V{
|
||||
self.object.pos.x + 0.08 * math.sin(math.rad(self.object.yaw)),
|
||||
self.object.pos.y,
|
||||
self.object.pos.z + 0.08 * math.cos(math.rad(self.object.yaw))
|
||||
)
|
||||
|
||||
self.object.pos.z + 0.08 * math.cos(math.rad(self.object.yaw))}
|
||||
self.object.yaw = math.deg(math.atan2(zepha.player.pos.x - self.object.pos.x, zepha.player.pos.z - self.object.pos.z)) + 180
|
||||
}
|
||||
else {
|
||||
else
|
||||
self.object.yaw = math.deg(math.atan2(zepha.player.pos.x - self.object.pos.x, zepha.player.pos.z - self.object.pos.z))
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
zepha.register_keybind("zeus:default:spawn_raven", {
|
||||
description = "Spawn Raven",
|
||||
default = zepha.keys.z,
|
||||
on_press = fn() {
|
||||
zepha.add_entity("zeus:default:raven", vector.add(zepha.player.pos, V(0, 1.7, 0)))
|
||||
}
|
||||
on_press = function()
|
||||
zepha.add_entity("zeus:default:raven", vector.add(zepha.player.pos, V{0, 1.7, 0}))
|
||||
end
|
||||
})
|
|
@ -3,20 +3,20 @@ zepha.register_entity("zeus:default:test", {
|
|||
display_object = "zeus:default:player",
|
||||
display_texture = "zeus:default:player",
|
||||
|
||||
on_create = fn(self) {
|
||||
on_create = function(self)
|
||||
self.object.anims:define({
|
||||
walk = {0, 300}
|
||||
})
|
||||
self.object.anims:set_anim("walk"):play()
|
||||
self.object.scale = 1/4
|
||||
},
|
||||
on_update = fn(self, delta) {
|
||||
## self.object.pos = self.object.pos +
|
||||
## V(0.6 * math.sin(math.rad(self.object.yaw)), 0, 0.6 * math.cos(math.rad(self.object.yaw))) * delta
|
||||
## self.object.yaw += 50 * delta
|
||||
}
|
||||
end,
|
||||
on_update = function(self, delta)
|
||||
-- self.object.pos = self.object.pos +
|
||||
-- V(0.6 * math.sin(math.rad(self.object.yaw)), 0, 0.6 * math.cos(math.rad(self.object.yaw))) * delta
|
||||
-- self.object.yaw += 50 * delta
|
||||
end
|
||||
})
|
||||
|
||||
if (zepha.client) {
|
||||
local entity = zepha.add_entity("zeus:default:test", V(0, 0, 0))
|
||||
}
|
||||
if zepha.client then
|
||||
local entity = zepha.add_entity("zeus:default:test", V{})
|
||||
end
|
|
@ -5,13 +5,13 @@ local chat_down = false
|
|||
zepha.register_keybind("zeus:default:open_chat", {
|
||||
description = "Open Chat",
|
||||
default = zepha.keys.t,
|
||||
on_press = () => { print "Opened chat!" }
|
||||
on_press = function() print "Opened chat!" end
|
||||
})
|
||||
|
||||
## Flying toggles
|
||||
local fn toggleFlying() {
|
||||
-- Flying toggles
|
||||
local function toggleFlying()
|
||||
zepha.player.flying = not zepha.player.flying
|
||||
}
|
||||
end
|
||||
|
||||
zepha.register_keybind("zeus:default:toggle_flying", {
|
||||
description = "Toggle Flying",
|
||||
|
@ -23,9 +23,9 @@ local last_press = -100
|
|||
zepha.register_keybind("zeus:default:double_jump_fly", {
|
||||
description = "Double Jump to Toggle Flying",
|
||||
default = zepha.keys.space,
|
||||
on_press = () => {
|
||||
on_press = function()
|
||||
local press = zepha.time.s();
|
||||
if (press - last_press < 0.25) { toggleFlying() }
|
||||
if press - last_press < 0.25 then toggleFlying() end
|
||||
last_press = press;
|
||||
}
|
||||
end
|
||||
})
|
Binary file not shown.
After Width: | Height: | Size: 263 B |
Binary file not shown.
After Width: | Height: | Size: 263 B |
Binary file not shown.
After Width: | Height: | Size: 338 B |
Binary file not shown.
After Width: | Height: | Size: 334 B |
Binary file not shown.
Before Width: | Height: | Size: 707 B After Width: | Height: | Size: 638 B |
|
@ -9,9 +9,9 @@ local flowers = {
|
|||
"yellow_dandelion"
|
||||
}
|
||||
|
||||
local tchelper = (first, rest) => { return first:upper()..rest:lower() }
|
||||
local tchelper = function(first, rest) return first:upper()..rest:lower() end
|
||||
|
||||
foreach flower in flowers {
|
||||
for _,flower in pairs(flowers) do
|
||||
local name = flower:gsub("_", " "):gsub("(%a)([%w_']*)", tchelper)
|
||||
|
||||
zepha.register_block("zeus:flowers:flower_" .. flower, {
|
||||
|
@ -30,4 +30,4 @@ foreach flower in flowers {
|
|||
hand = 0
|
||||
}
|
||||
})
|
||||
}
|
||||
end
|
|
@ -1,9 +1,9 @@
|
|||
## Register the inventory menu and keybind
|
||||
-- Register the inventory menu and keybind
|
||||
zepha.register_keybind("zeus:inventory:open_inventory", {
|
||||
description = "Open Inventory",
|
||||
default = zepha.keys.e,
|
||||
on_press = () => {
|
||||
if (zepha.player.menu_state == "") {
|
||||
on_press = function()
|
||||
if zepha.player.menu_state == "" do
|
||||
zepha.player:open_menu([[
|
||||
body[body]
|
||||
background: #0003
|
||||
|
@ -43,9 +43,6 @@ zepha.register_keybind("zeus:inventory:open_inventory", {
|
|||
end
|
||||
end
|
||||
]])
|
||||
}
|
||||
else {
|
||||
zepha.player:close_menu()
|
||||
}
|
||||
else zepha.player:close_menu() end
|
||||
}
|
||||
})
|
|
@ -0,0 +1,2 @@
|
|||
if zepha.server then runfile(_PATH .. "register") end
|
||||
if zepha.client then runfile(_PATH .. "menu") end
|
|
@ -1,2 +0,0 @@
|
|||
if (zepha.server) { runfile(_PATH .. "register") }
|
||||
if (zepha.client) { runfile(_PATH .. "menu") }
|
|
@ -1,15 +1,15 @@
|
|||
zepha.register_on("new_player", (p) => {
|
||||
## Create the main inventory list
|
||||
zepha.register_on("new_player", function(p)
|
||||
-- Create the main inventory list
|
||||
local inv = p:get_inventory()
|
||||
local main = inv:add_list("main", 44, 11)
|
||||
|
||||
## Bind crafting
|
||||
-- Bind crafting
|
||||
local craft_input = inv:add_list("craft", 4, 2)
|
||||
local craft_output = inv:add_list("craft_result", 2, 2)
|
||||
|
||||
crafting.bind(craft_input, craft_output)
|
||||
|
||||
## Get hot wheel
|
||||
-- Get hot wheel
|
||||
local invs = {
|
||||
inv:get_list("hot_wheel_1"),
|
||||
inv:get_list("hot_wheel_2"),
|
||||
|
@ -19,19 +19,21 @@ zepha.register_on("new_player", (p) => {
|
|||
inv:get_list("hot_wheel_6")
|
||||
}
|
||||
|
||||
invs[1]:add_stack({"zeus:default:light", 1})
|
||||
for name,_ in pairs(zepha.registered_blocks) do
|
||||
if name:sub(1, #"zeus:default:light") == "zeus:default:light" then
|
||||
main:add_stack({name, 1})
|
||||
end
|
||||
end
|
||||
|
||||
foreach inv in invs {
|
||||
inv.allow_take = fn() {
|
||||
return 0
|
||||
}
|
||||
for _,inv in pairs(invs) do
|
||||
inv.allow_take = function() return 0 end
|
||||
|
||||
inv.allow_put = fn(slot, item) {
|
||||
zepha.delay(() => {
|
||||
## This delay is necessary to avoid the engine overwriting it with nothing
|
||||
inv.allow_put = function(slot, item)
|
||||
zepha.delay(function()
|
||||
-- This delay is necessary to avoid the engine overwriting it with nothing
|
||||
inv:set_stack(slot, item)
|
||||
}, 0)
|
||||
end, 0)
|
||||
return 0
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -10,23 +10,23 @@ zepha.register_block('zeus:kinetic:axle_0', {
|
|||
{0, 6/16, 6/16, 1, 10/16, 10/16}
|
||||
},
|
||||
drop = "zeus:kinetic:axle_0",
|
||||
on_place = fn(pos) {
|
||||
for i = 0, 9 {
|
||||
on_place = function(pos)
|
||||
for i = 0, 9 do
|
||||
pos.x = pos.x + 1
|
||||
zepha.set_block(pos, "zeus:kinetic:axle_0")
|
||||
}
|
||||
},
|
||||
on_place_client = fn(pos) {
|
||||
for i = 0, 9 {
|
||||
end
|
||||
end,
|
||||
on_place_client = function(pos)
|
||||
for i = 0, 9 do
|
||||
pos.x = pos.x + 1
|
||||
zepha.set_block(pos, "zeus:kinetic:axle_0")
|
||||
}
|
||||
},
|
||||
on_construct = fn(pos) {
|
||||
zepha.delay(() => {
|
||||
end
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
zepha.delay(function()
|
||||
zepha.set_block(pos, "zeus:kinetic:axle_1")
|
||||
}, 4)
|
||||
}
|
||||
end, 4)
|
||||
end
|
||||
})
|
||||
|
||||
zepha.register_block('zeus:kinetic:axle_1', {
|
||||
|
@ -40,11 +40,11 @@ zepha.register_block('zeus:kinetic:axle_1', {
|
|||
collision_box = {
|
||||
{0, 6/16, 6/16, 1, 10/16, 10/16}
|
||||
},
|
||||
on_construct = fn(pos) {
|
||||
zepha.delay(() => {
|
||||
on_construct = function(pos)
|
||||
zepha.delay(function()
|
||||
zepha.set_block(pos, "zeus:kinetic:axle_2")
|
||||
}, 4)
|
||||
}
|
||||
end, 4)
|
||||
end
|
||||
})
|
||||
|
||||
zepha.register_block('zeus:kinetic:axle_2', {
|
||||
|
@ -58,11 +58,11 @@ zepha.register_block('zeus:kinetic:axle_2', {
|
|||
collision_box = {
|
||||
{0, 6/16, 6/16, 1, 10/16, 10/16}
|
||||
},
|
||||
on_construct = fn(pos) {
|
||||
zepha.delay(() => {
|
||||
on_construct = function(pos)
|
||||
zepha.delay(function()
|
||||
zepha.set_block(pos, "zeus:kinetic:axle_3")
|
||||
}, 4)
|
||||
}
|
||||
end, 4)
|
||||
end
|
||||
})
|
||||
|
||||
zepha.register_block('zeus:kinetic:axle_3', {
|
||||
|
@ -76,9 +76,9 @@ zepha.register_block('zeus:kinetic:axle_3', {
|
|||
collision_box = {
|
||||
{0, 6/16, 6/16, 1, 10/16, 10/16}
|
||||
},
|
||||
on_construct = fn(pos) {
|
||||
zepha.delay(() => {
|
||||
on_construct = function(pos)
|
||||
zepha.delay(function()
|
||||
zepha.set_block(pos, "zeus:kinetic:axle_0")
|
||||
}, 4)
|
||||
}
|
||||
end, 4)
|
||||
end
|
||||
})
|
|
@ -1,11 +1,11 @@
|
|||
fn create_model_def(speed) {
|
||||
local function create_model_def(speed)
|
||||
local mod = ""
|
||||
if (speed > 0) { mod = "rotate_x" }
|
||||
if speed > 0 then mod = "rotate_x" end
|
||||
|
||||
return {
|
||||
parts = {
|
||||
{
|
||||
face = "left", ## Small part 1
|
||||
face = "left", -- Small part 1
|
||||
tex = 3,
|
||||
points = {
|
||||
0, 7/16, 7/16, 0, 2/10,
|
||||
|
@ -18,7 +18,7 @@ fn create_model_def(speed) {
|
|||
speed = speed
|
||||
}
|
||||
}, {
|
||||
face = "right", ## Small part 2
|
||||
face = "right", -- Small part 2
|
||||
tex = 4,
|
||||
points = {
|
||||
1, 9/16, 9/16, 2/16, 2/10,
|
||||
|
@ -31,7 +31,7 @@ fn create_model_def(speed) {
|
|||
speed = speed
|
||||
}
|
||||
}, {
|
||||
face = "nocull", ## Top
|
||||
face = "nocull", -- Top
|
||||
tex = 1,
|
||||
points = {
|
||||
0, 9/16, 7/16, 0, 2/10,
|
||||
|
@ -44,7 +44,7 @@ fn create_model_def(speed) {
|
|||
speed = speed
|
||||
}
|
||||
}, {
|
||||
face = "nocull", ## Bottom
|
||||
face = "nocull", -- Bottom
|
||||
tex = 2,
|
||||
points = {
|
||||
0, 7/16, 7/16, 0, 6/10,
|
||||
|
@ -57,7 +57,7 @@ fn create_model_def(speed) {
|
|||
speed = speed
|
||||
}
|
||||
}, {
|
||||
face = "nocull", ## Front
|
||||
face = "nocull", -- Front
|
||||
tex = 5,
|
||||
points = {
|
||||
0, 7/16, 9/16, 0, 8/10,
|
||||
|
@ -70,7 +70,7 @@ fn create_model_def(speed) {
|
|||
speed = speed
|
||||
}
|
||||
}, {
|
||||
face = "nocull", ## Back
|
||||
face = "nocull", -- Back
|
||||
tex = 6,
|
||||
points = {
|
||||
0, 7/16, 7/16, 0, 4/10,
|
||||
|
@ -85,7 +85,7 @@ fn create_model_def(speed) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
zepha.register_blockmodel("zeus:kinetic:axle_0", create_model_def(0));
|
||||
zepha.register_blockmodel("zeus:kinetic:axle_1", create_model_def(0.5));
|
|
@ -0,0 +1,40 @@
|
|||
--local noise = {
|
||||
-- module = "add",
|
||||
-- sources = {
|
||||
-- { -- Elevation
|
||||
-- module = "scale_bias",
|
||||
-- source = {
|
||||
-- module = "perlin",
|
||||
-- frequency = 0.02,
|
||||
-- octaves = 8
|
||||
-- },
|
||||
-- scale = 250,
|
||||
-- bias = 32
|
||||
-- },
|
||||
-- { -- Features
|
||||
-- module = "scale_bias",
|
||||
-- source = {
|
||||
-- module = "perlin",
|
||||
-- frequency = 0.8,
|
||||
-- octaves = 3,
|
||||
-- },
|
||||
-- scale = 30,
|
||||
-- bias = 6
|
||||
-- }
|
||||
-- }
|
||||
--}
|
||||
--
|
||||
--zepha.register_biome("zeus:mapgen:desert", {
|
||||
-- environment = {
|
||||
-- temperature = 40/100,
|
||||
-- humidity = 20/100,
|
||||
-- roughness = 10/100
|
||||
-- },
|
||||
-- blocks = {
|
||||
-- top = "zeus:default:sand",
|
||||
-- soil = "zeus:default:sand",
|
||||
-- rock = "zeus:default:sandstone"
|
||||
-- },
|
||||
-- biome_tint = "#e6fa61",
|
||||
-- noise = noise
|
||||
--})
|
|
@ -1,40 +0,0 @@
|
|||
##local noise = {
|
||||
## module = "add",
|
||||
## sources = {
|
||||
## { ## Elevation
|
||||
## module = "scale_bias",
|
||||
## source = {
|
||||
## module = "perlin",
|
||||
## frequency = 0.02,
|
||||
## octaves = 8
|
||||
## },
|
||||
## scale = 250,
|
||||
## bias = 32
|
||||
## },
|
||||
## { ## Features
|
||||
## module = "scale_bias",
|
||||
## source = {
|
||||
## module = "perlin",
|
||||
## frequency = 0.8,
|
||||
## octaves = 3,
|
||||
## },
|
||||
## scale = 30,
|
||||
## bias = 6
|
||||
## }
|
||||
## }
|
||||
##}
|
||||
##
|
||||
##zepha.register_biome("zeus:mapgen:desert", {
|
||||
## environment = {
|
||||
## temperature = 40/100,
|
||||
## humidity = 20/100,
|
||||
## roughness = 10/100
|
||||
## },
|
||||
## blocks = {
|
||||
## top = "zeus:default:sand",
|
||||
## soil = "zeus:default:sand",
|
||||
## rock = "zeus:default:sandstone"
|
||||
## },
|
||||
## biome_tint = "#e6fa61",
|
||||
## noise = noise
|
||||
##})
|
|
@ -0,0 +1,127 @@
|
|||
--local noise = {
|
||||
-- heightmap = {
|
||||
-- module = "add",
|
||||
-- sources = {{
|
||||
-- -- Elevation
|
||||
-- module = "scale_bias",
|
||||
-- source = {
|
||||
-- module = "perlin",
|
||||
-- frequency = 0.002,
|
||||
-- octaves = 8
|
||||
-- },
|
||||
-- scale = 250,
|
||||
-- bias = -32
|
||||
-- }, {
|
||||
-- -- Features
|
||||
-- module = "scale_bias",
|
||||
-- source = {
|
||||
-- module = "perlin",
|
||||
-- frequency = 0.2,
|
||||
-- octaves = 3,
|
||||
-- },
|
||||
-- scale = 6,
|
||||
-- bias = 6
|
||||
-- }}
|
||||
-- }
|
||||
--}
|
||||
--
|
||||
--local woo = "zeus:default:wood"
|
||||
--local lea = "zeus:default:leaves"
|
||||
--local inv = "invalid"
|
||||
--
|
||||
--local trunk_layer_0 = {
|
||||
-- { inv, inv, inv, inv, inv },
|
||||
-- { inv, woo, woo, woo, inv },
|
||||
-- { inv, woo, woo, woo, inv },
|
||||
-- { inv, woo, woo, woo, inv },
|
||||
-- { inv, inv, inv, inv, inv }
|
||||
--}
|
||||
--
|
||||
--local trunk_layer_1 = {
|
||||
-- { inv, inv, inv, inv, inv },
|
||||
-- { inv, inv, woo, inv, inv },
|
||||
-- { inv, woo, woo, woo, inv },
|
||||
-- { inv, inv, woo, inv, inv },
|
||||
-- { inv, inv, inv, inv, inv }
|
||||
--}
|
||||
--
|
||||
--local trunk_layer_2 = {
|
||||
-- { inv, inv, inv, inv, inv },
|
||||
-- { inv, inv, inv, inv, inv },
|
||||
-- { inv, inv, woo, inv, inv },
|
||||
-- { inv, inv, inv, inv, inv },
|
||||
-- { inv, inv, inv, inv, inv }
|
||||
--}
|
||||
--
|
||||
--local leaf_layer_1 = {
|
||||
-- { inv, lea, lea, lea, inv },
|
||||
-- { lea, lea, lea, lea, lea },
|
||||
-- { lea, lea, woo, lea, lea },
|
||||
-- { lea, lea, lea, lea, lea },
|
||||
-- { inv, lea, lea, lea, inv }
|
||||
--}
|
||||
--
|
||||
--local leaf_layer_2 = {
|
||||
-- { inv, inv, inv, inv, inv },
|
||||
-- { inv, lea, lea, lea, inv },
|
||||
-- { inv, lea, woo, lea, inv },
|
||||
-- { inv, lea, lea, lea, inv },
|
||||
-- { inv, inv, inv, inv, inv }
|
||||
--}
|
||||
--
|
||||
--local leaf_layer_3 = {
|
||||
-- { inv, inv, inv, inv, inv },
|
||||
-- { inv, lea, lea, inv, inv },
|
||||
-- { inv, lea, lea, lea, inv },
|
||||
-- { inv, inv, lea, lea, inv },
|
||||
-- { inv, inv, inv, inv, inv }
|
||||
--}
|
||||
--
|
||||
--local tree = zepha.create_structure({
|
||||
-- origin = V(2, 2, 2),
|
||||
-- schematic = {
|
||||
-- trunk_layer_0,
|
||||
-- trunk_layer_0,
|
||||
-- trunk_layer_0,
|
||||
-- trunk_layer_0,
|
||||
-- trunk_layer_1,
|
||||
-- trunk_layer_1,
|
||||
-- trunk_layer_1,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- trunk_layer_2,
|
||||
-- leaf_layer_2,
|
||||
-- leaf_layer_1,
|
||||
-- leaf_layer_1,
|
||||
-- leaf_layer_1,
|
||||
-- leaf_layer_1,
|
||||
-- leaf_layer_2,
|
||||
-- leaf_layer_3
|
||||
-- }
|
||||
--})
|
||||
--
|
||||
--zepha.register_biome("zeus:mapgen:forest", {
|
||||
-- environment = {
|
||||
-- temperature = 15/100,
|
||||
-- humidity = 80/100,
|
||||
-- roughness = 20/100,
|
||||
-- },
|
||||
-- blocks = {
|
||||
-- top = "zeus:default:grass",
|
||||
-- soil = "zeus:default:dirt",
|
||||
-- rock = "zeus:default:stone"
|
||||
-- },
|
||||
-- biome_tint = "#7beb26",
|
||||
-- noise = noise,
|
||||
-- structures = {
|
||||
-- tree
|
||||
-- }
|
||||
--})
|
|
@ -1,127 +0,0 @@
|
|||
##local noise = {
|
||||
## heightmap = {
|
||||
## module = "add",
|
||||
## sources = {{
|
||||
## ## Elevation
|
||||
## module = "scale_bias",
|
||||
## source = {
|
||||
## module = "perlin",
|
||||
## frequency = 0.002,
|
||||
## octaves = 8
|
||||
## },
|
||||
## scale = 250,
|
||||
## bias = -32
|
||||
## }, {
|
||||
## ## Features
|
||||
## module = "scale_bias",
|
||||
## source = {
|
||||
## module = "perlin",
|
||||
## frequency = 0.2,
|
||||
## octaves = 3,
|
||||
## },
|
||||
## scale = 6,
|
||||
## bias = 6
|
||||
## }}
|
||||
## }
|
||||
##}
|
||||
##
|
||||
##local woo = "zeus:default:wood"
|
||||
##local lea = "zeus:default:leaves"
|
||||
##local inv = "invalid"
|
||||
##
|
||||
##local trunk_layer_0 = {
|
||||
## { inv, inv, inv, inv, inv },
|
||||
## { inv, woo, woo, woo, inv },
|
||||
## { inv, woo, woo, woo, inv },
|
||||
## { inv, woo, woo, woo, inv },
|
||||
## { inv, inv, inv, inv, inv }
|
||||
##}
|
||||
##
|
||||
##local trunk_layer_1 = {
|
||||
## { inv, inv, inv, inv, inv },
|
||||
## { inv, inv, woo, inv, inv },
|
||||
## { inv, woo, woo, woo, inv },
|
||||
## { inv, inv, woo, inv, inv },
|
||||
## { inv, inv, inv, inv, inv }
|
||||
##}
|
||||
##
|
||||
##local trunk_layer_2 = {
|
||||
## { inv, inv, inv, inv, inv },
|
||||
## { inv, inv, inv, inv, inv },
|
||||
## { inv, inv, woo, inv, inv },
|
||||
## { inv, inv, inv, inv, inv },
|
||||
## { inv, inv, inv, inv, inv }
|
||||
##}
|
||||
##
|
||||
##local leaf_layer_1 = {
|
||||
## { inv, lea, lea, lea, inv },
|
||||
## { lea, lea, lea, lea, lea },
|
||||
## { lea, lea, woo, lea, lea },
|
||||
## { lea, lea, lea, lea, lea },
|
||||
## { inv, lea, lea, lea, inv }
|
||||
##}
|
||||
##
|
||||
##local leaf_layer_2 = {
|
||||
## { inv, inv, inv, inv, inv },
|
||||
## { inv, lea, lea, lea, inv },
|
||||
## { inv, lea, woo, lea, inv },
|
||||
## { inv, lea, lea, lea, inv },
|
||||
## { inv, inv, inv, inv, inv }
|
||||
##}
|
||||
##
|
||||
##local leaf_layer_3 = {
|
||||
## { inv, inv, inv, inv, inv },
|
||||
## { inv, lea, lea, inv, inv },
|
||||
## { inv, lea, lea, lea, inv },
|
||||
## { inv, inv, lea, lea, inv },
|
||||
## { inv, inv, inv, inv, inv }
|
||||
##}
|
||||
##
|
||||
##local tree = zepha.create_structure({
|
||||
## origin = V(2, 2, 2),
|
||||
## schematic = {
|
||||
## trunk_layer_0,
|
||||
## trunk_layer_0,
|
||||
## trunk_layer_0,
|
||||
## trunk_layer_0,
|
||||
## trunk_layer_1,
|
||||
## trunk_layer_1,
|
||||
## trunk_layer_1,
|
||||
## trunk_layer_2,
|
||||
## trunk_layer_2,
|
||||
## trunk_layer_2,
|
||||
## trunk_layer_2,
|
||||
## trunk_layer_2,
|
||||
## trunk_layer_2,
|
||||
## trunk_layer_2,
|
||||
## trunk_layer_2,
|
||||
## trunk_layer_2,
|
||||
## trunk_layer_2,
|
||||
## trunk_layer_2,
|
||||
## leaf_layer_2,
|
||||
## leaf_layer_1,
|
||||
## leaf_layer_1,
|
||||
## leaf_layer_1,
|
||||
## leaf_layer_1,
|
||||
## leaf_layer_2,
|
||||
## leaf_layer_3
|
||||
## }
|
||||
##})
|
||||
##
|
||||
##zepha.register_biome("zeus:mapgen:forest", {
|
||||
## environment = {
|
||||
## temperature = 15/100,
|
||||
## humidity = 80/100,
|
||||
## roughness = 20/100,
|
||||
## },
|
||||
## blocks = {
|
||||
## top = "zeus:default:grass",
|
||||
## soil = "zeus:default:dirt",
|
||||
## rock = "zeus:default:stone"
|
||||
## },
|
||||
## biome_tint = "#7beb26",
|
||||
## noise = noise,
|
||||
## structures = {
|
||||
## tree
|
||||
## }
|
||||
##})
|
|
@ -1,30 +1,3 @@
|
|||
local noise = {
|
||||
heightmap = {
|
||||
module = "add",
|
||||
sources = {{
|
||||
## Elevation
|
||||
module = "scale_bias",
|
||||
source = {
|
||||
module = "perlin",
|
||||
frequency = 0.002,
|
||||
octaves = 8
|
||||
},
|
||||
scale = 250,
|
||||
bias = -32
|
||||
}, {
|
||||
## Features
|
||||
module = "scale_bias",
|
||||
source = {
|
||||
module = "perlin",
|
||||
frequency = 0.2,
|
||||
octaves = 3,
|
||||
},
|
||||
scale = 12,
|
||||
bias = 6
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
local woo = "zeus:default:wood"
|
||||
local lea = "zeus:default:leaves"
|
||||
local inv = "invalid"
|
||||
|
@ -48,7 +21,7 @@ local shrub_layer_2 = {
|
|||
}
|
||||
|
||||
local shrub = zepha.create_structure({
|
||||
origin = V(1, 1, 1),
|
||||
origin = V{1, 1, 1},
|
||||
schematic = {
|
||||
shrub_layer_0,
|
||||
shrub_layer_1,
|
||||
|
@ -62,7 +35,7 @@ local noise = {
|
|||
sources = {{
|
||||
module = "add",
|
||||
sources = {{
|
||||
## Voronoi
|
||||
-- Voronoi
|
||||
module = "scale_bias",
|
||||
source = {
|
||||
module = "voronoi",
|
||||
|
@ -72,7 +45,7 @@ local noise = {
|
|||
scale = 8,
|
||||
bias = -32
|
||||
}, {
|
||||
## Features
|
||||
-- Features
|
||||
module = "scale_bias",
|
||||
source = {
|
||||
module = "perlin",
|
||||
|
@ -82,7 +55,7 @@ local noise = {
|
|||
scale = 3
|
||||
}}
|
||||
}, {
|
||||
## Variation
|
||||
-- Variation
|
||||
module = "scale_bias",
|
||||
source = {
|
||||
module = "perlin",
|
||||
|
@ -105,7 +78,7 @@ zepha.register_biome("zeus:mapgen:highlands", {
|
|||
soil = "zeus:default:dirt",
|
||||
rock = "zeus:default:stone"
|
||||
},
|
||||
biome_tint = "#e6fa61",
|
||||
biome_tint = "#c2fa61",
|
||||
noise = noise,
|
||||
structures = {
|
||||
shrub
|
|
@ -0,0 +1,46 @@
|
|||
--local noise = {
|
||||
-- heightmap = {
|
||||
-- module = "const",
|
||||
-- value = -12
|
||||
---- module = "add",
|
||||
---- sources = {{
|
||||
---- -- Elevation
|
||||
---- module = "scale_bias",
|
||||
---- source = {
|
||||
---- module = "perlin",
|
||||
---- frequency = 0.002,
|
||||
---- octaves = 8
|
||||
---- },
|
||||
---- scale = 250,
|
||||
---- bias = -32
|
||||
---- }, {
|
||||
---- -- Features
|
||||
---- module = "scale_bias",
|
||||
---- source = {
|
||||
---- module = "perlin",
|
||||
---- frequency = 0.2,
|
||||
---- octaves = 3,
|
||||
---- },
|
||||
---- scale = 6,
|
||||
---- bias = 6
|
||||
---- }}
|
||||
-- }
|
||||
--}
|
||||
--
|
||||
--zepha.register_biome("zeus:mapgen:plains", {
|
||||
-- environment = {
|
||||
-- temperature = 15/100,
|
||||
-- humidity = 60/100,
|
||||
-- roughness = 20/100,
|
||||
-- },
|
||||
-- blocks = {
|
||||
-- top = "zeus:default:grass",
|
||||
-- soil = "zeus:default:dirt",
|
||||
-- rock = "zeus:default:stone"
|
||||
-- },
|
||||
-- biome_tint = "#aaed45",
|
||||
-- noise = noise,
|
||||
-- structures = {
|
||||
-- tree
|
||||
-- }
|
||||
--})
|
|
@ -1,46 +0,0 @@
|
|||
##local noise = {
|
||||
## heightmap = {
|
||||
## module = "const",
|
||||
## value = -12
|
||||
#### module = "add",
|
||||
#### sources = {{
|
||||
#### ## Elevation
|
||||
#### module = "scale_bias",
|
||||
#### source = {
|
||||
#### module = "perlin",
|
||||
#### frequency = 0.002,
|
||||
#### octaves = 8
|
||||
#### },
|
||||
#### scale = 250,
|
||||
#### bias = -32
|
||||
#### }, {
|
||||
#### ## Features
|
||||
#### module = "scale_bias",
|
||||
#### source = {
|
||||
#### module = "perlin",
|
||||
#### frequency = 0.2,
|
||||
#### octaves = 3,
|
||||
#### },
|
||||
#### scale = 6,
|
||||
#### bias = 6
|
||||
#### }}
|
||||
## }
|
||||
##}
|
||||
##
|
||||
##zepha.register_biome("zeus:mapgen:plains", {
|
||||
## environment = {
|
||||
## temperature = 15/100,
|
||||
## humidity = 60/100,
|
||||
## roughness = 20/100,
|
||||
## },
|
||||
## blocks = {
|
||||
## top = "zeus:default:grass",
|
||||
## soil = "zeus:default:dirt",
|
||||
## rock = "zeus:default:stone"
|
||||
## },
|
||||
## biome_tint = "#aaed45",
|
||||
## noise = noise,
|
||||
## structures = {
|
||||
## tree
|
||||
## }
|
||||
##})
|
|
@ -2,9 +2,9 @@ zepha.register_item("zeus:materials:stick", {
|
|||
name = "Stick",
|
||||
textures = {
|
||||
"zeus:materials:stick",
|
||||
## "zeus:materials:stick_1_outlined",
|
||||
## "zeus:materials:stick_2_outlined",
|
||||
## "zeus:materials:stick_3_outlined"
|
||||
-- "zeus:materials:stick_1_outlined",
|
||||
-- "zeus:materials:stick_2_outlined",
|
||||
-- "zeus:materials:stick_3_outlined"
|
||||
},
|
||||
groups = {
|
||||
stick = 1,
|
Loading…
Reference in New Issue