Modificada la estructura de carpetas
- Se busca mantener intactos los mods originales de minetest, así como ciertos mods descargados de github. Git no trabaja muy bien con repositorios que contienen repositorios, así que para evitar problemas, se han creado enlaces dinámicos a estos mods. - ToDo: Instalador que descargue todos los mods necesarios y no incluídos en el repositorio y genere los enlaces dinámicos. -- Yawinmaster
|
@ -0,0 +1 @@
|
|||
../../../mods/Minetest-WorldEdit/
|
|
@ -0,0 +1 @@
|
|||
../../minetest_game/mods/boats/
|
|
@ -0,0 +1 @@
|
|||
../../minetest_game/mods/bucket/
|
|
@ -0,0 +1 @@
|
|||
../../minetest_game/mods/carts/
|
|
@ -0,0 +1 @@
|
|||
../../minetest_game/mods/creative/
|
|
@ -0,0 +1 @@
|
|||
../../../mods/octaclan/datalib/
|
|
@ -1,3 +0,0 @@
|
|||
[Dolphin]
|
||||
Timestamp=2017,1,18,20,54,14
|
||||
Version=3
|
|
@ -1,74 +0,0 @@
|
|||
# datalib API
|
||||
This documentation is also available at the official [datalib Wiki](http://208.69.243.45:3000/octacian/datalib/wiki). Divided into several parts, one for each main topic, this documentation includes all functions available for use from other mods.
|
||||
|
||||
## Global Variables
|
||||
Variables available for use within functions documented in the below sections.
|
||||
|
||||
* `datalib` : defines modname for global functions
|
||||
* `datalib.modpath` : datalib Modpath for use with the dmAPI.
|
||||
* `datalib.worldpath` : path of current world for use with the dmAPI.
|
||||
* `datalib.datapath` : datalib folder within the world path for use with the dmAPI. It is recommended that you store general data within this folder rather than cluttering the root world directory.
|
||||
|
||||
## Data Manipulation API (dmAPI)
|
||||
API for manipulating data stored within external files. Global variables are provided as mentioned above for storing files withing the `modpath`, `worldpath`, and `datapath`. It is recommended that you store unique files within the `datapath` as this prevents cluttering of the root world directory.
|
||||
|
||||
### initdata
|
||||
**Usage:** `datalib.initdata()`
|
||||
|
||||
Initializes directory with in the world path in which datalib stores most of its data. Must be run before data can be written within the `datapath` (called within `init.lua`).
|
||||
|
||||
### exists
|
||||
**Usage:** `datalib.exists(path)`
|
||||
|
||||
Checks the file specified through `path` returning true if it exists, and false if it does not.
|
||||
|
||||
### mkdir
|
||||
**Usage:** `datalib.mkdir(path)`
|
||||
|
||||
Make a directory at the specified `path`. Returns `true` if directory already exists.
|
||||
|
||||
### rmdir
|
||||
**Usage:** `datalib.rmdir(path)`
|
||||
|
||||
Recursively delete all contents of a directory (files, sub-directories, etc...). Returns `false` if directory does not exist.
|
||||
|
||||
### create
|
||||
**Usage:** `datalib.create(path)`
|
||||
|
||||
Create file in location specified by `path`. Returns `true` if already exists, nothing if creation is successful.
|
||||
|
||||
### write
|
||||
**Usage:** `datalib.write(path, data, serialize)`
|
||||
|
||||
Write data to file. File path is specified in `path`. Data to write is specified with field `data` and supports any value including strings, booleans, and integers. The `serialize` option tells datalib whether or not to run `minetest.serialize` on the data before writing, and is by default set to `false` if left blank.
|
||||
|
||||
### append
|
||||
**Usage:** `datalib.append(path, data, serialize)`
|
||||
|
||||
Append data to file. File path is specified in `path`. Data to append is specified with field `data` and supports any value including strings, booleans, and integers. The `serialize` option tells datalib whether or not to run `minetest.serialize` on the data before writing, and is by default set to `false` if left blank.
|
||||
|
||||
### read
|
||||
**Usage:** `datalib.read(path, deserialize)`
|
||||
|
||||
Load data from file (`path`) and return through variable `data`. The `deserialize` option tells datalib whether or not to run `minetest.deserialize` on the data before returning, and is by default set to `true` if left blank. Returns `false` if file does not exist.
|
||||
|
||||
### copy
|
||||
**Usage:** `datalib.copy(path, new)`
|
||||
**Shortcut:** `datalib.cp(path, new)`
|
||||
|
||||
Copy the contents of a file to another file. `path` indicates the location of the original, while `new` indicates the path where the copy will be placed. Returns false if file specified by `path` does not exist.
|
||||
|
||||
### table.write
|
||||
**Usage:** `datalib.table.write(path, table)`
|
||||
|
||||
Write table to file. File path is specified in `path`. Table to write is specified with field `table` and is designed for use with tables. The only difference between `write_table` and `write_file` is that `write_table` always serializes the data with `minetest.serialize` before writing because tables cannot be directly written to files, however, they must first be converted to strings through serialization.
|
||||
|
||||
### table.read
|
||||
**Usage:** `datalib.table.read(path)`
|
||||
|
||||
Load table from file (`path`) and return through variable `table`. The only difference between `load_table` and `load_file` is that `load_table` always deserializes the data with `minetest.deserialize` to convert previously written string back to a table. Returns `false` if file specified by `path` does not exist.
|
||||
|
||||
### dofile
|
||||
**Usage:** `datalib.dofile(path)`
|
||||
|
||||
Syntax as with the `dofile` command, the only difference being the function checks whether the file exists (using `check_file`) before running dofile to prevent errors. File specified through `path` is run as Lua, and returns `true` if successful, and `false` if unsuccessful (indicates file does not exist).
|
|
@ -1,21 +0,0 @@
|
|||
datalib [datalib]
|
||||
=========================
|
||||
Version 0.1
|
||||
|
||||
Licence: MIT (see license.txt)
|
||||
datalib is an API that makes data interaction simple. Functions include writing and appending to files, writing and reading tables, and more. This mod is still work in progress, and new functionality will be added from time to time, so read the updating instructions below to make sure you always have the latest version.
|
||||
|
||||
## API
|
||||
See API.md, also available at the official [datalib wiki](http://208.69.243.45:3000/octacian/datalib/wiki) through Gogs ([http://208.69.243.45:3000/octacian/datalib/wiki](http://208.69.243.45:3000/octacian/datalib/wiki)).
|
||||
|
||||
### Installation and Updates
|
||||
Unzip the archive, rename the folder to servertools and place it in `minetest/mods` or in the mods folder of the subgame in which you wish to use ServerTools.
|
||||
|
||||
You can also install this mod in the `worldmods` folder inside any world directory to use it only within one world.
|
||||
|
||||
For further information or help see:
|
||||
http://wiki.minetest.com/wiki/Installing_Mods
|
||||
|
||||
To update, periodically check the [Gogs repository](http://208.69.243.45:3000/octacian/datalib) and download either the latest release or the master branch (most up to date, but often unstable).
|
||||
|
||||
The mod will soon include an auto update function, which will work on its own so long as you have internet.
|
|
@ -1,174 +0,0 @@
|
|||
-- datalib/init.lua
|
||||
datalib = {}
|
||||
datalib.table = {} -- internal table global
|
||||
|
||||
-- logger
|
||||
function datalib.log(content, log_type)
|
||||
if log_type == nil then log_type = "action" end
|
||||
minetest.log(log_type, "[datalib] "..content)
|
||||
end
|
||||
|
||||
-- global path variables
|
||||
datalib.modpath = minetest.get_modpath("datalib") -- modpath
|
||||
datalib.worldpath = minetest.get_worldpath() -- worldpath
|
||||
datalib.datapath = datalib.worldpath.."/datalib" -- path for general datalib storage
|
||||
-- local path variables
|
||||
local modpath = datalib.modpath
|
||||
local worldpath = datalib.worldpath
|
||||
local datapath = datalib.datapath
|
||||
|
||||
-- shortcuts
|
||||
datalib.cp = datalib.copy
|
||||
|
||||
-- check if datalib world folder exists
|
||||
function datalib.initdata()
|
||||
local f = io.open(datapath)
|
||||
if not f then
|
||||
if minetest.mkdir then
|
||||
minetest.mkdir(datapath) -- create directory if minetest.mkdir is available
|
||||
return
|
||||
else
|
||||
os.execute('mkdir "'..datapath..'"') -- create directory with os mkdir command
|
||||
return
|
||||
end
|
||||
end
|
||||
f:close() -- close file
|
||||
end
|
||||
|
||||
datalib.initdata() -- initialize world data directory
|
||||
|
||||
-- check if file exists
|
||||
function datalib.exists(path)
|
||||
local f = io.open(path, "r") -- open file
|
||||
if f ~= nil then f:close() return true else return false end
|
||||
end
|
||||
|
||||
-- create folder
|
||||
function datalib.mkdir(path)
|
||||
local f = io.open(path)
|
||||
if not f then
|
||||
if minetest.mkdir then
|
||||
minetest.mkdir(path) -- create directory if minetest.mkdir is available
|
||||
return
|
||||
else
|
||||
os.execute('mkdir "'..path..'"') -- create directory with os mkdir command
|
||||
return
|
||||
end
|
||||
else
|
||||
end
|
||||
f:close() -- close file
|
||||
return true
|
||||
end
|
||||
|
||||
-- remove directory
|
||||
function datalib.rmdir(path, log)
|
||||
if not io.open(path) then return false end -- file doesn't exist
|
||||
|
||||
-- [local function] remove files
|
||||
local function rm_files(ppath, files)
|
||||
for _, f in ipairs(files) do
|
||||
os.remove(ppath.."/"..f)
|
||||
end
|
||||
end
|
||||
|
||||
-- [local function] check and rm dir
|
||||
local function rm_dir(dpath)
|
||||
local files = minetest.get_dir_list(dpath, false)
|
||||
local subdirs = minetest.get_dir_list(dpath, true)
|
||||
rm_files(dpath, files)
|
||||
if subdirs then
|
||||
for _, d in ipairs(subdirs) do
|
||||
rm_dir(dpath.."/"..d)
|
||||
end
|
||||
end
|
||||
os.remove(dpath)
|
||||
end
|
||||
|
||||
rm_dir(path)
|
||||
if log ~= false then datalib.log("Recursively removed directory at "..path) end -- log
|
||||
end
|
||||
|
||||
-- create file
|
||||
function datalib.create(path, log)
|
||||
-- check if file already exists
|
||||
if datalib.exists(path) == true then
|
||||
datalib.log("File ("..path..") already exists.") -- log
|
||||
return true -- exit and return
|
||||
end
|
||||
local f = io.open(path, "w") -- create file
|
||||
f:close() -- close file
|
||||
if log ~= false then datalib.log("Created file "..path) end -- log
|
||||
end
|
||||
|
||||
-- write to file
|
||||
function datalib.write(path, data, serialize, log)
|
||||
if not serialize then local serialize = false end -- if blank serialize = true
|
||||
local f = io.open(path, "w") -- open file for writing
|
||||
if serialize == true then local data = minetest.serialize(data) end -- serialize data
|
||||
f:write(data) -- write data
|
||||
f:close() -- close file
|
||||
if log ~= false then datalib.log('Wrote "'..data..'" to '..path) end -- log
|
||||
end
|
||||
|
||||
-- append to file
|
||||
function datalib.append(path, data, serialize, log)
|
||||
if not serialize then local serialize = false end -- if blank serialize = true
|
||||
local f = io.open(path, "a") -- open file for writing
|
||||
if serialize == true then local data = minetest.serialize(data) end -- serialize data
|
||||
f:write(data) -- write data
|
||||
f:close() -- close file
|
||||
if log ~= false then datalib.log('Appended "'..data..'" to '..path) end -- log
|
||||
end
|
||||
|
||||
-- read file
|
||||
function datalib.read(path, deserialize)
|
||||
if datalib.exists(path) ~= true then return false end -- check if exists
|
||||
local f = io.open(path, "r") -- open file for reading
|
||||
local data = f:read("*all") -- read and store file data in variable data
|
||||
if deserialize == true then local data = minetest.deserialize(data) end -- deserialize data
|
||||
return data -- return file contents
|
||||
end
|
||||
|
||||
-- copy file
|
||||
function datalib.copy(path, new, log)
|
||||
if not datalib.exists(path) then
|
||||
datalib.log(path.." does not exist. Cannot copy file.")
|
||||
return false
|
||||
end -- check if path exists
|
||||
local old = datalib.read(path, false) -- read
|
||||
datalib.create(new, false) -- create new
|
||||
datalib.write(new, old, false, false) -- write
|
||||
old = nil -- unset old
|
||||
if log ~= false then datalib.log("Copied "..path.." to "..new) end -- log
|
||||
return true -- successful
|
||||
end
|
||||
|
||||
-- write table to file
|
||||
function datalib.table.write(path, intable, log)
|
||||
local intable = minetest.serialize(intable) -- serialize intable
|
||||
local f = io.open(path, "w") -- open file for writing
|
||||
f:write(intable) -- write intable
|
||||
f:close() -- close file
|
||||
if log ~= false then datalib.log("Wrote table to "..path) end -- write table
|
||||
end
|
||||
|
||||
-- load table from file
|
||||
function datalib.table.read(path)
|
||||
if datalib.exists(path) ~= true then return false end -- check if exists
|
||||
local f = io.open(path, "r") -- open file for reading
|
||||
local externaltable = minetest.deserialize(f:read("*all")) -- deserialize and read externaltable
|
||||
f:close() -- close file
|
||||
return externaltable
|
||||
end
|
||||
|
||||
-- dofile
|
||||
function datalib.dofile(path)
|
||||
-- check if file exists
|
||||
if datalib.exists(path) == true then
|
||||
dofile(path)
|
||||
return true -- return true, successful
|
||||
else
|
||||
datalib.log("File "..path.." does not exist.")
|
||||
return false -- return false, unsuccessful
|
||||
end
|
||||
end
|
|
@ -1,16 +0,0 @@
|
|||
MIT License
|
||||
Copyright (c) 2016 Elijah Duffy
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||||
portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1 @@
|
|||
../../minetest_game/mods/default/
|
|
@ -0,0 +1 @@
|
|||
../../../mods/octaclan/digicompute/
|
|
@ -1,3 +0,0 @@
|
|||
[Dolphin]
|
||||
Timestamp=2017,1,18,20,54,26
|
||||
Version=3
|
|
@ -1,16 +0,0 @@
|
|||
MIT License
|
||||
Copyright (c) 2016 Elijah Duffy
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||||
portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -1,24 +0,0 @@
|
|||
Digital Computers [digicompute]
|
||||
=========================
|
||||
* Version 0.1, unstable
|
||||
* Licence: MIT (see LICENSE)
|
||||
* [Github Repository](https://github.com/octacian/digicompute)
|
||||
|
||||
This, is the first mod ever to attempt to provide fully functional computer and networking devices to the Minetest players. Originally inspired by [digiterm](https://forum.minetest.net/viewtopic.php?pid=103857), the mod has begun to take an entirely new direction. Computers are completely stand alone. They require no other mods to function, and can run alone or as a group.
|
||||
|
||||
To get started, just place down a computer, right click on it to power it up, and right click again once it's on to set the computer name. From there on it's all up to you. If you aren't satisfied with the default operating system, see the API section below and learn how to make your own.
|
||||
|
||||
### Planned / WIP Features
|
||||
* [wip] turtles
|
||||
* gui operating system support
|
||||
* package-like applications
|
||||
* routers (internet)
|
||||
* digiline support
|
||||
* mesecon support
|
||||
|
||||
### API
|
||||
digicompute is a mod that is meant to be customized, and tweaked by both modders and players. Along with the computers available out of the box, a powerful API is provided allowing modders to easily and quickly register their own computers, peripherals, internal components, and other devices.
|
||||
|
||||
The OS API allows anybody to create their own operating system to run and distrubute right on their digicomputers. The possibilities are becoming endless, as operating systems will soon be able to further use the formspec to create a graphical experience right inside Minetest.
|
||||
|
||||
To learn more about the API, see the [Wiki](https://github.com/octacian/digicompute/wiki/).
|
|
@ -1,86 +0,0 @@
|
|||
-- digicompute/api.lua
|
||||
local modpath = digicompute.modpath -- modpath pointer
|
||||
local path = digicompute.path -- path pointer
|
||||
|
||||
-- [function] refresh formspec
|
||||
function digicompute.refresh(pos)
|
||||
local meta = minetest.get_meta(pos) -- get meta
|
||||
meta:set_string("formspec", digicompute.formspec(meta:get_string("input"), meta:get_string("output")))
|
||||
end
|
||||
|
||||
dofile(modpath.."/fs.lua") -- do fs api file
|
||||
dofile(modpath.."/env.lua") -- do env file
|
||||
|
||||
-- [function] run file under env
|
||||
function digicompute.fs.run_file(pos, lpath, fields, replace)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local lpath = path.."/"..meta:get_string("owner").."/"..meta:get_string("name").."/"..lpath
|
||||
local env = digicompute.create_env(pos, fields) -- environment
|
||||
local f = loadfile(lpath) -- load func
|
||||
local e = digicompute.run(f, env) -- run function
|
||||
-- if error, call error handle function and re-run start
|
||||
if e and replace then
|
||||
datalib.copy(lpath, lpath..".old")
|
||||
datalib.copy(modpath.."/bios/"..replace, lpath)
|
||||
meta:set_string("output", "Error: \n"..msg.."\n\nRestoring OS, modified files will remain.") -- set output
|
||||
digicompute.refresh(pos) -- refresh
|
||||
minetest.after(13, function() -- after 13 seconds, run start
|
||||
local s = loadfile(path.."/"..meta:get_string("owner").."/"..meta:get_string("name").."/os/start.lua") -- load func
|
||||
digicompute.run(s, env) -- run func
|
||||
return false
|
||||
end)
|
||||
elseif e and not replace then return e end -- elseif no replace and error, return error msg
|
||||
end
|
||||
|
||||
-- turn on
|
||||
function digicompute.on(pos, node)
|
||||
local temp = minetest.get_node(pos) -- get node
|
||||
minetest.swap_node({x = pos.x, y = pos.y, z = pos.z}, {name = "digicompute:"..node.."_bios", param2 = temp.param2}) -- set node to bios
|
||||
minetest.after(3.5, function(pos_)
|
||||
minetest.swap_node({x = pos_.x, y = pos_.y, z = pos_.z}, {name = "digicompute:"..node.."_on", param2 = temp.param2}) -- set node to on after 5 seconds
|
||||
end, vector.new(pos))
|
||||
local meta = minetest.get_meta(pos) -- get meta
|
||||
-- if setup is not true, use set name formspec
|
||||
if meta:get_string("setup") ~= "true" then
|
||||
meta:set_string("formspec", digicompute.formspec_name("")) -- set formspec
|
||||
else -- use default formspec
|
||||
local fields = {
|
||||
input = meta:get_string("input"),
|
||||
output = meta:get_string("output"),
|
||||
}
|
||||
-- if not when_on, use blank
|
||||
if not digicompute.fs.run_file(pos, "os/start.lua", fields, "start.lua") then
|
||||
meta:set_string("formspec", digicompute.formspec("", "")) -- set formspec
|
||||
end
|
||||
digicompute.refresh(pos) -- refresh
|
||||
end
|
||||
end
|
||||
|
||||
-- turn off
|
||||
function digicompute.off(pos, node)
|
||||
local temp = minetest.get_node(pos) -- get node
|
||||
local meta = minetest.get_meta(pos) -- get meta
|
||||
meta:set_string("formspec", "") -- clear formspec
|
||||
minetest.swap_node({x = pos.x, y = pos.y, z = pos.z}, {name = "digicompute:"..node, param2 = temp.param2}) -- set node to off
|
||||
end
|
||||
|
||||
-- reboot
|
||||
function digicompute.reboot(pos, node)
|
||||
digicompute.off(pos, node)
|
||||
digicompute.on(pos, node)
|
||||
end
|
||||
|
||||
-- clear
|
||||
function digicompute.clear(field, pos)
|
||||
local meta = minetest.get_meta(pos) -- get meta
|
||||
meta:set_string(field, "") -- clear value
|
||||
end
|
||||
|
||||
-- [function] run code (in sandbox env)
|
||||
function digicompute.run(f, env)
|
||||
setfenv(f, env)
|
||||
local e, msg = pcall(f)
|
||||
if e == false then return msg end
|
||||
end
|
||||
|
||||
dofile(modpath.."/c_api.lua") -- do computer API file
|
|
@ -1,8 +0,0 @@
|
|||
-- bios os config
|
||||
clear = "clear" -- clear command
|
||||
off = "shutdown" -- shutdown command
|
||||
reboot = "reboot" -- reboot command
|
||||
digiline = false -- do not support digilines
|
||||
network = false -- do not support network
|
||||
on = "rightclick" -- on command (rightclick)
|
||||
clear_on_close = false -- do not clear output on close
|
|
@ -1,2 +0,0 @@
|
|||
set_output(get_output()..get_field("input").."\n"..get_attr("name")..":~$ ") -- print input
|
||||
refresh() -- refresh
|
|
@ -1 +0,0 @@
|
|||
set_output("Welcome to BiosOS version 0.1.\n\n"..get_attr("name")..":~$ ") -- print welcome
|
|
@ -1,137 +0,0 @@
|
|||
-- digicompute/c_api.lua
|
||||
--[[
|
||||
API for registering computer nodes. Documentation in progress.
|
||||
]]
|
||||
local modpath = digicompute.modpath
|
||||
local path = digicompute.path
|
||||
|
||||
function digicompute.register_computer(termstring, desc)
|
||||
-- off
|
||||
minetest.register_node("digicompute:"..termstring, {
|
||||
drawtype = "nodebox",
|
||||
description = desc.description,
|
||||
tiles = desc.off_tiles,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 2},
|
||||
drop = "digicompute:"..termstring,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
node_box = desc.node_box,
|
||||
digiline = {
|
||||
receptor = {},
|
||||
effector = {
|
||||
action = function(pos, node, channel, msg)
|
||||
if digicompute.digiline ~= false then
|
||||
local meta = minetest.get_meta(pos) -- get meta
|
||||
-- if channel is correct, turn on
|
||||
if channel == meta:get_string("channel") then
|
||||
if msg.system == digicompute.digiline_on then
|
||||
digicompute.on(pos, termstring)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
},
|
||||
},
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("owner", placer:get_player_name())
|
||||
end,
|
||||
on_rightclick = function(pos)
|
||||
digicompute.on(pos, termstring)
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
local meta = minetest.get_meta(pos) -- get meta
|
||||
if meta:get_string("name") then digicompute.fs.deinit(pos) end
|
||||
end,
|
||||
})
|
||||
-- bios
|
||||
minetest.register_node("digicompute:"..termstring.."_bios", {
|
||||
drawtype = "nodebox",
|
||||
description = desc.description,
|
||||
tiles = desc.bios_tiles,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
drop = "",
|
||||
groups = {unbreakable = 1, not_in_creative_inventory = 1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
node_box = desc.node_box,
|
||||
})
|
||||
-- on
|
||||
minetest.register_node("digicompute:"..termstring.."_on", {
|
||||
drawtype = "nodebox",
|
||||
description = desc.description,
|
||||
tiles = desc.on_tiles,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 2, not_in_creative_inventory = 1},
|
||||
drop = "digicompute:"..termstring,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
node_box = desc.node_box,
|
||||
digiline = {
|
||||
receptor = {},
|
||||
effector = {
|
||||
action = function(pos, node, channel, msg)
|
||||
-- if os supports digilines and digiline on, listen for signal
|
||||
if digicompute.digiline ~= false and digicompute.on:find("digiline") then
|
||||
local meta = minetest.get_meta(pos) -- get meta
|
||||
if channel ~= meta:get_string("channel") then return end -- ignore if not proper channel
|
||||
if msg.system then
|
||||
if msg.system == digicompute.clear then digicompute.clear("output", pos) -- clear output
|
||||
elseif msg.system == digicompute.off then digicompute.off(pos, termstring) -- turn off
|
||||
elseif msg.system == digicompute.reboot then digicompute.reboot(pos, termstring) -- reboot
|
||||
else digicompute.proc_digiline({x = pos.x, y = pos.y, z = pos.z}, fields.input) end -- else, hand over to OS
|
||||
end
|
||||
end
|
||||
end
|
||||
},
|
||||
},
|
||||
on_construct = function(pos) -- set meta and formspec
|
||||
local meta = minetest.get_meta(pos) -- get meta
|
||||
meta:set_string("output", "") -- output buffer
|
||||
meta:set_string("input", "") -- input buffer
|
||||
local name = meta:get_string("name") -- get computer name
|
||||
if not name then name = "" end -- if name nil, set to blank
|
||||
meta:set_string("formspec", digicompute.formspec_name(name)) -- computer name formspec
|
||||
end,
|
||||
on_rightclick = function(pos)
|
||||
-- if clear_on_close is true, clear
|
||||
if digicompute.clear_on_close == true then
|
||||
local meta = minetest.get_meta(pos) -- get meta
|
||||
meta:set_string("formspec", digicompute.formspec("", "")) -- clear formspec
|
||||
end
|
||||
end,
|
||||
on_destruct = function(pos)
|
||||
local meta = minetest.get_meta(pos) -- get meta
|
||||
if meta:get_string("name") then digicompute.fs.deinit(pos) end
|
||||
end,
|
||||
on_receive_fields = function(pos, formname, fields, sender) -- process formdata
|
||||
local meta = minetest.get_meta(pos) -- get meta
|
||||
|
||||
-- if name, set
|
||||
if fields.name then
|
||||
meta:set_string("name", fields.name) -- set name
|
||||
meta:set_string("setup", "true") -- set computer to configured
|
||||
digicompute.fs.init(pos, fields.name) -- initialize filesystem
|
||||
-- try to run when_on
|
||||
if not digicompute.fs.run_file(pos, "os/start.lua", fields, "start.lua") then
|
||||
meta:set_string("formspec", digicompute.formspec("", "")) -- set formspec
|
||||
end
|
||||
digicompute.refresh(pos) -- refresh
|
||||
end
|
||||
|
||||
local name = meta:get_string("name") -- get name
|
||||
local c = loadfile(path.."/"..meta:get_string("owner").."/"..name.."/os/conf.lua")
|
||||
local e, msg = pcall(c)
|
||||
-- if submitted, process basic commands, pass on to os
|
||||
if fields.input then
|
||||
if fields.input == clear then meta:set_string("formspec", digicompute.formspec("",""))
|
||||
elseif fields.input == off then digicompute.off(pos, termstring) -- set off
|
||||
elseif fields.input == reboot then digicompute.reboot(pos, termstring) -- reboot
|
||||
else -- else, turn over to os
|
||||
digicompute.fs.run_file(pos, "os/main.lua", fields, "main.lua") -- run main.lua
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
|
@ -1,3 +0,0 @@
|
|||
default
|
||||
datalib
|
||||
digilines?
|
|
@ -1,225 +0,0 @@
|
|||
-- digicompute/env.lua --
|
||||
-- ENVIRONMENT --
|
||||
-----------------
|
||||
|
||||
-- [function] create environment
|
||||
function digicompute.create_env(pos, fields)
|
||||
local meta = minetest.get_meta(pos) -- get meta
|
||||
-- CUSTOM SAFE FUNCTIONS --
|
||||
|
||||
local function safe_print(param)
|
||||
print(dump(param))
|
||||
end
|
||||
|
||||
local function safe_date()
|
||||
return(os.date("*t",os.time()))
|
||||
end
|
||||
|
||||
-- string.rep(str, n) with a high value for n can be used to DoS
|
||||
-- the server. Therefore, limit max. length of generated string.
|
||||
local function safe_string_rep(str, n)
|
||||
if #str * n > 6400 then
|
||||
debug.sethook() -- Clear hook
|
||||
error("string.rep: string length overflow", 2)
|
||||
end
|
||||
|
||||
return string.rep(str, n)
|
||||
end
|
||||
|
||||
-- string.find with a pattern can be used to DoS the server.
|
||||
-- Therefore, limit string.find to patternless matching.
|
||||
local function safe_string_find(...)
|
||||
if (select(4, ...)) ~= true then
|
||||
debug.sethook() -- Clear hook
|
||||
error("string.find: 'plain' (fourth parameter) must always be true for digicomputers.")
|
||||
end
|
||||
|
||||
return string.find(...)
|
||||
end
|
||||
|
||||
-- [function] get attr (from meta)
|
||||
local function get_attr(key)
|
||||
return meta:get_string(key) or nil
|
||||
end
|
||||
-- [function] get userdata
|
||||
local function get_userdata(key)
|
||||
local t = minetest.deserialize(meta:get_string("userspace"))
|
||||
return t[key] or nil
|
||||
end
|
||||
-- [function] set userdata
|
||||
local function set_userdata(key, value)
|
||||
local t = minetest.deserialize(meta:get_string("userspace"))
|
||||
t[key] = value
|
||||
return meta:set_string("userspace", minetest.serialize(t))
|
||||
end
|
||||
-- [function] get input
|
||||
local function get_input()
|
||||
return meta:get_string("input") or nil
|
||||
end
|
||||
-- [function] set input
|
||||
local function set_input(value)
|
||||
return meta:set_string("input", value) or nil
|
||||
end
|
||||
-- [function] get output
|
||||
local function get_output()
|
||||
return meta:get_string("output") or nil
|
||||
end
|
||||
-- [function] set output
|
||||
local function set_output(value)
|
||||
return meta:set_string("output", value) or nil
|
||||
end
|
||||
-- [function] get field
|
||||
local function get_field(key)
|
||||
return fields[key] or nil
|
||||
end
|
||||
-- [function] refresh
|
||||
local function refresh()
|
||||
meta:set_string("formspec", digicompute.formspec(meta:get_string("input"), meta:get_string("output")))
|
||||
return true
|
||||
end
|
||||
|
||||
-- filesystem API
|
||||
|
||||
-- [function] get file (read)
|
||||
local function get_file(path)
|
||||
local res = digicompute.fs.get_file(pos, path)
|
||||
if res then return res end
|
||||
end
|
||||
|
||||
-- [function] get directory contents
|
||||
local function get_dir(path)
|
||||
local res = digicompute.fs.get_dir(pos, path)
|
||||
if res then return res end
|
||||
end
|
||||
|
||||
-- [function] exists
|
||||
local function exists(path)
|
||||
local res = digicompute.fs.exists(pos, path)
|
||||
if res then return res end
|
||||
end
|
||||
|
||||
-- [function] mkdir
|
||||
local function mkdir(path)
|
||||
local res = digicompute.fs.exists(pos, path)
|
||||
if res then return res end
|
||||
end
|
||||
|
||||
-- [function] rmdir
|
||||
local function rmdir(path)
|
||||
local res = digicompute.fs.rmdir(pos, path)
|
||||
if res then return res end
|
||||
end
|
||||
|
||||
-- [function] mkdir
|
||||
local function mkdir(path)
|
||||
local res = digicompute.fs.exists(pos, path)
|
||||
if res then return res end
|
||||
end
|
||||
|
||||
-- [function] create file
|
||||
local function create(path)
|
||||
local res = digicompute.fs.create(pos, path)
|
||||
if res then return res end
|
||||
end
|
||||
|
||||
-- [function] write
|
||||
local function write(path, data)
|
||||
local res = digicompute.fs.write(pos, path, data)
|
||||
if res then return res end
|
||||
end
|
||||
|
||||
-- [function] append
|
||||
local function append(path, data)
|
||||
local res = digicompute.fs.append(pos, path, data)
|
||||
if res then return res end
|
||||
end
|
||||
|
||||
-- [function] copy
|
||||
local function copy(path, npath)
|
||||
local res = digicompute.fs.copy(pos, path, npath)
|
||||
if res then return res end
|
||||
end
|
||||
|
||||
-- ENVIRONMENT TABLE --
|
||||
|
||||
local env = {
|
||||
run = digicompute.run,
|
||||
get_attr = get_attr,
|
||||
get_userdata = get_userdata,
|
||||
set_userdata = set_userdata,
|
||||
get_input = get_input,
|
||||
set_input = set_input,
|
||||
get_output = get_output,
|
||||
set_output = set_output,
|
||||
get_field = get_field,
|
||||
refresh = refresh,
|
||||
fs = {
|
||||
read = get_file,
|
||||
list = get_dir,
|
||||
check = exists,
|
||||
mkdir = mkdir,
|
||||
rmdir = rmdir,
|
||||
touch = create,
|
||||
write = write,
|
||||
copy = copy,
|
||||
cp = copy,
|
||||
},
|
||||
string = {
|
||||
byte = string.byte,
|
||||
char = string.char,
|
||||
format = string.format,
|
||||
len = string.len,
|
||||
lower = string.lower,
|
||||
upper = string.upper,
|
||||
rep = safe_string_rep,
|
||||
reverse = string.reverse,
|
||||
sub = string.sub,
|
||||
find = safe_string_find,
|
||||
},
|
||||
math = {
|
||||
abs = math.abs,
|
||||
acos = math.acos,
|
||||
asin = math.asin,
|
||||
atan = math.atan,
|
||||
atan2 = math.atan2,
|
||||
ceil = math.ceil,
|
||||
cos = math.cos,
|
||||
cosh = math.cosh,
|
||||
deg = math.deg,
|
||||
exp = math.exp,
|
||||
floor = math.floor,
|
||||
fmod = math.fmod,
|
||||
frexp = math.frexp,
|
||||
huge = math.huge,
|
||||
ldexp = math.ldexp,
|
||||
log = math.log,
|
||||
log10 = math.log10,
|
||||
max = math.max,
|
||||
min = math.min,
|
||||
modf = math.modf,
|
||||
pi = math.pi,
|
||||
pow = math.pow,
|
||||
rad = math.rad,
|
||||
random = math.random,
|
||||
sin = math.sin,
|
||||
sinh = math.sinh,
|
||||
sqrt = math.sqrt,
|
||||
tan = math.tan,
|
||||
tanh = math.tanh,
|
||||
},
|
||||
table = {
|
||||
concat = table.concat,
|
||||
insert = table.insert,
|
||||
maxn = table.maxn,
|
||||
remove = table.remove,
|
||||
sort = table.sort,
|
||||
},
|
||||
os = {
|
||||
clock = os.clock,
|
||||
difftime = os.difftime,
|
||||
time = os.time,
|
||||
datetable = safe_date,
|
||||
},
|
||||
}
|
||||
return env -- return table
|
||||
end
|
|
@ -1,139 +0,0 @@
|
|||
-- digicompute/fs.lua
|
||||
--[[
|
||||
filesystem API.
|
||||
]]
|
||||
digicompute.fs = {}
|
||||
local fs = digicompute.fs
|
||||
local path = digicompute.path
|
||||
local modpath = digicompute.modpath
|
||||
|
||||
-- [function] initalize fs
|
||||
function digicompute.fs.init(pos, cname)
|
||||
local meta = minetest.get_meta(pos) -- meta
|
||||
local player = meta:get_string("owner") -- owner username
|
||||
local cpath = path.."/"..player.."/"..cname -- comp path
|
||||
if datalib.exists(path.."/"..player) == false then datalib.mkdir(path.."/"..player) end -- check for user dir
|
||||
if datalib.exists(cpath) == true then return "A computer with this name already exists." end
|
||||
datalib.mkdir(cpath) -- make computer dir
|
||||
datalib.mkdir(cpath.."/os/") -- make os dir
|
||||
datalib.copy(modpath.."/bios/conf.lua", cpath.."/os/conf.lua", false)
|
||||
datalib.copy(modpath.."/bios/main.lua", cpath.."/os/main.lua", false)
|
||||
datalib.copy(modpath.."/bios/start.lua", cpath.."/os/start.lua", false)
|
||||
digicompute.log("Initialized computer "..cname.." placed by "..player..".")
|
||||
end
|
||||
|
||||
-- [function] de-initialize fs (delete)
|
||||
function digicompute.fs.deinit(pos)
|
||||
local meta = minetest.get_meta(pos) -- meta
|
||||
local player = meta:get_string("owner") -- owner username
|
||||
local cname = meta:get_string("name") -- name
|
||||
|
||||
-- [local function] remove files
|
||||
local function rm_files(ppath, files)
|
||||
for _, f in ipairs(files) do
|
||||
os.remove(ppath.."/"..f)
|
||||
end
|
||||
end
|
||||
|
||||
-- [local function] check and rm dir
|
||||
local function rm_dir(dpath)
|
||||
local files = minetest.get_dir_list(dpath, false)
|
||||
local subdirs = minetest.get_dir_list(dpath, true)
|
||||
rm_files(dpath, files)
|
||||
if subdirs then
|
||||
for _, d in ipairs(subdirs) do
|
||||
rm_dir(dpath.."/"..d)
|
||||
end
|
||||
end
|
||||
os.remove(dpath)
|
||||
end
|
||||
|
||||
rm_dir(path.."/"..player.."/"..cname)
|
||||
end
|
||||
|
||||
-- [function] get file contents
|
||||
function digicompute.fs.get_file(pos, fpath)
|
||||
local meta = minetest.get_meta(pos) -- meta
|
||||
local cname = meta:get_string("name") -- computer name
|
||||
local player = meta:get_string("owner") -- owner username
|
||||
local cpath = path.."/"..player.."/"..cname -- comp path
|
||||
local contents = datalib.read(cpath.."/"..fpath)
|
||||
if not contents then return { error = "File does not exist.", contents = nil } end
|
||||
return { error = nil, contents = contents }
|
||||
end
|
||||
|
||||
-- [function] get directory contents
|
||||
function digicompute.fs.get_dir(pos, dpath)
|
||||
local meta = minetest.get_meta(pos) -- meta
|
||||
local cname = meta:get_string("name") -- computer name
|
||||
local player = meta:get_string("owner") -- owner username
|
||||
local cpath = path.."/"..player.."/"..cname -- comp path
|
||||
local files = minetest.get_dir_list(cpath.."/"..dpath, false)
|
||||
local subdirs = minetest.get_dir_list(cpath.."/"..dpath, true)
|
||||
if not files and not subdirs then return { error = "Directory does not exist, or is empty.", contents = nil } end
|
||||
return { error = nil, contents = { files = files, subdirs = subdirs } }
|
||||
end
|
||||
|
||||
-- [function] exists
|
||||
function digicompute.fs.exists(pos, fpath)
|
||||
local meta = minetest.get_meta(pos) -- meta
|
||||
local cname = meta:get_string("name") -- computer name
|
||||
local name = meta:get_string("owner") -- owner username
|
||||
local res = datalib.exists(path.."/"..name.."/"..cname.."/"..fpath)
|
||||
if res == true then return "File exists."
|
||||
else return "File does not exist."
|
||||
end
|
||||
end
|
||||
|
||||
-- [function] create directory
|
||||
function digicompute.fs.mkdir(pos, fpath)
|
||||
local meta = minetest.get_meta(pos) -- meta
|
||||
local cname = meta:get_string("name") -- computer name
|
||||
local name = meta:get_string("owner") -- owner username
|
||||
local res = datalib.mkdir(path.."/"..name.."/"..cname.."/"..fpath)
|
||||
if res == true then return "Directory already exists." end
|
||||
end
|
||||
|
||||
-- [function] remove directory
|
||||
function digicompute.fs.rmdir(pos, fpath)
|
||||
local meta = minetest.get_meta(pos) -- meta
|
||||
local cname = meta:get_string("name") -- computer name
|
||||
local name = meta:get_string("owner") -- owner username
|
||||
local res = datalib.rmdir(path.."/"..name.."/"..cname.."/"..fpath)
|
||||
if res == false then return "Directory does not exist." end
|
||||
end
|
||||
|
||||
-- [function] create file
|
||||
function digicompute.fs.create(pos, fpath)
|
||||
local meta = minetest.get_meta(pos) -- meta
|
||||
local cname = meta:get_string("name") -- computer name
|
||||
local name = meta:get_string("owner") -- owner username
|
||||
local res = datalib.create(path.."/"..name.."/"..cname.."/"..fpath)
|
||||
if res == true then return "File already exists." end
|
||||
end
|
||||
|
||||
-- [function] write
|
||||
function digicompute.fs.write(pos, fpath, data)
|
||||
local meta = minetest.get_meta(pos) -- meta
|
||||
local cname = meta:get_string("name") -- computer name
|
||||
local name = meta:get_string("owner") -- owner username
|
||||
datalib.write(path.."/"..name.."/"..cname.."/"..fpath, data, false)
|
||||
end
|
||||
|
||||
-- [function] append
|
||||
function digicompute.fs.append(pos, fpath, data)
|
||||
local meta = minetest.get_meta(pos) -- meta
|
||||
local cname = meta:get_string("name") -- computer name
|
||||
local name = meta:get_string("owner") -- owner username
|
||||
datalib.append(path.."/"..name.."/"..cname.."/"..fpath, data, false)
|
||||
end
|
||||
|
||||
-- [function] copy file
|
||||
function digicompute.fs.copy(pos, fpath, npath)
|
||||
local meta = minetest.get_meta(pos) -- meta
|
||||
local cname = meta:get_string("name") -- computer name
|
||||
local name = meta:get_string("owner") -- owner username
|
||||
local res = datalib.copy(path.."/"..name.."/"..cname.."/"..fpath, path.."/"..name.."/"..cname.."/"..npath)
|
||||
if res == false then return "Base file does not exist." end
|
||||
end
|
||||
digicompute.fs.cp = digicompute.fs.copy
|
|
@ -1,45 +0,0 @@
|
|||
-- digicompute/init.lua
|
||||
digicompute = {}
|
||||
-- variables
|
||||
digicompute.modpath = minetest.get_modpath("digicompute") -- modpath
|
||||
local modpath = digicompute.modpath -- modpath pointer
|
||||
|
||||
-- logger
|
||||
function digicompute.log(content, log_type)
|
||||
if log_type == nil then log_type = "action" end
|
||||
minetest.log(log_type, "[digicompute] "..content)
|
||||
end
|
||||
|
||||
-- create mod world dir
|
||||
datalib.mkdir(datalib.worldpath.."/digicompute")
|
||||
digicompute.path = datalib.worldpath.."/digicompute"
|
||||
|
||||
-- FORMSPECS
|
||||
-- normal
|
||||
function digicompute.formspec(input, output)
|
||||
if not output then local output = "" end
|
||||
if not input then local input = "" end
|
||||
-- formspec
|
||||
local formspec =
|
||||
"size[10,11]"..
|
||||
default.gui_bg_img..
|
||||
"textarea[.25,.25;10,11.5;output;Output:;"..output.."]"..
|
||||
"field[.25,10.75;10,1;input;;"..input.."]"..
|
||||
"field_close_on_enter[input;false]"
|
||||
return formspec -- return formspec text
|
||||
end
|
||||
-- set name
|
||||
function digicompute.formspec_name(computer)
|
||||
if not computer then local computer = "" end -- use blank channel is none specified
|
||||
local formspec =
|
||||
"size[6,1.7]"..
|
||||
default.gui_bg_img..
|
||||
"field[.25,0.50;6,1;name;Computer Name:;"..computer.."]"..
|
||||
"button[4.95,1;1,1;submit_name;Set]"
|
||||
return formspec
|
||||
end
|
||||
-- /FORMSPECS
|
||||
|
||||
-- load resources
|
||||
dofile(modpath.."/api.lua") -- load api
|
||||
dofile(modpath.."/nodes.lua") -- load nodes
|
|
@ -1,35 +0,0 @@
|
|||
-- digicompute/nodes.lua
|
||||
|
||||
digicompute.register_computer("default", {
|
||||
description = "digicomputer",
|
||||
off_tiles = {
|
||||
"top.png",
|
||||
"bottom.png",
|
||||
"right.png",
|
||||
"left.png",
|
||||
"back_off.png",
|
||||
"front_off.png",
|
||||
},
|
||||
bios_tiles = {
|
||||
"top.png",
|
||||
"bottom.png",
|
||||
"right.png",
|
||||
"left.png",
|
||||
"back_off.png",
|
||||
"front_off.png^bios.png",
|
||||
},
|
||||
on_tiles = {
|
||||
"top.png",
|
||||
"bottom.png",
|
||||
"right.png",
|
||||
"left.png",
|
||||
"back.png",
|
||||
"front.png"
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.125, 0.5, 0.5, 0.5}, -- computer
|
||||
}
|
||||
},
|
||||
})
|
Before Width: | Height: | Size: 395 B |
Before Width: | Height: | Size: 293 B |
Before Width: | Height: | Size: 288 B |
Before Width: | Height: | Size: 165 B |
Before Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 119 B |
Before Width: | Height: | Size: 116 B |
Before Width: | Height: | Size: 111 B |
Before Width: | Height: | Size: 129 B |
|
@ -0,0 +1 @@
|
|||
../../minetest_game/mods/doors/
|
|
@ -0,0 +1 @@
|
|||
../../minetest_game/mods/farming/
|
|
@ -0,0 +1 @@
|
|||
../../minetest_game/mods/flowers/
|
|
@ -0,0 +1 @@
|
|||
../../minetest_game/mods/give_initial_stuff/
|
Before Width: | Height: | Size: 184 KiB After Width: | Height: | Size: 184 KiB |
|
@ -0,0 +1 @@
|
|||
../../minetest_game/mods/killme/
|
|
@ -0,0 +1 @@
|
|||
../../../mods/magic/
|
|
@ -1,275 +0,0 @@
|
|||
-----------------------------------------------------------------
|
||||
-- MULTIBLOCK RECIPES -------------------------------------------
|
||||
-----------------------------------------------------------------
|
||||
|
||||
function magic.register_recipe(name, recipe, action)
|
||||
magic.recipes[name] = {recipe, action}
|
||||
end
|
||||
|
||||
function magic.do_spell(itemstack, placer, pointed_thing)
|
||||
local name
|
||||
|
||||
if pointed_thing.type == "object" then
|
||||
return
|
||||
elseif pointed_thing.type == "node" then
|
||||
name = minetest.get_node(pointed_thing.under).name
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local coincidences = magic.find_possible_recipes(pointed_thing)
|
||||
|
||||
if #coincidences > 0 then
|
||||
for n_rec, rec in ipairs(coincidences) do
|
||||
local pt = pointed_thing
|
||||
|
||||
if magic.check_recipe(rec, pt) then
|
||||
magic.recipes[rec][2](pt, placer)
|
||||
return
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
function magic.check_recipe(recipe_id, target)
|
||||
local recipe = magic.recipes[recipe_id][1]
|
||||
|
||||
local posx = target.under.x
|
||||
local posy = target.under.y
|
||||
local posz = target.under.z
|
||||
|
||||
local reference = {x = posx - math.floor(#recipe[1][1] / 2),
|
||||
y = posy - math.floor(#recipe / 2),
|
||||
z = posz - math.floor(#recipe[1] / 2)}
|
||||
|
||||
local i = 0
|
||||
local j = 0
|
||||
local k = 0
|
||||
|
||||
k = 0
|
||||
for n_lin, lin in ipairs(recipe) do
|
||||
posy = reference.y + k
|
||||
|
||||
j = 0
|
||||
for n_col, col in ipairs(lin) do
|
||||
posz = reference.z + j
|
||||
|
||||
i = 0
|
||||
for n_elem, elem in ipairs(col) do
|
||||
posx = reference.x + i
|
||||
|
||||
if elem ~= "" then
|
||||
local nodedef = minetest.registered_nodes[minetest.get_node({x = posx,y = posy,z = posz}).name]
|
||||
local grupo = false;
|
||||
for g, _ in pairs(nodedef.groups) do
|
||||
if elem == g then
|
||||
grupo = true;
|
||||
end
|
||||
end
|
||||
|
||||
if elem ~= minetest.get_node({x = posx,y = posy,z = posz}).name and not grupo then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
i = i + 1
|
||||
end
|
||||
j = j + 1
|
||||
end
|
||||
k = k + 1
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function magic.find_possible_recipes(node)
|
||||
local to_ret = {}
|
||||
local coincide
|
||||
local nodedef = minetest.registered_nodes[minetest.get_node(node.under).name]
|
||||
|
||||
for n_rec, rec in pairs(magic.recipes) do
|
||||
coincide = false
|
||||
|
||||
for n_lin, lin in ipairs(rec[1]) do
|
||||
for n_col, col in ipairs(lin) do
|
||||
for n_elem, elem in ipairs(col) do
|
||||
local grupo = false;
|
||||
for g, _ in pairs(nodedef.groups) do
|
||||
if elem == g then
|
||||
grupo = true;
|
||||
end
|
||||
end
|
||||
if elem == minetest.get_node(node.under).name or grupo then
|
||||
to_ret[#to_ret+1] = n_rec
|
||||
|
||||
coincide = true
|
||||
end
|
||||
|
||||
if coincide then break end
|
||||
end
|
||||
|
||||
if coincide then break end
|
||||
end
|
||||
|
||||
if coincide then break end
|
||||
end
|
||||
end
|
||||
|
||||
return to_ret
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------
|
||||
-- ALTAR RITUALS ------------------------------------------------
|
||||
-----------------------------------------------------------------
|
||||
function magic.register_ritual(name, ritual, action)
|
||||
magic.rituals[name] = {ritual, action}
|
||||
end
|
||||
|
||||
function magic.do_ritual(node, player)
|
||||
local things = magic.get_items(node)
|
||||
|
||||
if #things < 1 then
|
||||
minetest.chat_send_player(player:get_player_name(), "[Mod magic] The altar is empty")
|
||||
return
|
||||
end
|
||||
|
||||
local itemlist = magic.organice_items(things)
|
||||
local n_rit = magic.check_ritual(itemlist)
|
||||
|
||||
if n_rit then
|
||||
magic.rituals[n_rit][2](node, player)
|
||||
end
|
||||
end
|
||||
|
||||
function magic.get_items(node)
|
||||
local pos = node.under
|
||||
local things = {}
|
||||
|
||||
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 1)) do
|
||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
||||
table.insert(things,object:get_luaentity().itemstring)
|
||||
end
|
||||
end
|
||||
|
||||
return things
|
||||
end
|
||||
|
||||
function magic.organice_items(things)
|
||||
local did = false
|
||||
local itemlist = {}
|
||||
|
||||
for i, n in pairs(things) do
|
||||
did = false
|
||||
|
||||
for j in ipairs(itemlist) do
|
||||
if itemlist[j].name == n then
|
||||
itemlist[j].val = itemlist[j].val + 1
|
||||
did = true
|
||||
end
|
||||
end
|
||||
|
||||
if not did then
|
||||
itemlist[#itemlist+1] = {name = n, val = 1}
|
||||
end
|
||||
end
|
||||
|
||||
return itemlist
|
||||
end
|
||||
|
||||
function magic.check_ritual(itemlist)
|
||||
for ritual_id, ritual_content in pairs(magic.rituals) do
|
||||
if #ritual_content[1] == #itemlist then
|
||||
local check = false
|
||||
for i in ipairs(itemlist) do
|
||||
check = magic.check_item_in_ritual(itemlist[i], ritual_content[1])
|
||||
|
||||
if not check then
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if check then
|
||||
return ritual_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
function magic.check_item_in_ritual(item, itemlist)
|
||||
for i in ipairs(itemlist) do
|
||||
if itemlist[i].name == item.name and itemlist[i].val == item.val then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function magic.clear_altar(node)
|
||||
local pos = node.under
|
||||
local things = {}
|
||||
|
||||
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 1)) do
|
||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
||||
object:get_luaentity().itemstring = ""
|
||||
object:remove()
|
||||
end
|
||||
end
|
||||
|
||||
return things
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------
|
||||
-- HOME WARP ----------------------------------------------------
|
||||
-----------------------------------------------------------------
|
||||
|
||||
function magic.warp(player)
|
||||
local playerName = player:get_player_name()
|
||||
local home = magic.checkHome(playerName)
|
||||
if home == -1 then
|
||||
minetest.chat_send_player(playerName, "[Mod Magic] Unknown home")
|
||||
return
|
||||
end
|
||||
|
||||
player:setpos(magic.playerHomes[home].homepos)
|
||||
player:set_look_yaw(0)
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------
|
||||
-- TIER REGISTERING UTILS ---------------------------------------
|
||||
-----------------------------------------------------------------
|
||||
|
||||
function magic.add_group_to_node(n, group)
|
||||
local def = minetest.registered_items[n]
|
||||
if not def then
|
||||
return false
|
||||
end
|
||||
|
||||
local dg = def.groups or {}
|
||||
for _group, value in pairs(group) do
|
||||
if value ~= 0 then
|
||||
dg[_group] = value
|
||||
else
|
||||
dg[_group] = nil
|
||||
end
|
||||
end
|
||||
|
||||
minetest.override_item(n, {groups = dg})
|
||||
return true
|
||||
end
|
||||
|
||||
function magic.add_group(group, node_list)
|
||||
for i in ipairs(node_list) do
|
||||
magic.add_group_to_node(node_list[i], group)
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------
|
||||
-- OTHER UTILITIES ----------------------------------------------
|
||||
-----------------------------------------------------------------
|
||||
function magic.is_near_to_magic(pos, radius)
|
||||
return minetest.find_node_near(pos, radius, {"magic:magicalcobble", "magic:magicalwater_source", "magic:magicalwater_flowing"})
|
||||
end
|
|
@ -1,4 +0,0 @@
|
|||
default
|
||||
bucket
|
||||
walls
|
||||
stairs
|
|
@ -1,52 +0,0 @@
|
|||
-----------------------------------------------------------------
|
||||
-- HOME WARP LOGIC ----------------------------------------------
|
||||
-----------------------------------------------------------------
|
||||
|
||||
function magic.loadHomes()
|
||||
local fh,err = io.open(magic.worldpath .. "/magic_homes.txt", "r")
|
||||
if err then
|
||||
print("No existing warps to read.")
|
||||
return
|
||||
end
|
||||
while true do
|
||||
local line = fh:read()
|
||||
if line == nil then
|
||||
break
|
||||
end
|
||||
local paramlist = string.split(line, " ")
|
||||
local w = {
|
||||
player = paramlist[1],
|
||||
homepos = {
|
||||
x = tonumber(paramlist[2]),
|
||||
y = tonumber(paramlist[3]),
|
||||
z = tonumber(paramlist[4]),
|
||||
},
|
||||
token = paramlist[5],
|
||||
}
|
||||
table.insert(magic.playerHomes, w)
|
||||
end
|
||||
fh:close()
|
||||
end
|
||||
|
||||
function magic.saveHomes()
|
||||
local fh,err = io.open(magic.worldpath .. "/magic_homes.txt", "w")
|
||||
if err then
|
||||
print("No existing warps to read.")
|
||||
return
|
||||
end
|
||||
for i = 1,table.getn(magic.playerHomes) do
|
||||
local s = magic.playerHomes[i].player .. " " .. magic.playerHomes[i].homepos.x .. " " .. magic.playerHomes[i].homepos.y .. " " .. magic.playerHomes[i].homepos.z .. " " .. magic.playerHomes[i].token .. "\n"
|
||||
fh:write(s)
|
||||
end
|
||||
fh:close()
|
||||
end
|
||||
|
||||
function magic.checkHome(player)
|
||||
for i = 1,table.getn(magic.playerHomes) do
|
||||
if magic.playerHomes[i].player == player then
|
||||
return i
|
||||
end
|
||||
end
|
||||
|
||||
return -1
|
||||
end
|
|
@ -1,34 +0,0 @@
|
|||
-- Definitions made by this mod that other mods can use too
|
||||
magic = {}
|
||||
magic.recipes = {}
|
||||
magic.rituals = {}
|
||||
magic.playerHomes = {}
|
||||
magic.path = minetest.get_modpath("magic")
|
||||
magic.worldpath = minetest.get_worldpath()
|
||||
|
||||
-- Load files
|
||||
dofile(magic.path.."/functions/homewarp.lua")
|
||||
dofile(magic.path.."/api.lua")
|
||||
|
||||
dofile(magic.path.."/items/wand.lua")
|
||||
dofile(magic.path.."/items/home_stone.lua")
|
||||
|
||||
dofile(magic.path.."/nodes/magical_altar.lua")
|
||||
dofile(magic.path.."/nodes/magical_cobble.lua")
|
||||
dofile(magic.path.."/nodes/magical_lightbloom.lua")
|
||||
dofile(magic.path.."/nodes/magical_obsidian.lua")
|
||||
dofile(magic.path.."/nodes/magical_water.lua")
|
||||
|
||||
dofile(magic.path.."/recipes/t0_begining.lua")
|
||||
dofile(magic.path.."/recipes/t1_altar.lua")
|
||||
dofile(magic.path.."/recipes/t1_big_tree.lua")
|
||||
dofile(magic.path.."/recipes/t1_compass.lua")
|
||||
dofile(magic.path.."/recipes/t1_home_stone.lua")
|
||||
dofile(magic.path.."/recipes/t1_home_warp.lua")
|
||||
dofile(magic.path.."/recipes/t2_lightbloom.lua")
|
||||
|
||||
dofile(magic.path.."/tiers.lua")
|
||||
|
||||
magic.loadHomes()
|
||||
|
||||
-- 927 líneas de código
|
|
@ -1,9 +0,0 @@
|
|||
minetest.register_craftitem("magic:home_stone",{
|
||||
description = "Home stone",
|
||||
inventory_image = "home_stone.png",
|
||||
stack_max = 1,
|
||||
|
||||
on_use = function(itemstack, placer, pointed_thing)
|
||||
magic.warp(placer)
|
||||
end,
|
||||
})
|
|
@ -1,56 +0,0 @@
|
|||
-----------------------------------------------------------------
|
||||
-- WAND -------------------------------------------
|
||||
-----------------------------------------------------------------
|
||||
minetest.register_craftitem("magic:wand",{
|
||||
description = "Magical wand",
|
||||
inventory_image = "magic_wand.png",
|
||||
stack_max = 1,
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
magic.do_spell(itemstack, placer, pointed_thing)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.override_item("default:stick",{
|
||||
liquids_pointable = true,
|
||||
})
|
||||
|
||||
minetest.override_item("default:leaves",{
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
if itemstack:get_name() == "default:sapling" then
|
||||
if magic.check_recipe("begining", pointed_thing) then
|
||||
magic.recipes["begining"][2](pointed_thing)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
--[[on_use = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type == "object" then
|
||||
pointed_thing.ref:punch(user, 1.0, { full_punch_interval=1.0 }, nil)
|
||||
return user:get_wielded_item()
|
||||
elseif pointed_thing.type ~= "node" then
|
||||
-- do nothing if it's neither object nor node
|
||||
return
|
||||
end
|
||||
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
local liquiddef = bucket.liquids[node.name]
|
||||
local item_count = user:get_wielded_item():get_count()
|
||||
|
||||
if liquiddef ~= nil and liquiddef.itemname ~= nil and (node.name == "magic:magicalwater_source" or node.name == "magic:magicalwater_flowing") then
|
||||
return ItemStack("magic:wand")
|
||||
elseif node.name == "default:leaves" then
|
||||
if magic.check_recipe("begining", pointed_thing) then
|
||||
magic.recipes["begining"][2](pointed_thing)
|
||||
end
|
||||
end
|
||||
|
||||
--return itemstack
|
||||
end,
|
||||
|
||||
|
||||
|
||||
minetest.env:add_item(user:get_pos(), "magic:wand")
|
||||
itemstack:take_item()
|
||||
return itemstack
|
||||
]]--
|
|
@ -1,28 +0,0 @@
|
|||
minetest.register_node("magic:magical_altar", {
|
||||
description = "Magical altar",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"altar_top.png","altar_top.png","altar_side.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -0.19, 0.5},
|
||||
},
|
||||
groups = {cracky = 2, stone = 1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
local p = pos
|
||||
p.x = p.x + math.random(-4, 4)/10
|
||||
p.z = p.z + math.random(-4, 4)/10
|
||||
|
||||
minetest.env:add_item(p, itemstack:get_name())
|
||||
itemstack:take_item()
|
||||
player:set_wielded_item(itemstack)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.override_item("stairs:slab_stone_block",{
|
||||
liquids_pointable = true,
|
||||
})
|
|
@ -1,66 +0,0 @@
|
|||
-- Agua mágica, su cubo y la fuenta donde se puede encontrar
|
||||
|
||||
minetest.register_node("magic:magicalcobble", {
|
||||
description = "Magical Cobblestone",
|
||||
tiles = {
|
||||
{
|
||||
name = "magic_magicalcobble_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 10.0,
|
||||
},
|
||||
},
|
||||
},
|
||||
special_tiles = {
|
||||
-- New-style water source material (mostly unused)
|
||||
{
|
||||
name = "magic_magicalcobble_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 10.0,
|
||||
},
|
||||
--backface_culling = false,
|
||||
},
|
||||
},
|
||||
light_source = 5,
|
||||
paramtype = "light",
|
||||
drop = "default:cobble",
|
||||
groups = {cracky = 2, stone = 1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
walls.register("magic:magicalcobble_wall", "Magical Cobblestone Wall", "magic_magicalcobble.png",
|
||||
"magic:magicalcobble", default.node_sound_stone_defaults())
|
||||
minetest.override_item("magic:magicalcobble_wall",{
|
||||
tiles = {
|
||||
{
|
||||
name = "magic_magicalcobble_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 10.0,
|
||||
},
|
||||
},
|
||||
},
|
||||
special_tiles = {
|
||||
-- New-style water source material (mostly unused)
|
||||
{
|
||||
name = "magic_magicalcobble_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 10.0,
|
||||
},
|
||||
--backface_culling = false,
|
||||
},
|
||||
},
|
||||
light_source = 5,
|
||||
paramtype = "light",
|
||||
drop = "walls:cobble",
|
||||
})
|
|
@ -1,21 +0,0 @@
|
|||
minetest.register_node("magic:lightbloom", {
|
||||
description = "Lightbloom",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
tiles = {"magic_lightbloom.png"},
|
||||
inventory_image = "magic_lightbloom.png",
|
||||
wield_image = "magic_lightbloom.png",
|
||||
light_source = 15,
|
||||
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
stack_max = 64,
|
||||
groups = {snappy = 3, flower = 1, flora = 1, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-2 / 16, -0.5, -2 / 16, 2 / 16, 2 / 16, 2 / 16},
|
||||
}
|
||||
})
|
|
@ -1,49 +0,0 @@
|
|||
minetest.register_node("magic:magicalobsidian", {
|
||||
description = "Magical Obsidian",
|
||||
tiles = {
|
||||
{
|
||||
name = "magic_magicalobsidian_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 10.0,
|
||||
},
|
||||
},
|
||||
},
|
||||
special_tiles = {
|
||||
-- New-style water source material (mostly unused)
|
||||
{
|
||||
name = "magic_magicalobsidian_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 10.0,
|
||||
},
|
||||
--backface_culling = false,
|
||||
},
|
||||
},
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
meta:from_table(oldmetadata)
|
||||
|
||||
local s = meta:get_string("magic_referido")
|
||||
|
||||
local home = magic.checkHome(s)
|
||||
if home ~= -1 then
|
||||
if magic.playerHomes[home].token == meta:get_string("magic_token") then
|
||||
table.remove(magic.playerHomes,home)
|
||||
magic.saveHomes()
|
||||
end
|
||||
end
|
||||
return
|
||||
end,
|
||||
|
||||
drop = "default:obsidian",
|
||||
light_source = 5,
|
||||
paramtype = "light",
|
||||
groups = {cracky = 2, stone = 1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
|
@ -1,129 +0,0 @@
|
|||
-----------------------------------------------------------------
|
||||
-- MAGICAL WATER AND THE BUCKET ---------------------------------
|
||||
-----------------------------------------------------------------
|
||||
|
||||
local function get_wand(pos, node, player, itemstack, pointed_thing)
|
||||
local p = pos
|
||||
p.y = p.y + 1
|
||||
|
||||
if itemstack:get_name() == "default:stick" then
|
||||
minetest.env:add_item(p, "magic:wand")
|
||||
|
||||
itemstack:take_item()
|
||||
player:set_wielded_item(itemstack)
|
||||
elseif itemstack:get_name() == "stairs:slab_stone_block" then
|
||||
minetest.env:add_item(p, "magic:magical_altar")
|
||||
|
||||
itemstack:take_item()
|
||||
player:set_wielded_item(itemstack)
|
||||
end
|
||||
end
|
||||
minetest.register_node("magic:magicalwater_source", {
|
||||
description = "Magical Water Source",
|
||||
drawtype = "liquid",
|
||||
tiles = {
|
||||
{
|
||||
name = "magic_magicalwater_source_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 2.0,
|
||||
},
|
||||
},
|
||||
},
|
||||
special_tiles = {
|
||||
-- New-style water source material (mostly unused)
|
||||
{
|
||||
name = "magic_magicalwater_source_animated.png",
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 2.0,
|
||||
},
|
||||
backface_culling = false,
|
||||
},
|
||||
},
|
||||
light_source = 5,
|
||||
alpha = 160,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "magic:magicalwater_flowing",
|
||||
liquid_alternative_source = "magic:magicalwater_source",
|
||||
liquid_viscosity = 1,
|
||||
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
|
||||
groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1},
|
||||
sounds = default.node_sound_water_defaults(),
|
||||
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
get_wand(pos, node, player, itemstack, pointed_thing)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("magic:magicalwater_flowing", {
|
||||
description = "Flowing Magical Water",
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {"magic_magicalwater.png"},
|
||||
special_tiles = {
|
||||
{
|
||||
name = "magic_magicalwater_flowing_animated.png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 0.8,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "magic_magicalwater_flowing_animated.png",
|
||||
backface_culling = true,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 0.8,
|
||||
},
|
||||
},
|
||||
},
|
||||
light_source = 5,
|
||||
alpha = 160,
|
||||
paramtype = "light",
|
||||
paramtype2 = "flowingliquid",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "magic:magicalwater_flowing",
|
||||
liquid_alternative_source = "magic:magicalwater_source",
|
||||
liquid_viscosity = 1,
|
||||
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
|
||||
groups = {water = 3, liquid = 3, puts_out_fire = 1,
|
||||
not_in_creative_inventory = 1, cools_lava = 1},
|
||||
sounds = default.node_sound_water_defaults(),
|
||||
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
get_wand(pos, node, player, itemstack, pointed_thing)
|
||||
end,
|
||||
})
|
||||
|
||||
bucket.register_liquid(
|
||||
"magic:magicalwater_source",
|
||||
"magic:magicalwater_flowing",
|
||||
"magic:bucket_magicalwater",
|
||||
"bucket_magicalwater.png",
|
||||
"Magical Water Bucket",
|
||||
{water_bucket = 1}
|
||||
)
|
|
@ -1,25 +0,0 @@
|
|||
-----------------------------------------------------------------
|
||||
-- BEGINING RECIPE (Creates the Magical Water Source) -----------
|
||||
-----------------------------------------------------------------
|
||||
|
||||
magic.register_recipe("begining",
|
||||
{
|
||||
{
|
||||
{"", "", "", "default:cobble", "", "", "",},
|
||||
{"", "", "default:cobble", "default:cobble", "default:cobble", "", "",},
|
||||
{"", "default:cobble", "air", "default:cobble", "air", "default:cobble", "",},
|
||||
{"default:cobble", "default:cobble", "default:cobble", "default:leaves", "default:cobble", "default:cobble", "default:cobble",},
|
||||
{"", "default:cobble", "air", "default:cobble", "air", "default:cobble", "",},
|
||||
{"", "", "default:cobble", "default:cobble", "default:cobble", "", "",},
|
||||
{"", "", "", "default:cobble", "", "", "",},
|
||||
},
|
||||
},
|
||||
function(node)
|
||||
local posx = node.under.x - 3
|
||||
local posy = node.under.y
|
||||
local posz = node.under.z - 3
|
||||
|
||||
local sch = magic.path .. "/schems/magical_font.mts"
|
||||
minetest.place_schematic({x = posx, y = posy, z = posz}, sch, 0, nil, true)
|
||||
end
|
||||
)
|
|
@ -1,72 +0,0 @@
|
|||
magic.register_recipe("altar",
|
||||
{
|
||||
{
|
||||
{"", "", "", "", "", "tier1", "tier1", "tier1", "", "", "", "", ""},
|
||||
{"", "", "", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "", "", ""},
|
||||
{"", "", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "", ""},
|
||||
{"", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", ""},
|
||||
{"", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", ""},
|
||||
{"tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1"},
|
||||
{"tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1"},
|
||||
{"tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1"},
|
||||
{"", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", ""},
|
||||
{"", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", ""},
|
||||
{"", "", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "", ""},
|
||||
{"", "", "", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "tier1", "", "", ""},
|
||||
{"", "", "", "", "", "tier1", "tier1", "tier1", "", "", "", "", ""},
|
||||
},
|
||||
{
|
||||
{"", "", "", "", "", "default:stone_block", "air", "default:stone_block", "", "", "", "", ""},
|
||||
{"", "", "", "air", "default:stone_block", "air", "air", "air", "default:stone_block", "air", "", "", ""},
|
||||
{"", "", "default:stone_block", "air", "air", "air", "air", "air", "air", "air", "default:stone_block", "", ""},
|
||||
{"", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", ""},
|
||||
{"", "default:stone_block", "air", "air", "air", "air", "air", "air", "air", "air", "air", "default:stone_block", ""},
|
||||
{"default:stone_block", "air", "air", "air", "air", "stairs:slab_stone_block", "stairs:stair_stone_block", "stairs:slab_stone_block", "air", "air", "air", "air", "default:stone_block"},
|
||||
{"air", "air", "air", "air", "air", "stairs:stair_stone_block", "default:stone_block", "stairs:stair_stone_block", "air", "air", "air", "air", "air"},
|
||||
{"default:stone_block", "air", "air", "air", "air", "stairs:slab_stone_block", "stairs:stair_stone_block", "stairs:slab_stone_block", "air", "air", "air", "air", "default:stone_block"},
|
||||
{"", "default:stone_block", "air", "air", "air", "air", "air", "air", "air", "air", "air", "default:stone_block", ""},
|
||||
{"", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", ""},
|
||||
{"", "", "default:stone_block", "air", "air", "air", "air", "air", "air", "air", "default:stone_block", "", ""},
|
||||
{"", "", "", "air", "default:stone_block", "air", "air", "air", "default:stone_block", "air", "", "", ""},
|
||||
{"", "", "", "", "", "default:stone_block", "air", "default:stone_block", "", "", "", "", ""},
|
||||
},
|
||||
{
|
||||
{"", "", "", "", "", "t_altar", "air", "t_altar", "", "", "", "", ""},
|
||||
{"", "", "", "air", "t_altar", "air", "air", "air", "t_altar", "air", "", "", ""},
|
||||
{"", "", "t_altar", "air", "air", "air", "air", "air", "air", "air", "t_altar", "", ""},
|
||||
{"", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", ""},
|
||||
{"", "t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar", ""},
|
||||
{"t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar"},
|
||||
{"air", "air", "air", "air", "air", "air", "magic:magical_altar", "air", "air", "air", "air", "air", "air"},
|
||||
{"t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar"},
|
||||
{"", "t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar", ""},
|
||||
{"", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", ""},
|
||||
{"", "", "t_altar", "air", "air", "air", "air", "air", "air", "air", "t_altar", "", ""},
|
||||
{"", "", "", "air", "t_altar", "air", "air", "air", "t_altar", "air", "", "", ""},
|
||||
{"", "", "", "", "", "t_altar", "air", "t_altar", "", "", "", "", ""},
|
||||
},
|
||||
{
|
||||
{"", "", "", "", "", "t_altar", "t_altar", "t_altar", "", "", "", "", ""},
|
||||
{"", "", "", "t_altar", "t_altar", "air", "air", "air", "t_altar", "t_altar", "", "", ""},
|
||||
{"", "", "t_altar", "air", "air", "air", "air", "air", "air", "air", "t_altar", "", ""},
|
||||
{"", "t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar", ""},
|
||||
{"", "t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar", ""},
|
||||
{"t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar"},
|
||||
{"t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar"},
|
||||
{"t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar"},
|
||||
{"", "t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar", ""},
|
||||
{"", "t_altar", "air", "air", "air", "air", "air", "air", "air", "air", "air", "t_altar", ""},
|
||||
{"", "", "t_altar", "air", "air", "air", "air", "air", "air", "air", "t_altar", "", ""},
|
||||
{"", "", "", "t_altar", "t_altar", "air", "air", "air", "t_altar", "t_altar", "", "", ""},
|
||||
{"", "", "", "", "", "t_altar", "t_altar", "t_altar", "", "", "", "", ""},
|
||||
},
|
||||
},
|
||||
function(node, player)
|
||||
if not magic.is_near_to_magic(node.under, 10) then
|
||||
minetest.chat_send_player(player:get_player_name(), "[Mod Magic] Needs to be near to a magic source")
|
||||
return
|
||||
end
|
||||
|
||||
magic.do_ritual(node, player)
|
||||
end
|
||||
)
|
|
@ -1,29 +0,0 @@
|
|||
-----------------------------------------------------------------
|
||||
-- BIG TREE RECIPE ----------------------------------------------
|
||||
-----------------------------------------------------------------
|
||||
|
||||
-- ToDo: Spawn different trees for different randomly and
|
||||
-- different type of tree for different type of sappling
|
||||
|
||||
magic.register_recipe("big_tree",
|
||||
{
|
||||
{
|
||||
{"default:dirt_with_grass", "field", "default:dirt_with_grass",},
|
||||
{"field", "", "field",},
|
||||
{"field", "default:dirt_with_grass", "field",},
|
||||
},
|
||||
{
|
||||
{"air", "air", "air",},
|
||||
{"air", "default:sapling", "air",},
|
||||
{"air", "air", "air",},
|
||||
},
|
||||
},
|
||||
function(node)
|
||||
local posx = node.under.x - 5
|
||||
local posy = node.under.y
|
||||
local posz = node.under.z - 7
|
||||
|
||||
local sch = magic.path .. "/schems/magical_big_tree.mts"
|
||||
minetest.place_schematic({x = posx, y = posy, z = posz}, sch, 0, nil, true)
|
||||
end
|
||||
)
|
|
@ -1,33 +0,0 @@
|
|||
-----------------------------------------------------------------
|
||||
-- COMPASS RECIPE -----------------------------------------------
|
||||
-----------------------------------------------------------------
|
||||
|
||||
magic.register_recipe("compass",
|
||||
{
|
||||
{
|
||||
{"tier1", "air", "tier1",},
|
||||
{"air", "tier1", "air",},
|
||||
{"tier1", "air", "tier1",},
|
||||
},
|
||||
},
|
||||
function(node)
|
||||
local posx = node.under.x
|
||||
local posy = node.under.y
|
||||
local posz = node.under.z
|
||||
|
||||
local nod = minetest.get_node({x = posx - 1, y = posy, z = posz + 1})
|
||||
minetest.set_node({x = posx - 1, y = posy, z = posz}, {name = nod.name})
|
||||
minetest.set_node({x = posx - 1, y = posy, z = posz + 1}, {name = "air"})
|
||||
|
||||
nod = minetest.get_node({x = posx + 1, y = posy, z = posz + 1})
|
||||
minetest.set_node({x = posx + 1, y = posy, z = posz}, {name = nod.name})
|
||||
minetest.set_node({x = posx + 1, y = posy, z = posz + 1}, {name = "air"})
|
||||
|
||||
nod = minetest.get_node(node.under)
|
||||
minetest.set_node({x = posx, y = posy, z = posz + 1}, {name = nod.name})
|
||||
minetest.set_node({x = posx, y = posy, z = posz}, {name = "air"})
|
||||
|
||||
--local sch = magic.path .. "/schems/compass.mts"
|
||||
--minetest.place_schematic({x = posx, y = posy, z = posz}, sch, 0, nil, true)
|
||||
end
|
||||
)
|
|
@ -1,63 +0,0 @@
|
|||
-----------------------------------------------------------------
|
||||
-- HOME STONE RECIPE --------------------------------------------
|
||||
-----------------------------------------------------------------
|
||||
|
||||
magic.register_recipe("home_stone",
|
||||
{
|
||||
{
|
||||
{"","","","","","","","","","","","",""},
|
||||
{"","","","","","","","","","","","",""},
|
||||
{"","","","","","","","","","","","",""},
|
||||
{"","","","","","","","","","","","",""},
|
||||
{"","","","","","","","","","","","",""},
|
||||
{"","","","","","","","","","","","",""},
|
||||
{"","","","","","","","","","","","",""},
|
||||
{"","","","","","","","","","","","",""},
|
||||
{"","","","","","","","","","","","",""},
|
||||
{"","","","","","","","","","","","",""},
|
||||
{"","","","","","","","","","","","",""},
|
||||
{"","","","","","","","","","","","",""},
|
||||
{"","","","","","","","","","","","",""},
|
||||
},
|
||||
{
|
||||
{"","","","","","","default:cobble","","","","","",""},
|
||||
{"","","","default:cobble","air","air","air","air","air","default:cobble","","",""},
|
||||
{"","","air","air","air","air","air","air","air","air","air","",""},
|
||||
{"","default:cobble","air","air","air","air","air","air","air","air","air","default:cobble",""},
|
||||
{"","air","air","air","air","air","air","air","air","air","air","air",""},
|
||||
{"air","air","air","air","air","air","stairs:slab_cobble","air","air","air","air","air","air"},
|
||||
{"default:cobble","air","air","air","air","stairs:slab_cobble","default:obsidian","stairs:slab_cobble","air","air","air","air","default:cobble"},
|
||||
{"air","air","air","air","air","air","stairs:slab_cobble","air","air","air","air","air","air"},
|
||||
{"","air","air","air","air","air","air","air","air","air","air","air",""},
|
||||
{"","default:cobble","air","air","air","air","air","air","air","air","air","default:cobble",""},
|
||||
{"","","air","air","air","air","air","air","air","air","air","",""},
|
||||
{"","","","default:cobble","air","air","air","air","air","default:cobble","","",""},
|
||||
{"","","","","","","default:cobble","","","","","",""},
|
||||
},
|
||||
{
|
||||
{"","","","","","","default:cobble","","","","","",""},
|
||||
{"","","","air","air","air","air","air","air","air","","",""},
|
||||
{"","","air","air","air","air","air","air","air","air","air","",""},
|
||||
{"","air","air","air","air","air","air","air","air","air","air","air",""},
|
||||
{"","air","air","air","air","air","air","air","air","air","air","air",""},
|
||||
{"air","air","air","air","air","air","air","air","air","air","air","air","air"},
|
||||
{"default:cobble","air","air","air","air","air","air","air","air","air","air","air","default:cobble"},
|
||||
{"air","air","air","air","air","air","air","air","air","air","air","air","air"},
|
||||
{"","air","air","air","air","air","air","air","air","air","air","air",""},
|
||||
{"","air","air","air","air","air","air","air","air","air","air","air",""},
|
||||
{"","","air","air","air","air","air","air","air","air","air","",""},
|
||||
{"","","","air","air","air","air","air","air","air","","",""},
|
||||
{"","","","","","","default:cobble","","","","","",""},
|
||||
},
|
||||
},
|
||||
|
||||
function(node, player)
|
||||
if not magic.is_near_to_magic(node.under, 10) then
|
||||
minetest.chat_send_player(player:get_player_name(), "[Mod Magic] Needs to be near to a magic source")
|
||||
return
|
||||
end
|
||||
|
||||
minetest.set_node(node.under, {name="magic:magicalobsidian"})
|
||||
minetest.env:add_item({x = node.under.x, y = node.under.y + 1, z = node.under.z}, "magic:home_stone")
|
||||
end
|
||||
)
|
|
@ -1,56 +0,0 @@
|
|||
-----------------------------------------------------------------
|
||||
-- HOME WARP RECIPE ---------------------------------------------
|
||||
-----------------------------------------------------------------
|
||||
|
||||
magic.register_recipe("home_warp",
|
||||
{
|
||||
{
|
||||
{"","default:obsidian","default:obsidian","default:obsidian",""},
|
||||
{"default:obsidian","","","","default:obsidian"},
|
||||
{"","","default:obsidian","","default:obsidian"},
|
||||
{"","default:obsidian","","","default:obsidian"},
|
||||
{"","","default:obsidian","default:obsidian",""},
|
||||
},
|
||||
},
|
||||
|
||||
function(node, player)
|
||||
local posx = node.under.x
|
||||
local posy = node.under.y
|
||||
local posz = node.under.z
|
||||
|
||||
local i = -2
|
||||
local j = -2
|
||||
|
||||
|
||||
local arrID = magic.checkHome(player:get_player_name())
|
||||
|
||||
local token = node.under.x .. node.under.y .. node.under.z
|
||||
|
||||
if arrID == -1 then
|
||||
arrID = #magic.playerHomes + 1
|
||||
end
|
||||
|
||||
magic.playerHomes[arrID] = {}
|
||||
magic.playerHomes[arrID].player = player:get_player_name()
|
||||
magic.playerHomes[arrID].homepos = {x = node.under.x, y = node.under.y + 1, z = node.under.z}
|
||||
magic.playerHomes[arrID].token = token
|
||||
|
||||
magic.saveHomes()
|
||||
|
||||
while i <= 2 do
|
||||
while j <= 2 do
|
||||
if "default:obsidian" == minetest.get_node({x = posx + i, y = posy, z = posz + j}).name then
|
||||
minetest.set_node({x = posx + i, y = posy, z = posz + j}, {name="magic:magicalobsidian"})
|
||||
|
||||
local meta = minetest.get_meta({x = posx + i, y = posy, z = posz + j})
|
||||
meta:set_string("magic_referido",player:get_player_name())
|
||||
meta:set_string("magic_token",token)
|
||||
end
|
||||
j = j + 1
|
||||
end
|
||||
j = -2
|
||||
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
)
|
|
@ -1,10 +0,0 @@
|
|||
magic.register_ritual("lightbloom",
|
||||
{
|
||||
{name = "flowers:geranium", val = 1}
|
||||
},
|
||||
|
||||
function(node, player)
|
||||
magic.clear_altar(node)
|
||||
minetest.env:add_item(node.under, "magic:lightbloom")
|
||||
end
|
||||
)
|
|
@ -1,4 +0,0 @@
|
|||
[Dolphin]
|
||||
PreviewsShown=true
|
||||
Timestamp=2017,1,20,4,22,51
|
||||
Version=3
|
Before Width: | Height: | Size: 735 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 383 B |
Before Width: | Height: | Size: 430 B |
Before Width: | Height: | Size: 547 B |
Before Width: | Height: | Size: 770 B |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 665 B |
Before Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 582 B |
|
@ -1,9 +0,0 @@
|
|||
magic.add_group(
|
||||
{tier1 = 1},
|
||||
{"default:stone", "default:cobble", "default:stonebrick", "default:stone_block", "default:mossycobble", "default:desert_stone", "default:desert_cobble", "default:desert_stonebrick", "default:desert_stone_block", "default:sandstone", "default:sandstonebrick", "default:sandstone_block", "default:dirt", "default:dirt_with_grass", "default:dirt_with_grass_footsteps", "default:dirt_with_dry_grass", "default:sand", "default:desert_sand", "default:silver_sand", "default:gravel", "default:clay"}
|
||||
)
|
||||
|
||||
magic.add_group(
|
||||
{t_altar = 1},
|
||||
{"default:stone", "default:cobble", "default:mossycobble"}
|
||||
)
|
|
@ -0,0 +1 @@
|
|||
../../minetest_game/mods/screwdriver/
|
|
@ -0,0 +1 @@
|
|||
../../minetest_game/mods/sethome/
|
|
@ -0,0 +1 @@
|
|||
../../minetest_game/mods/sfinv/
|
|
@ -0,0 +1 @@
|
|||
../../minetest_game/mods/stairs/
|
|
@ -0,0 +1 @@
|
|||
../../minetest_game/mods/vessels/
|
|
@ -0,0 +1 @@
|
|||
../../minetest_game/mods/walls/
|
|
@ -0,0 +1 @@
|
|||
../../minetest_game/mods/xpanes/
|