Cambiados los baules para que suelten su contenido al romperse.
Añadidos comandos. Añadido mod datalib y digicompute. -- Yawinmaster
|
@ -26,4 +26,4 @@ enable_bed_respawn = true
|
|||
enable_bed_night_skip = true
|
||||
|
||||
give_initial_stuff = true
|
||||
initial_stuff = default:pick_steel,default:axe_steel,default:shovel_steel,default:torch 32,default:cobble 32,default:wood 16
|
||||
initial_stuff = default:pick_stone,default:shovel_stone,default:axe_stone,default:torch 16,default:cobble 32,default:wood 16
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[Dolphin]
|
||||
Timestamp=2017,1,18,20,54,5
|
||||
Version=3
|
|
@ -0,0 +1,110 @@
|
|||
local init = os.clock()
|
||||
-- config zone {{{
|
||||
formats = {
|
||||
-- ["MATCH"] = {"FORMAT" COLOR PRIV}, --
|
||||
["#(.+)"] = {"*** %s: %s ***", 0xFFFF00, "server"},
|
||||
}
|
||||
DEFAULT_FORMAT = "%s: %s"
|
||||
DEFAULT_COLOR = 0xEEF3EE
|
||||
GM_PREFIX = "[Admin] "
|
||||
MESSAGES_ON_SCREEN = 10
|
||||
MAX_LENGTH = 100
|
||||
LEFT_INDENT = 0.01
|
||||
TOP_INDENT = 0.92
|
||||
FONT_WIDTH = 12
|
||||
FONT_HEIGHT = 24
|
||||
-- config zone }}}
|
||||
|
||||
firsthud = nil
|
||||
|
||||
function addMessage(player, new_text, new_color)
|
||||
local temp_text
|
||||
local temp_color
|
||||
local hud
|
||||
for id = firsthud, (firsthud+MESSAGES_ON_SCREEN-1) do
|
||||
hud = player:hud_get(id)
|
||||
if hud and hud.name == "chat" then
|
||||
temp_text = hud.text
|
||||
temp_color = hud.number
|
||||
player:hud_change(id, "number", new_color)
|
||||
player:hud_change(id, "text", new_text)
|
||||
new_text = temp_text
|
||||
new_color = temp_color
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function sendMessage(player, message, color)
|
||||
local splitter
|
||||
while message:len() > MAX_LENGTH do
|
||||
splitter = string.find (message, " ", MAX_LENGTH)
|
||||
if splitter == nil then
|
||||
splitter = MAX_LENGTH
|
||||
end
|
||||
addMessage(player, message:sub(0,splitter), color)
|
||||
message = message:sub(splitter+1)
|
||||
end
|
||||
addMessage(player, message, color)
|
||||
end
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
minetest.after(2, function(player)
|
||||
for i = 1, MESSAGES_ON_SCREEN do
|
||||
local hud_id = player:hud_add({
|
||||
hud_elem_type = "text",
|
||||
text = "",
|
||||
position = {x = LEFT_INDENT, y = TOP_INDENT},
|
||||
name = "chat",
|
||||
scale = {x=500, y=50},
|
||||
number = 0xFFFFFF,
|
||||
item = 0,
|
||||
direction = 0,
|
||||
alignment = {x=1, y=0},
|
||||
offset = {x=0, y=-i*FONT_HEIGHT}
|
||||
})
|
||||
if not firsthud then
|
||||
firsthud = hud_id
|
||||
end
|
||||
end
|
||||
end, player)
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_on_chat_message(function(name, message)
|
||||
fmt = DEFAULT_FORMAT
|
||||
color = DEFAULT_COLOR
|
||||
pl = minetest.get_player_by_name(name)
|
||||
pls = minetest.get_connected_players()
|
||||
-- formats (see config zone)
|
||||
for m, f in pairs(formats) do
|
||||
submes = string.match(message, m)
|
||||
if submes then
|
||||
if not f[3] then -- if PRIV==nil
|
||||
fmt = f[1]
|
||||
color = f[2]
|
||||
break
|
||||
elseif minetest.check_player_privs(name, {[f[3]]=true}) then
|
||||
fmt = f[1]
|
||||
color = f[2]
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not submes then
|
||||
submes = message
|
||||
end
|
||||
|
||||
|
||||
if minetest.check_player_privs(name, {["server"]=true,}) then
|
||||
name = GM_PREFIX .. name
|
||||
end
|
||||
|
||||
for i = 1, #pls do
|
||||
sendMessage(pls[i], string.format(fmt, name, submes), color)
|
||||
end
|
||||
|
||||
return true
|
||||
end)
|
||||
local time_to_load= os.clock() - init
|
||||
print(string.format("[MOD] "..minetest.get_current_modname().." loaded in %.4f s", time_to_load))
|
|
@ -0,0 +1,23 @@
|
|||
vanished_players = {}
|
||||
|
||||
minetest.register_chatcommand("vanish", {
|
||||
params = "",
|
||||
description = "Make user invisible at eye of all",
|
||||
privs = {admin = true},
|
||||
func = function(name, param)
|
||||
local prop
|
||||
vanished_players[name] = not vanished_players[name]
|
||||
|
||||
if vanished_players[name] then
|
||||
prop = {visual_size = {x=0, y=0}, collisionbox = {0,0,0,0,0,0}}
|
||||
minetest.chat_send_player(name, "Vannish Command: You are Invisible now")
|
||||
else
|
||||
-- default player size
|
||||
prop = {visual_size = {x=1, y=1},
|
||||
collisionbox = {-0.35, -1, -0.35, 0.35, 1, 0.35}}
|
||||
minetest.chat_send_player(name, "Vannish Command: You are Visible now")
|
||||
end
|
||||
|
||||
minetest.get_player_by_name(name):set_properties(prop)
|
||||
end
|
||||
})
|
|
@ -2,3 +2,5 @@ local path = minetest.get_modpath("commands")
|
|||
|
||||
dofile(path.."/info.lua")
|
||||
dofile(path.."/timeset.lua")
|
||||
dofile(path.."/gm.lua")
|
||||
dofile(path.."/kits.lua")
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
minetest.register_chatcommand("kit", {
|
||||
params = "",
|
||||
description = "Add a Kit to player",
|
||||
privs = {},
|
||||
func = function(name)
|
||||
local receiverref = core.get_player_by_name(name)
|
||||
|
||||
receiverref:get_inventory():add_item('main', 'default:pick_stone')
|
||||
receiverref:get_inventory():add_item('main', 'default:shovel_stone')
|
||||
receiverref:get_inventory():add_item('main', 'default:axe_stone')
|
||||
receiverref:get_inventory():add_item('main', 'default:sword_stone')
|
||||
end
|
||||
})
|
|
@ -0,0 +1,3 @@
|
|||
[Dolphin]
|
||||
Timestamp=2017,1,18,20,54,14
|
||||
Version=3
|
|
@ -0,0 +1,74 @@
|
|||
# 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).
|
|
@ -0,0 +1,21 @@
|
|||
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.
|
|
@ -0,0 +1,174 @@
|
|||
-- 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
|
|
@ -0,0 +1,16 @@
|
|||
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.
|
|
@ -382,7 +382,7 @@ minetest.override_item("default:lava_source", {
|
|||
stack_max = 64,
|
||||
})
|
||||
|
||||
local function get_chest_neighborpos(pos, param2, side)
|
||||
--[[local function get_chest_neighborpos(pos, param2, side)
|
||||
if side == "right" then
|
||||
if param2 == 0 then
|
||||
return {x=pos.x-1, y=pos.y, z=pos.z}
|
||||
|
@ -616,9 +616,65 @@ minetest.register_node("default_override:chest_right", {
|
|||
" takes stuff from chest at "..minetest.pos_to_string(pos))
|
||||
end,
|
||||
})
|
||||
]]--
|
||||
|
||||
minetest.override_item("default:chest",{
|
||||
stack_max = 64,
|
||||
can_dig = function(pos,player)
|
||||
return true
|
||||
end,
|
||||
on_dig = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory("main");
|
||||
|
||||
for i,stack in ipairs(inv:get_list("main")) do
|
||||
local x = math.random(-4, 4)/10
|
||||
local z = math.random(-4, 4)/10
|
||||
pos.x = pos.x + x
|
||||
pos.z = pos.z + z
|
||||
minetest.env:add_item(pos, stack)
|
||||
stack:clear()
|
||||
inv:set_stack("main", i, stack)
|
||||
pos.x = pos.x - x
|
||||
pos.z = pos.z - z
|
||||
end
|
||||
|
||||
minetest.remove_node(pos)
|
||||
return
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.override_item("default:chest_locked", {
|
||||
stack_max = 64,
|
||||
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
if has_locked_chest_privilege(meta, clicker) then
|
||||
return true;
|
||||
end
|
||||
|
||||
return false;
|
||||
end,
|
||||
on_dig = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory("main");
|
||||
|
||||
for i,stack in ipairs(inv:get_list("main")) do
|
||||
local x = math.random(-4, 4)/10
|
||||
local z = math.random(-4, 4)/10
|
||||
pos.x = pos.x + x
|
||||
pos.z = pos.z + z
|
||||
minetest.env:add_item(pos, stack)
|
||||
stack:clear()
|
||||
inv:set_stack("main", i, stack)
|
||||
pos.x = pos.x - x
|
||||
pos.z = pos.z - z
|
||||
end
|
||||
|
||||
minetest.remove_node(pos)
|
||||
return
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.override_item("default:bookshelf", {
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[Dolphin]
|
||||
Timestamp=2017,1,18,20,54,26
|
||||
Version=3
|
|
@ -0,0 +1,16 @@
|
|||
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,24 @@
|
|||
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/).
|
|
@ -0,0 +1,86 @@
|
|||
-- 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
|
|
@ -0,0 +1,8 @@
|
|||
-- 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
|
|
@ -0,0 +1,2 @@
|
|||
set_output(get_output()..get_field("input").."\n"..get_attr("name")..":~$ ") -- print input
|
||||
refresh() -- refresh
|
|
@ -0,0 +1 @@
|
|||
set_output("Welcome to BiosOS version 0.1.\n\n"..get_attr("name")..":~$ ") -- print welcome
|
|
@ -0,0 +1,137 @@
|
|||
-- 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
|
|
@ -0,0 +1,3 @@
|
|||
default
|
||||
datalib
|
||||
digilines?
|
|
@ -0,0 +1,225 @@
|
|||
-- 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
|
|
@ -0,0 +1,139 @@
|
|||
-- 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
|
|
@ -0,0 +1,45 @@
|
|||
-- 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
|
|
@ -0,0 +1,35 @@
|
|||
-- 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
|
||||
}
|
||||
},
|
||||
})
|
After Width: | Height: | Size: 395 B |
After Width: | Height: | Size: 293 B |
After Width: | Height: | Size: 288 B |
After Width: | Height: | Size: 165 B |
After Width: | Height: | Size: 258 B |
After Width: | Height: | Size: 119 B |
After Width: | Height: | Size: 116 B |
After Width: | Height: | Size: 111 B |
After Width: | Height: | Size: 129 B |
|
@ -903,13 +903,13 @@ signs_text_on_activate = function(self)
|
|||
end
|
||||
end
|
||||
|
||||
--minetest.register_entity(":signs:text", {
|
||||
-- collisionbox = { 0, 0, 0, 0, 0, 0 },
|
||||
-- visual = "upright_sprite",
|
||||
-- textures = {},
|
||||
minetest.register_entity(":signs:text", {
|
||||
collisionbox = { 0, 0, 0, 0, 0, 0 },
|
||||
visual = "upright_sprite",
|
||||
textures = {},
|
||||
|
||||
-- on_activate = signs_text_on_activate,
|
||||
--})
|
||||
on_activate = signs_text_on_activate,
|
||||
})
|
||||
|
||||
-- And the good stuff here! :-)
|
||||
|
||||
|
|
Before Width: | Height: | Size: 349 B After Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 362 B After Width: | Height: | Size: 209 B |
Before Width: | Height: | Size: 368 B After Width: | Height: | Size: 209 B |
Before Width: | Height: | Size: 362 B After Width: | Height: | Size: 208 B |
Before Width: | Height: | Size: 588 B After Width: | Height: | Size: 343 B |
Before Width: | Height: | Size: 555 B After Width: | Height: | Size: 339 B |
Before Width: | Height: | Size: 387 B After Width: | Height: | Size: 208 B |
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 207 B |
Before Width: | Height: | Size: 345 B After Width: | Height: | Size: 207 B |
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 210 B |
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 209 B |
Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 206 B |
|
@ -0,0 +1,16 @@
|
|||
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,11 @@
|
|||
MicroExpansion - ME [microexpansion]
|
||||
====================================
|
||||
* Version 0.1, unstable
|
||||
* Licence: MIT (see LICENSE)
|
||||
* [Github Repository](https://github.com/octacian/microexpansion)
|
||||
|
||||
When you really get into a survival world, you typically end up with a lot of items, like a ton of items. Sometimes literally. But with that huge amount of resources, comes something annoying and unwanted: chests. Well, of course. You have to have chests to store items, but no biggie, it's just chests. Then your storage room starts to grow, soon you have 25 chests, then 50, then 100. Management gets kinda hard. MicroExpansion, is the solution.
|
||||
|
||||
Media
|
||||
-----
|
||||
Unless otherwise mentioned, all media (textures, models) are licensed under [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/), property of the [Applied Energistics 2 (AE)](http://ae-mod.info/) mod for Minecraft and its contributors.
|
|
@ -0,0 +1,79 @@
|
|||
-- microexpansion/api.lua
|
||||
local BASENAME = "microexpansion"
|
||||
|
||||
-- [local function] register recipe
|
||||
local function register_recipe(output, recipe)
|
||||
local function isint(n)
|
||||
return n==math.floor(n)
|
||||
end
|
||||
|
||||
local function getAmount()
|
||||
if isint(recipe[2][1]) then
|
||||
local q = recipe[2][1]
|
||||
recipe[2][1] = nil
|
||||
return q
|
||||
else return 1 end
|
||||
end
|
||||
|
||||
local function register(amount, recipe)
|
||||
minetest.register_craft({
|
||||
output = output.." "..amount,
|
||||
recipe = recipe,
|
||||
})
|
||||
end
|
||||
|
||||
local function single()
|
||||
register(getAmount(), recipe[2])
|
||||
end
|
||||
|
||||
local function multiple()
|
||||
for i, item in ipairs(recipe) do
|
||||
if i == 0 then return end
|
||||
register(getAmount(), recipe[i])
|
||||
end
|
||||
end
|
||||
|
||||
-- check type
|
||||
if recipe[1] == "single" then single()
|
||||
elseif recipe[1] == "multiple" then multiple()
|
||||
else return microexpansion.log("invalid recipe for definition "..output..". "..dump(recipe[2])) end
|
||||
end
|
||||
|
||||
-- [function] register item
|
||||
function microexpansion.register_item(itemstring, def)
|
||||
-- usedfor
|
||||
if def.usedfor then
|
||||
def.description = def.description .. "\nfor " .. def.usedfor
|
||||
end
|
||||
|
||||
-- register craftitem
|
||||
minetest.register_craftitem(BASENAME..":"..itemstring, {
|
||||
description = def.description,
|
||||
inventory_image = def.inventory_image,
|
||||
})
|
||||
|
||||
-- if recipe, register recipe
|
||||
if def.recipe then
|
||||
register_recipe(BASENAME..":"..itemstring, def.recipe)
|
||||
end
|
||||
end
|
||||
|
||||
-- [function] register cell
|
||||
function microexpansion.register_cell(itemstring, def)
|
||||
-- register craftitem
|
||||
minetest.register_craftitem(BASENAME..":"..itemstring, {
|
||||
description = def.description,
|
||||
inventory_image = def.inventory_image,
|
||||
me_storage = {
|
||||
max_items = def.stacks or 5000,
|
||||
},
|
||||
})
|
||||
|
||||
-- if recipe, register recipe
|
||||
if def.recipe then
|
||||
-- if recipe, register recipe
|
||||
if def.recipe then
|
||||
register_recipe(BASENAME..":"..itemstring, def.recipe)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,15 @@
|
|||
-- microexpansion/init.lua
|
||||
microexpansion = {}
|
||||
microexpansion.modpath = minetest.get_modpath("microexpansion") -- modpath
|
||||
local modpath = microexpansion.modpath -- modpath pointer
|
||||
|
||||
-- logger
|
||||
function microexpansion.log(content, log_type)
|
||||
if not content then return false end
|
||||
if log_type == nil then log_type = "action" end
|
||||
minetest.log(log_type, "[MicroExpansion] "..content)
|
||||
end
|
||||
|
||||
-- load files
|
||||
dofile(modpath.."/api.lua") -- API
|
||||
dofile(modpath.."/storage.lua") -- storage cells
|
|
@ -0,0 +1,39 @@
|
|||
-- microexpansion/storage.lua
|
||||
|
||||
--[[
|
||||
__ __ _ ___ _ _ _ ___ ___ ___
|
||||
| \/ | /_\ |_ _| \| | | | / _ \ / _ \| _ \
|
||||
| |\/| |/ _ \ | || .` | | |_| (_) | (_) | _/
|
||||
|_| |_/_/ \_\___|_|\_| |____\___/ \___/|_|
|
||||
|
||||
]]
|
||||
|
||||
local LIST = {
|
||||
1, 4, 16, 64,
|
||||
}
|
||||
|
||||
-- [loop] register storage components and cells
|
||||
for i=1,4 do
|
||||
i = LIST[i]
|
||||
-- cell
|
||||
microexpansion.register_cell("storage_"..i.."k", {
|
||||
description = i.."k ME Storage Cell",
|
||||
inventory_image = "storage_cell_"..i.."k.png",
|
||||
max_items = i..000,
|
||||
recipe = {
|
||||
"single",
|
||||
{ 1,
|
||||
{ "default:obsidian_glass", "default:gold_ingot", "default:obsidian_glass" },
|
||||
{ "default:gold_ingot", "microexpansion:storage_comp_"..i.."k", "default:gold_ingot" },
|
||||
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" },
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
-- component
|
||||
microexpansion.register_item("storage_comp_"..i.."k", {
|
||||
description = i.."k ME Storage Component",
|
||||
inventory_image = "material_cell"..i.."k_part.png",
|
||||
usedfor = i.." ME storage cell",
|
||||
})
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
[Dolphin]
|
||||
PreviewsShown=true
|
||||
Timestamp=2017,1,18,0,59,13
|
||||
Version=3
|
After Width: | Height: | Size: 394 B |
After Width: | Height: | Size: 385 B |
After Width: | Height: | Size: 394 B |
After Width: | Height: | Size: 416 B |
After Width: | Height: | Size: 432 B |
After Width: | Height: | Size: 421 B |
After Width: | Height: | Size: 426 B |
After Width: | Height: | Size: 426 B |
|
@ -0,0 +1,42 @@
|
|||
=== MOBS-MOD for MINETEST-C55 ===
|
||||
by PilzAdam
|
||||
|
||||
Inroduction:
|
||||
This mod adds some basic hostile and friendly mobs to the game.
|
||||
|
||||
How to install:
|
||||
Unzip the archive an place it in minetest-base-directory/mods/minetest/
|
||||
if you have a windows client or a linux run-in-place client. If you have
|
||||
a linux system-wide instalation place it in ~/.minetest/mods/minetest/.
|
||||
If you want to install this mod only in one world create the folder
|
||||
worldmods/ in your worlddirectory.
|
||||
For further information or help see:
|
||||
http://wiki.minetest.com/wiki/Installing_Mods
|
||||
|
||||
How to use the mod:
|
||||
See https://github.com/PilzAdam/mobs/wiki
|
||||
|
||||
For developers:
|
||||
The API documentation is moved to https://github.com/PilzAdam/mobs/wiki/API
|
||||
|
||||
License:
|
||||
Sourcecode: WTFPL (see below)
|
||||
Grahpics: WTFPL (see below)
|
||||
Models: WTFPL (by Pavel_S, see below)
|
||||
|
||||
See also:
|
||||
http://minetest.net/
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
|
@ -0,0 +1,559 @@
|
|||
dofile(minetest.get_modpath("mobs").."/api.lua")
|
||||
|
||||
-- Mouton
|
||||
dofile(minetest.get_modpath("mobs").."/sheep.lua")
|
||||
|
||||
|
||||
mobs:register_mob("mobs:dirt_monster", {
|
||||
type = "monster",
|
||||
hp_max = 25,
|
||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
|
||||
visual = "mesh",
|
||||
mesh = "mobs_stone_monster.x",
|
||||
textures = {"mobs_dirt_monster.png"},
|
||||
visual_size = {x = 3, y = 2.6},
|
||||
makes_footstep_sound = true,
|
||||
view_range = 12,
|
||||
walk_velocity = 1.1,
|
||||
run_velocity = 2.6,
|
||||
on_rightclick = nil,
|
||||
damage = 4,
|
||||
drops = {
|
||||
name = "default:dirt",
|
||||
chance = 1,
|
||||
min = 4,
|
||||
max = 4,
|
||||
-- {name = "maptools:silver_coin",
|
||||
-- chance = 1,
|
||||
-- min = 2,
|
||||
-- max = 2,},
|
||||
},
|
||||
armor = 100,
|
||||
drawtype = "front",
|
||||
lava_damage = 8,
|
||||
light_damage = 1,
|
||||
attack_type = "dogfight",
|
||||
animation = {
|
||||
speed_normal = 18,
|
||||
speed_run = 50,
|
||||
stand_start = 0,
|
||||
stand_end = 14,
|
||||
walk_start = 15,
|
||||
walk_end = 38,
|
||||
run_start = 40,
|
||||
run_end = 63,
|
||||
punch_start = 40,
|
||||
punch_end = 63,
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mobs:dirt_monster", {
|
||||
description = "Dirt Monster",
|
||||
inventory_image = "mobs_dirt_monster.png",
|
||||
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.above then
|
||||
minetest.add_entity(pointed_thing.above, "mobs:dirt_monster")
|
||||
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
|
||||
minetest.log("action", placer:get_player_name() .. " placed a dirt monster at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
mobs:register_mob("mobs:stone_monster", {
|
||||
type = "monster",
|
||||
hp_max = 30,
|
||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
|
||||
visual = "mesh",
|
||||
mesh = "mobs_stone_monster.x",
|
||||
textures = {"mobs_stone_monster.png"},
|
||||
visual_size = {x = 3, y = 2.6},
|
||||
makes_footstep_sound = true,
|
||||
view_range = 16,
|
||||
walk_velocity = 0.4,
|
||||
run_velocity = 1.8,
|
||||
damage = 6,
|
||||
drops = {
|
||||
{name = "default:stone",
|
||||
chance = 1,
|
||||
min = 4,
|
||||
max = 4,},
|
||||
-- {name = "maptools:silver_coin",
|
||||
-- chance = 1,
|
||||
-- min = 3,
|
||||
-- max = 3,},
|
||||
},
|
||||
armor = 80,
|
||||
drawtype = "front",
|
||||
light_damage = 1,
|
||||
attack_type = "dogfight",
|
||||
animation = {
|
||||
speed_normal = 8,
|
||||
speed_run = 40,
|
||||
stand_start = 0,
|
||||
stand_end = 14,
|
||||
walk_start = 15,
|
||||
walk_end = 38,
|
||||
run_start = 40,
|
||||
run_end = 63,
|
||||
punch_start = 40,
|
||||
punch_end = 63,
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mobs:stone_monster", {
|
||||
description = "Stone Monster",
|
||||
inventory_image = "mobs_stone_monster.png",
|
||||
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.above then
|
||||
minetest.add_entity(pointed_thing.above, "mobs:stone_monster")
|
||||
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
|
||||
minetest.log("action", placer:get_player_name() .. " placed a stone monster at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
mobs:register_mob("mobs:sand_monster", {
|
||||
type = "monster",
|
||||
hp_max = 15,
|
||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
|
||||
visual = "mesh",
|
||||
mesh = "mobs_sand_monster.x",
|
||||
textures = {"mobs_sand_monster.png"},
|
||||
visual_size = {x =8,y =8},
|
||||
makes_footstep_sound = true,
|
||||
view_range = 20,
|
||||
walk_velocity = 1.8,
|
||||
run_velocity = 3.6,
|
||||
damage = 2,
|
||||
drops = {
|
||||
{name = "default:sand",
|
||||
chance = 1,
|
||||
min = 4,
|
||||
max = 4,},
|
||||
-- {name = "maptools:silver_coin",
|
||||
-- chance = 1,
|
||||
-- min = 3,
|
||||
-- max = 3,},
|
||||
},
|
||||
armor = 100,
|
||||
drawtype = "front",
|
||||
lava_damage = 8,
|
||||
light_damage = 1,
|
||||
attack_type = "dogfight",
|
||||
animation = {
|
||||
speed_normal = 35,
|
||||
speed_run = 45,
|
||||
stand_start = 0,
|
||||
stand_end = 39,
|
||||
walk_start = 41,
|
||||
walk_end = 72,
|
||||
run_start = 74,
|
||||
run_end = 105,
|
||||
punch_start = 74,
|
||||
punch_end = 105,
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mobs:sand_monster", {
|
||||
description = "Sand Monster",
|
||||
inventory_image = "mobs_sand_monster.png",
|
||||
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.above then
|
||||
minetest.add_entity(pointed_thing.above, "mobs:sand_monster")
|
||||
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
|
||||
minetest.log("action", placer:get_player_name() .. " placed a sand monster at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
mobs:register_mob("mobs:rat", {
|
||||
type = "animal",
|
||||
hp_max = 1,
|
||||
collisionbox = {-0.25, -0.01, -0.25, 0.25, 0.35, 0.25},
|
||||
collide_with_objects = false,
|
||||
visual = "mesh",
|
||||
mesh = "mobs_rat.x",
|
||||
textures = {"mobs_rat.png"},
|
||||
makes_footstep_sound = false,
|
||||
walk_velocity = 0.8,
|
||||
armor = 200,
|
||||
drops = {
|
||||
{name = "mobs:rat",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 1,},
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 1,
|
||||
lava_damage = 8,
|
||||
follow = "default:scorched_stuff",
|
||||
view_range = 4,
|
||||
})
|
||||
|
||||
mobs:register_mob("mobs:oerkki", {
|
||||
type = "monster",
|
||||
hp_max = 45,
|
||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
|
||||
visual = "mesh",
|
||||
mesh = "mobs_oerkki.x",
|
||||
textures = {"mobs_oerkki.png"},
|
||||
visual_size = {x =5, y =5},
|
||||
makes_footstep_sound = false,
|
||||
view_range = 16,
|
||||
walk_velocity = 0.5,
|
||||
run_velocity = 3,
|
||||
damage = 5,
|
||||
drops = {
|
||||
{name = "default:obsidian",
|
||||
chance = 1,
|
||||
min = 4,
|
||||
max = 4,},
|
||||
-- {name = "maptools:silver_coin",
|
||||
-- chance = 1,
|
||||
-- min = 5,
|
||||
-- max = 5,},
|
||||
},
|
||||
armor = 100,
|
||||
drawtype = "front",
|
||||
lava_damage = 8,
|
||||
light_damage = 1,
|
||||
attack_type = "dogfight",
|
||||
animation = {
|
||||
stand_start = 0,
|
||||
stand_end = 23,
|
||||
walk_start = 24,
|
||||
walk_end = 36,
|
||||
run_start = 37,
|
||||
run_end = 49,
|
||||
punch_start = 37,
|
||||
punch_end = 49,
|
||||
speed_normal = 10,
|
||||
speed_run = 18,
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mobs:oerkki", {
|
||||
description = "Oerkki",
|
||||
inventory_image = "mobs_oerkki.png",
|
||||
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.above then
|
||||
minetest.add_entity(pointed_thing.above, "mobs:oerkki")
|
||||
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
|
||||
minetest.log("action", placer:get_player_name() .. " placed an oerkki at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
mobs:register_mob("mobs:tree_monster", {
|
||||
type = "monster",
|
||||
hp_max = 60,
|
||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
|
||||
visual = "mesh",
|
||||
mesh = "mobs_tree_monster.x",
|
||||
textures = {"mobs_tree_monster.png"},
|
||||
visual_size = {x = 4.5,y = 4.5},
|
||||
makes_footstep_sound = true,
|
||||
view_range = 32,
|
||||
walk_velocity = 0,
|
||||
run_velocity = 1.6,
|
||||
damage = 6,
|
||||
drops = {
|
||||
{name = "default:sapling",
|
||||
chance = 1,
|
||||
min = 4,
|
||||
max = 4,},
|
||||
{name = "default:junglesapling",
|
||||
chance = 1,
|
||||
min = 4,
|
||||
max = 4,},
|
||||
-- {name = "maptools:silver_coin",
|
||||
-- chance = 1,
|
||||
-- min = 6,
|
||||
-- max = 6,},
|
||||
},
|
||||
armor = 80,
|
||||
drawtype = "front",
|
||||
lava_damage = 8,
|
||||
light_damage = 1,
|
||||
disable_fall_damage = true,
|
||||
attack_type = "dogfight",
|
||||
animation = {
|
||||
speed_normal = 8,
|
||||
speed_run = 20,
|
||||
stand_start = 0,
|
||||
stand_end = 24,
|
||||
walk_start = 25,
|
||||
walk_end = 47,
|
||||
run_start = 48,
|
||||
run_end = 62,
|
||||
punch_start = 48,
|
||||
punch_end = 62,
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mobs:tree_monster", {
|
||||
description = "Tree Monster",
|
||||
inventory_image = "mobs_tree_monster.png",
|
||||
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.above then
|
||||
minetest.add_entity(pointed_thing.above, "mobs:tree_monster")
|
||||
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
|
||||
minetest.log("action", placer:get_player_name() .. " placed a tree monster at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
mobs:register_mob("mobs:dungeon_master", {
|
||||
type = "monster",
|
||||
hp_max = 50,
|
||||
collisionbox = {-0.7, -0.01, -0.7, 0.7, 2.6, 0.7},
|
||||
visual = "mesh",
|
||||
mesh = "mobs_dungeon_master.x",
|
||||
textures = {"mobs_dungeon_master.png"},
|
||||
visual_size = {x =8, y =8},
|
||||
makes_footstep_sound = true,
|
||||
view_range = 12,
|
||||
walk_velocity = 0.4,
|
||||
run_velocity = 2,
|
||||
damage = 10,
|
||||
drops = {
|
||||
{name = "default:mese_crystal",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 1,},
|
||||
-- {name = "maptools:silver_coin",
|
||||
-- chance = 1,
|
||||
-- min = 8,
|
||||
-- max = 8,},
|
||||
},
|
||||
armor = 60,
|
||||
drawtype = "front",
|
||||
lava_damage = 8,
|
||||
light_damage = 200,
|
||||
on_rightclick = nil,
|
||||
attack_type = "shoot",
|
||||
arrow = "mobs:fireball",
|
||||
shoot_interval = 2.5,
|
||||
sounds = {
|
||||
attack = "mobs_fireball",
|
||||
},
|
||||
animation = {
|
||||
stand_start = 0,
|
||||
stand_end = 19,
|
||||
walk_start = 20,
|
||||
walk_end = 35,
|
||||
punch_start = 36,
|
||||
punch_end = 48,
|
||||
speed_normal = 8,
|
||||
speed_run = 5,
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mobs:dungeon_master", {
|
||||
description = "Dungeon Master",
|
||||
inventory_image = "mobs_dungeon_master.png",
|
||||
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.above then
|
||||
minetest.add_entity(pointed_thing.above, "mobs:dungeon_master")
|
||||
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
|
||||
minetest.log("action", placer:get_player_name() .. " placed a dungeon master at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
mobs:register_arrow("mobs:fireball", {
|
||||
visual = "sprite",
|
||||
visual_size = {x = 1, y = 1},
|
||||
textures = {"mobs_fireball.png"},
|
||||
velocity = 9,
|
||||
hit_player = function(self, player)
|
||||
local s = self.object:getpos()
|
||||
local p = player:getpos()
|
||||
local vec = {x = s.x - p.x, y = s.y - p.y, z = s.z - p.z}
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval = 1.0,
|
||||
damage_groups = {fleshy = 10},
|
||||
}, vec)
|
||||
local pos = self.object:getpos()
|
||||
for dx = -1, 1 do
|
||||
for dy = -1, 1 do
|
||||
for dz = -1, 1 do
|
||||
local p = {x = pos.x + dx, y = pos.y + dy, z = pos.z + dz}
|
||||
local n = minetest.get_node(pos).name
|
||||
if n ~= "bedrock:bedrock"
|
||||
and n ~= "default:chest_locked"
|
||||
and n ~= "bones:bones"
|
||||
and n ~= "default:chest"
|
||||
and n ~= "default:furnace" then
|
||||
minetest.dig_node(p)
|
||||
end
|
||||
minetest.sound_play("mobs_fireball_explode", {
|
||||
pos = s,
|
||||
gain = 0.1,
|
||||
max_hear_distance = 48})
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
hit_node = function(self, pos, node)
|
||||
for dx = -1, 1 do
|
||||
for dy = -2, 1 do
|
||||
for dz = -1, 1 do
|
||||
local p = {x = pos.x + dx, y = pos.y + dy, z = pos.z + dz}
|
||||
local n = minetest.get_node(pos).name
|
||||
if n ~= "bedrock:bedrock"
|
||||
and n ~= "default:chest_locked"
|
||||
and n ~= "bones:bones"
|
||||
and n ~= "default:chest"
|
||||
and n ~= "default:furnace" then
|
||||
minetest.dig_node(p)
|
||||
end
|
||||
minetest.sound_play("mobs_fireball_explode", {
|
||||
pos = s,
|
||||
gain = 0.1,
|
||||
max_hear_distance = 48})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
mobs:register_mob("mobs:rhino", {
|
||||
type = "monster",
|
||||
hp_max = 25,
|
||||
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
|
||||
visual = "mesh",
|
||||
mesh = "mobs_sand_monster.x",
|
||||
textures = {"mobs_rhino.png"},
|
||||
visual_size = {x = 8, y = 8},
|
||||
makes_footstep_sound = true,
|
||||
view_range = 10,
|
||||
walk_velocity = 1.2,
|
||||
run_velocity = 2.4,
|
||||
damage = 2,
|
||||
drops = {
|
||||
{name = "default:steel_ingot",
|
||||
chance = 1,
|
||||
min = 10,
|
||||
max = 10,},
|
||||
-- {name = "maptools:silver_coin",
|
||||
-- chance = 1,
|
||||
-- min = 12,
|
||||
-- max = 12,},
|
||||
},
|
||||
armor = 60,
|
||||
drawtype = "front",
|
||||
lava_damage = 8,
|
||||
light_damage = 1,
|
||||
on_rightclick = nil,
|
||||
attack_type = "shoot",
|
||||
arrow = "mobs:bullet",
|
||||
shoot_interval = 0.5,
|
||||
sounds = {
|
||||
attack = "mobs_bullet",
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 25,
|
||||
speed_run = 45,
|
||||
stand_start = 0,
|
||||
stand_end = 39,
|
||||
walk_start = 41,
|
||||
walk_end = 72,
|
||||
run_start = 74,
|
||||
run_end = 105,
|
||||
punch_start = 74,
|
||||
punch_end = 105,
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mobs:rhino", {
|
||||
description = "Rhino",
|
||||
inventory_image = "mobs_rhino.png",
|
||||
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.above then
|
||||
minetest.add_entity(pointed_thing.above, "mobs:rhino")
|
||||
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
|
||||
minetest.log("action", placer:get_player_name() .. " placed a rhino at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
mobs:register_arrow("mobs:bullet", {
|
||||
visual = "sprite",
|
||||
visual_size = {x = 0.75, y = 0.75},
|
||||
textures = {"mobs_bullet.png"},
|
||||
velocity = 18,
|
||||
hit_player = function(self, player)
|
||||
local s = self.object:getpos()
|
||||
local p = player:getpos()
|
||||
local vec = {x =s.x-p.x, y =s.y-p.y, z =s.z-p.z}
|
||||
player:punch(self.object, 1.0, {
|
||||
full_punch_interval= 1.0,
|
||||
damage_groups = {fleshy = 2},
|
||||
}, vec)
|
||||
local pos = self.object:getpos()
|
||||
for dx = -1, 1 do
|
||||
for dy = -1, 1 do
|
||||
for dz = -1, 1 do
|
||||
local p = {x = pos.x + dx, y = pos.y + dy, z = pos.z + dz}
|
||||
local n = minetest.get_node(pos).name
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
hit_node = function(self, pos, node)
|
||||
for dx = -1, 1 do
|
||||
for dy = -2, 1 do
|
||||
for dz = -1, 1 do
|
||||
local p = {x = pos.x + dx, y = pos.y + dy, z = pos.z + dz}
|
||||
local n = minetest.get_node(pos).name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if minetest.setting_getbool("spawn_friendly_mobs") ~= false then -- “If not defined or set to true then”
|
||||
mobs:register_spawn("mobs:sheep", "a sheep", {"default:dirt_with_grass"}, 16, 8, 20000, 2, 100)
|
||||
end
|
||||
if minetest.setting_getbool("spawn_hostile_mobs") ~= false then -- “If not defined or set to true then”
|
||||
mobs:register_spawn("mobs:dirt_monster", "a dirt monster", {"default:stone", "default:desert_stone"}, 1, -1, 15000, 6, 0)
|
||||
mobs:register_spawn("mobs:stone_monster", "a stone monster", {"default:stone", "default:desert_stone"}, 1, -1, 15000, 4, 0)
|
||||
mobs:register_spawn("mobs:sand_monster", "a sand monster", {"default:stone", "default:desert_stone"}, 1, -1, 15000, 4, 0)
|
||||
mobs:register_spawn("mobs:oerkki", "an oerkki", {"default:stone", "default:desert_stone"}, 1, -1, 20000, 4, 0)
|
||||
mobs:register_spawn("mobs:tree_monster", "a tree monster", {"default:stone", "default:desert_stone"}, 1, -1, 25000, 2, 0)
|
||||
mobs:register_spawn("mobs:dungeon_master", "a dungeon master", {"default:stone", "default:desert_stone"}, 1, -1, 25000, 2, -50)
|
||||
mobs:register_spawn("mobs:rhino", "a rhino", {"default:stone", "default:desert_stone"}, 1, -1, 25000, 2, 0)
|
||||
end
|
||||
end
|
||||
|
||||
print('[OK] Mobs loaded!')
|
|
@ -0,0 +1,29 @@
|
|||
mobs:register_mob("mobs:creeper", {
|
||||
type = "monster",
|
||||
hp_max = 10,
|
||||
collisionbox = {-0.2, 0, -0.2, 0.2, 1.4, 0.2},
|
||||
visual = "mesh",
|
||||
mesh = "creatures_creeper.x",
|
||||
textures = {"mobs_creeper.png"},
|
||||
--visual_size = {x = 1.1, y = 1.1},
|
||||
makes_footstep_sound = true,
|
||||
view_range = 15,
|
||||
walk_velocity = 1.3,
|
||||
randomsound= "creeper_random",
|
||||
run_velocity = 1.1,
|
||||
on_rightclick = nil,
|
||||
jump = 0,
|
||||
damage = 0,
|
||||
drops = {
|
||||
{name = "default:gunpowder",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 3,},
|
||||
},
|
||||
armor = 70,
|
||||
drawtype = "front",
|
||||
lava_damage = 15,
|
||||
light_damage = 0,
|
||||
attack_type = "kamicaze",
|
||||
})
|
||||
|
|
@ -0,0 +1 @@
|
|||
default
|
|
@ -0,0 +1,37 @@
|
|||
mobs:register_mob("mobs:herobrine", {
|
||||
type = "monster",
|
||||
hp_max = 120,
|
||||
collisionbox = {-0.4, -1.3, -0.4, 0.4, 1, 0.4},
|
||||
visual = "mesh",
|
||||
mesh = "creatures_herobrine.x",
|
||||
textures = {"mobs_herobrine.png"},
|
||||
makes_footstep_sound = true,
|
||||
view_range = 10,
|
||||
walk_velocity = 4.8,
|
||||
run_velocity = 5.1,
|
||||
on_rightclick = nil,
|
||||
drops = {
|
||||
{name = "mobs:rotten_flesh",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 3,},
|
||||
},
|
||||
jump = 0,
|
||||
damage = 9999,
|
||||
armor = 100,
|
||||
drawtype = "front",
|
||||
lava_damage = 0,
|
||||
light_damage = 0,
|
||||
attack_type = "dogfight",
|
||||
animation = {
|
||||
speed_normal = 10,
|
||||
speed_run = 30,
|
||||
stand_start = 0,
|
||||
stand_end = 79,
|
||||
walk_start = 168,
|
||||
walk_end = 187,
|
||||
die_start = 162,
|
||||
die_end = 166,
|
||||
},
|
||||
})
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
local init = os.clock()
|
||||
|
||||
dofile(minetest.get_modpath("mobs").."/api.lua")
|
||||
|
||||
-- Items
|
||||
dofile(minetest.get_modpath("mobs").."/item.lua")
|
||||
|
||||
-- Mouton
|
||||
dofile(minetest.get_modpath("mobs").."/sheep.lua")
|
||||
|
||||
-- Zombie
|
||||
dofile(minetest.get_modpath("mobs").."/zombie.lua")
|
||||
|
||||
-- Slime
|
||||
dofile(minetest.get_modpath("mobs").."/slime.lua")
|
||||
|
||||
-- Creeper
|
||||
dofile(minetest.get_modpath("mobs").."/creeper.lua")
|
||||
|
||||
-- Spider
|
||||
dofile(minetest.get_modpath("mobs").."/spider.lua")
|
||||
|
||||
-- Herobrine
|
||||
dofile(minetest.get_modpath("mobs").."/herobrine.lua")
|
||||
|
||||
|
||||
---mobs:register_spawn(name, description, nodes, max_light, min_light, chance, active_object_count, max_height, spawn_func)
|
||||
if minetest.setting_getbool("spawn_friendly_mobs") ~= false then -- “If not defined or set to true then”
|
||||
mobs:register_spawn("mobs:sheep", "Sheep", {"default:dirt_with_grass"},16, 8, 2, 250, 100)
|
||||
end
|
||||
if minetest.setting_getbool("spawn_hostile_mobs") ~= false then -- “If not defined or set to true then”
|
||||
mobs:register_spawn("mobs:slime", "Slime", { "default:dirt_with_grass"}, 20, 1, 11, 80, 0)
|
||||
mobs:register_spawn("mobs:herobrine", "Herobrine", {"head:herobine"}, 20, -1, 100, 1, 0)
|
||||
mobs:register_spawn("mobs:zombie", "Zombie", {"default:stone", "default:dirt", "default:dirt_with_grass", "default:sand"}, 1, -1, 7, 80, 0)
|
||||
mobs:register_spawn("mobs:spider", "Spider", {"default:stone", "default:dirt", "default:dirt_with_grass", "default:sand"}, 1, -1, 7, 40, 0)
|
||||
-- mobs:register_spawn("mobs:stone_monster", "a stone monster", {"default:stone", "default:desert_stone"}, 1, -1, 15000, 4, 0)
|
||||
-- mobs:register_spawn("mobs:sand_monster", "a sand monster", {"default:stone", "default:desert_stone"}, 1, -1, 15000, 4, 0)
|
||||
-- mobs:register_spawn("mobs:oerkki", "an oerkki", {"default:stone", "default:desert_stone"}, 1, -1, 20000, 4, 0)
|
||||
-- mobs:register_spawn("mobs:tree_monster", "a tree monster", {"default:stone", "default:desert_stone"}, 1, -1, 25000, 2, 0)
|
||||
-- mobs:register_spawn("mobs:dungeon_master", "a dungeon master", {"default:stone", "default:desert_stone"}, 1, -1, 25000, 2, -50)
|
||||
-- mobs:register_spawn("mobs:rhino", "a rhino", {"default:stone", "default:desert_stone"}, 1, -1, 25000, 2, 0)
|
||||
end
|
||||
|
||||
|
||||
local time_to_load= os.clock() - init
|
||||
print(string.format("[MOD] "..minetest.get_current_modname().." loaded in %.4f s", time_to_load))
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
-------------------
|
||||
-- Oeuf de spawn --
|
||||
-------------------
|
||||
minetest.register_craftitem("mobs:sheep", {
|
||||
description = "Sheep",
|
||||
inventory_image = "spawn_sheep.png",
|
||||
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
|
||||
groups = {},
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.above then
|
||||
minetest.add_entity(pointed_thing.above, "mobs:sheep")
|
||||
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
|
||||
minetest.log("action", placer:get_player_name() .. " placed a sheep at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mobs:slime", {
|
||||
description = "slime",
|
||||
inventory_image = "spawn_slime.png",
|
||||
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
|
||||
groups = {},
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.above then
|
||||
minetest.add_entity(pointed_thing.above, "mobs:slime")
|
||||
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
|
||||
minetest.log("action", placer:get_player_name() .. " placed a slime at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mobs:zombie", {
|
||||
description = "Zombie",
|
||||
inventory_image = "spawn_zombie.png",
|
||||
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
|
||||
groups = {},
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.above then
|
||||
minetest.add_entity(pointed_thing.above, "mobs:zombie")
|
||||
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
|
||||
minetest.log("action", placer:get_player_name() .. " placed a zombie at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craftitem("mobs:spider", {
|
||||
description = "Spider",
|
||||
inventory_image = "spawn_spider.png",
|
||||
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
|
||||
groups = {},
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.above then
|
||||
minetest.add_entity(pointed_thing.above, "mobs:spider")
|
||||
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
|
||||
minetest.log("action", placer:get_player_name() .. " placed a spider at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craftitem("mobs:creeper", {
|
||||
description = "Creeper",
|
||||
inventory_image = "spawn_creeper.png",
|
||||
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
|
||||
groups = {},
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.above then
|
||||
minetest.add_entity(pointed_thing.above, "mobs:creeper")
|
||||
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
|
||||
minetest.log("action", placer:get_player_name() .. " placed a creeper at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mobs:herobrine", {
|
||||
description = "herobrine",
|
||||
inventory_image = "spawn_herobrine.png",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
wield_scale = {x = 1.25, y = 1.25, z = 2.5},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.above then
|
||||
minetest.add_entity(pointed_thing.above, "mobs:herobrine")
|
||||
if not minetest.setting_getbool("creative_mode") then itemstack:take_item() end
|
||||
minetest.log("action", placer:get_player_name() .. " placed a herobrine at " .. minetest.pos_to_string(pointed_thing.above) .. ".")
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
---------------------
|
||||
-- Drop de monstre --
|
||||
---------------------
|
||||
|
||||
minetest.register_craftitem("mobs:rotten_flesh", {
|
||||
description = "rotten flesh",
|
||||
inventory_image = "rotten_flesh.png",
|
||||
on_use = minetest.item_eat(2),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mobs:meat_raw_sheep", {
|
||||
description = "Raw Mutton",
|
||||
inventory_image = "mutton_raw.png",
|
||||
on_use = minetest.item_eat(2),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mobs:meat_cooked_sheep", {
|
||||
description = "Cooked Mutton",
|
||||
inventory_image = "mutton_cooked.png",
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("mobs:spider_eye", {
|
||||
description = "Spider Eye",
|
||||
inventory_image = "spider_eye.png",
|
||||
on_use = minetest.item_eat(2),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mobs:meat_cooked_sheep",
|
||||
recipe = "mobs:meat_raw_sheep",
|
||||
cooktime = 25,
|
||||
})
|
||||
|
|
@ -0,0 +1,441 @@
|
|||
xof 0302txt 0064
|
||||
// File created by CINEMA 4D
|
||||
|
||||
|
||||
template Vector {
|
||||
<3D82AB5E-62DA-11cf-AB39-0020AF71E433>
|
||||
FLOAT x;
|
||||
FLOAT y;
|
||||
FLOAT z;
|
||||
}
|
||||
|
||||
template Coords2d {
|
||||
<F6F23F44-7686-11cf-8F52-0040333594A3>
|
||||
FLOAT u;
|
||||
FLOAT v;
|
||||
}
|
||||
|
||||
template Matrix4x4 {
|
||||
<F6F23F45-7686-11cf-8F52-0040333594A3>
|
||||
array FLOAT matrix[16];
|
||||
}
|
||||
|
||||
template ColorRGBA {
|
||||
<35FF44E0-6C7C-11cf-8F52-0040333594A3>
|
||||
FLOAT red;
|
||||
FLOAT green;
|
||||
FLOAT blue;
|
||||
FLOAT alpha;
|
||||
}
|
||||
|
||||
template ColorRGB {
|
||||
<D3E16E81-7835-11cf-8F52-0040333594A3>
|
||||
FLOAT red;
|
||||
FLOAT green;
|
||||
FLOAT blue;
|
||||
}
|
||||
|
||||
template IndexedColor {
|
||||
<1630B820-7842-11cf-8F52-0040333594A3>
|
||||
DWORD index;
|
||||
ColorRGBA indexColor;
|
||||
}
|
||||
|
||||
template Boolean {
|
||||
<4885AE61-78E8-11cf-8F52-0040333594A3>
|
||||
SWORD truefalse;
|
||||
}
|
||||
|
||||
template Boolean2d {
|
||||
<4885AE63-78E8-11cf-8F52-0040333594A3>
|
||||
Boolean u;
|
||||
Boolean v;
|
||||
}
|
||||
|
||||
template MaterialWrap {
|
||||
<4885AE60-78E8-11cf-8F52-0040333594A3>
|
||||
Boolean u;
|
||||
Boolean v;
|
||||
}
|
||||
|
||||
template TextureFilename {
|
||||
<A42790E1-7810-11cf-8F52-0040333594A3>
|
||||
STRING filename;
|
||||
}
|
||||
|
||||
template Material {
|
||||
<3D82AB4D-62DA-11cf-AB39-0020AF71E433>
|
||||
ColorRGBA faceColor;
|
||||
FLOAT power;
|
||||
ColorRGB specularColor;
|
||||
ColorRGB emissiveColor;
|
||||
[...]
|
||||
}
|
||||
|
||||
template MeshFace {
|
||||
<3D82AB5F-62DA-11cf-AB39-0020AF71E433>
|
||||
DWORD nFaceVertexIndices;
|
||||
array DWORD faceVertexIndices[nFaceVertexIndices];
|
||||
}
|
||||
|
||||
template MeshFaceWraps {
|
||||
<4885AE62-78E8-11cf-8F52-0040333594A3>
|
||||
DWORD nFaceWrapValues;
|
||||
Boolean2d faceWrapValues;
|
||||
}
|
||||
|
||||
template MeshTextureCoords {
|
||||
<F6F23F40-7686-11cf-8F52-0040333594A3>
|
||||
DWORD nTextureCoords;
|
||||
array Coords2d textureCoords[nTextureCoords];
|
||||
}
|
||||
|
||||
template MeshMaterialList {
|
||||
<F6F23F42-7686-11cf-8F52-0040333594A3>
|
||||
DWORD nMaterials;
|
||||
DWORD nFaceIndexes;
|
||||
array DWORD faceIndexes[nFaceIndexes];
|
||||
[Material]
|
||||
}
|
||||
|
||||
template MeshNormals {
|
||||
<F6F23F43-7686-11cf-8F52-0040333594A3>
|
||||
DWORD nNormals;
|
||||
array Vector normals[nNormals];
|
||||
DWORD nFaceNormals;
|
||||
array MeshFace faceNormals[nFaceNormals];
|
||||
}
|
||||
|
||||
template MeshVertexColors {
|
||||
<1630B821-7842-11cf-8F52-0040333594A3>
|
||||
DWORD nVertexColors;
|
||||
array IndexedColor vertexColors[nVertexColors];
|
||||
}
|
||||
|
||||
template Mesh {
|
||||
<3D82AB44-62DA-11cf-AB39-0020AF71E433>
|
||||
DWORD nVertices;
|
||||
array Vector vertices[nVertices];
|
||||
DWORD nFaces;
|
||||
array MeshFace faces[nFaces];
|
||||
[...]
|
||||
}
|
||||
|
||||
template FrameTransformMatrix {
|
||||
<F6F23F41-7686-11cf-8F52-0040333594A3>
|
||||
Matrix4x4 frameMatrix;
|
||||
}
|
||||
|
||||
template Frame {
|
||||
<3D82AB46-62DA-11cf-AB39-0020AF71E433>
|
||||
[...]
|
||||
}
|
||||
|
||||
Mesh CINEMA4D_Mesh {
|
||||
48;
|
||||
// Head
|
||||
-2.149;9.488;-4.004;,
|
||||
-2.152;13.894;-4.005;,
|
||||
1.98;9.491;-4.036;,
|
||||
1.978;13.897;-4.038;,
|
||||
2.012;9.492;0.093;,
|
||||
2.01;13.898;0.092;,
|
||||
-2.117;9.489;0.125;,
|
||||
-2.119;13.896;0.124;,
|
||||
// Body
|
||||
-2.133;2.881;-2.988;,
|
||||
-2.133;9.49;-2.988;,
|
||||
1.996;2.881;-2.988;,
|
||||
1.996;9.49;-2.988;,
|
||||
1.996;2.881;-0.923;,
|
||||
1.996;9.49;-0.923;,
|
||||
-2.133;2.881;-0.923;,
|
||||
-2.133;9.49;-0.923;,
|
||||
// Right_Foot_Front
|
||||
-2.133;0.528;-5.985;,
|
||||
-2.133;3.634;-4.926;,
|
||||
-0.068;0.528;-5.985;,
|
||||
-0.068;3.634;-4.926;,
|
||||
-0.068;-0.225;-4.045;,
|
||||
-0.068;2.88;-2.986;,
|
||||
-2.133;-0.225;-4.045;,
|
||||
-2.133;2.88;-2.986;,
|
||||
// Right_Foot_Back
|
||||
-2.133;-0.225;0.134;,
|
||||
-2.133;2.88;-0.925;,
|
||||
-0.068;-0.225;0.134;,
|
||||
-0.068;2.88;-0.925;,
|
||||
-0.068;0.528;2.074;,
|
||||
-0.068;3.634;1.015;,
|
||||
-2.133;0.528;2.074;,
|
||||
-2.133;3.634;1.015;,
|
||||
// Left_Foot_Front
|
||||
-0.068;-0.479;-5.081;,
|
||||
-0.068;2.802;-5.068;,
|
||||
1.996;-0.479;-5.081;,
|
||||
1.996;2.802;-5.068;,
|
||||
1.996;-0.4;-3.001;,
|
||||
1.996;2.881;-2.988;,
|
||||
-0.068;-0.4;-3.001;,
|
||||
-0.068;2.881;-2.988;,
|
||||
// Left_Foot_Back
|
||||
-0.068;-0.225;-1.98;,
|
||||
-0.068;2.88;-0.921;,
|
||||
1.996;-0.225;-1.98;,
|
||||
1.996;2.88;-0.921;,
|
||||
1.996;-0.979;-0.04;,
|
||||
1.996;2.127;1.02;,
|
||||
-0.068;-0.979;-0.04;,
|
||||
-0.068;2.127;1.02;;
|
||||
|
||||
36;
|
||||
// Head
|
||||
4;0,1,3,2;,
|
||||
4;2,3,5,4;,
|
||||
4;4,5,7,6;,
|
||||
4;6,7,1,0;,
|
||||
4;1,7,5,3;,
|
||||
4;6,0,2,4;,
|
||||
// Body
|
||||
4;8,9,11,10;,
|
||||
4;10,11,13,12;,
|
||||
4;12,13,15,14;,
|
||||
4;14,15,9,8;,
|
||||
4;9,15,13,11;,
|
||||
4;14,8,10,12;,
|
||||
// Right_Foot_Front
|
||||
4;16,17,19,18;,
|
||||
4;18,19,21,20;,
|
||||
4;20,21,23,22;,
|
||||
4;22,23,17,16;,
|
||||
4;17,23,21,19;,
|
||||
4;22,16,18,20;,
|
||||
// Right_Foot_Back
|
||||
4;24,25,27,26;,
|
||||
4;26,27,29,28;,
|
||||
4;28,29,31,30;,
|
||||
4;30,31,25,24;,
|
||||
4;25,31,29,27;,
|
||||
4;30,24,26,28;,
|
||||
// Left_Foot_Front
|
||||
4;32,33,35,34;,
|
||||
4;34,35,37,36;,
|
||||
4;36,37,39,38;,
|
||||
4;38,39,33,32;,
|
||||
4;33,39,37,35;,
|
||||
4;38,32,34,36;,
|
||||
// Left_Foot_Back
|
||||
4;40,41,43,42;,
|
||||
4;42,43,45,44;,
|
||||
4;44,45,47,46;,
|
||||
4;46,47,41,40;,
|
||||
4;41,47,45,43;,
|
||||
4;46,40,42,44;;
|
||||
|
||||
MeshNormals {
|
||||
48;
|
||||
// Head
|
||||
-0.582;-0.578;-0.573;,
|
||||
-0.582;0.577;-0.573;,
|
||||
0.573;-0.577;-0.582;,
|
||||
0.572;0.578;-0.582;,
|
||||
0.582;-0.577;0.573;,
|
||||
0.582;0.578;0.573;,
|
||||
-0.572;-0.578;0.582;,
|
||||
-0.573;0.577;0.582;,
|
||||
// Body
|
||||
-0.333;-0.667;-0.667;,
|
||||
-0.333;0.667;-0.667;,
|
||||
0.333;-0.667;-0.667;,
|
||||
0.333;0.667;-0.667;,
|
||||
0.333;-0.667;0.667;,
|
||||
0.333;0.667;0.667;,
|
||||
-0.333;-0.667;0.667;,
|
||||
-0.333;0.667;0.667;,
|
||||
// Right_Foot_Front
|
||||
-0.572;-0.346;-0.743;,
|
||||
-0.588;0.733;-0.341;,
|
||||
0.572;-0.346;-0.743;,
|
||||
0.588;0.733;-0.341;,
|
||||
0.588;-0.733;0.341;,
|
||||
0.572;0.346;0.743;,
|
||||
-0.588;-0.733;0.341;,
|
||||
-0.572;0.346;0.743;,
|
||||
// Right_Foot_Back
|
||||
-0.588;-0.733;-0.341;,
|
||||
-0.572;0.346;-0.743;,
|
||||
0.588;-0.733;-0.341;,
|
||||
0.572;0.346;-0.743;,
|
||||
0.572;-0.346;0.743;,
|
||||
0.588;0.733;0.341;,
|
||||
-0.572;-0.346;0.743;,
|
||||
-0.588;0.733;0.341;,
|
||||
// Left_Foot_Front
|
||||
-0.588;-0.581;-0.562;,
|
||||
-0.572;0.57;-0.59;,
|
||||
0.588;-0.581;-0.562;,
|
||||
0.572;0.57;-0.59;,
|
||||
0.572;-0.57;0.59;,
|
||||
0.588;0.581;0.562;,
|
||||
-0.572;-0.57;0.59;,
|
||||
-0.588;0.581;0.562;,
|
||||
// Left_Foot_Back
|
||||
-0.572;-0.346;-0.743;,
|
||||
-0.588;0.733;-0.341;,
|
||||
0.572;-0.346;-0.743;,
|
||||
0.588;0.733;-0.341;,
|
||||
0.588;-0.733;0.341;,
|
||||
0.572;0.346;0.743;,
|
||||
-0.588;-0.733;0.341;,
|
||||
-0.572;0.346;0.743;;
|
||||
|
||||
36;
|
||||
// Head
|
||||
4;0,1,3,2;,
|
||||
4;2,3,5,4;,
|
||||
4;4,5,7,6;,
|
||||
4;6,7,1,0;,
|
||||
4;1,7,5,3;,
|
||||
4;6,0,2,4;,
|
||||
// Body
|
||||
4;8,9,11,10;,
|
||||
4;10,11,13,12;,
|
||||
4;12,13,15,14;,
|
||||
4;14,15,9,8;,
|
||||
4;9,15,13,11;,
|
||||
4;14,8,10,12;,
|
||||
// Right_Foot_Front
|
||||
4;16,17,19,18;,
|
||||
4;18,19,21,20;,
|
||||
4;20,21,23,22;,
|
||||
4;22,23,17,16;,
|
||||
4;17,23,21,19;,
|
||||
4;22,16,18,20;,
|
||||
// Right_Foot_Back
|
||||
4;24,25,27,26;,
|
||||
4;26,27,29,28;,
|
||||
4;28,29,31,30;,
|
||||
4;30,31,25,24;,
|
||||
4;25,31,29,27;,
|
||||
4;30,24,26,28;,
|
||||
// Left_Foot_Front
|
||||
4;32,33,35,34;,
|
||||
4;34,35,37,36;,
|
||||
4;36,37,39,38;,
|
||||
4;38,39,33,32;,
|
||||
4;33,39,37,35;,
|
||||
4;38,32,34,36;,
|
||||
// Left_Foot_Back
|
||||
4;40,41,43,42;,
|
||||
4;42,43,45,44;,
|
||||
4;44,45,47,46;,
|
||||
4;46,47,41,40;,
|
||||
4;41,47,45,43;,
|
||||
4;46,40,42,44;;
|
||||
|
||||
}
|
||||
MeshTextureCoords {
|
||||
48;
|
||||
// Head
|
||||
0.25;0.0;,
|
||||
0.125;0.25;,
|
||||
0.375;0.0;,
|
||||
0.25;0.25;,
|
||||
0.375;0.25;,
|
||||
0.25;0.0;,
|
||||
0.25;0.25;,
|
||||
0.125;0.0;,
|
||||
// Body
|
||||
0.438;0.5;,
|
||||
0.313;0.625;,
|
||||
0.562;0.501;,
|
||||
0.438;0.625;,
|
||||
0.562;0.625;,
|
||||
0.438;0.5;,
|
||||
0.438;0.625;,
|
||||
0.313;0.5;,
|
||||
// Right_Foot_Front
|
||||
0.125;0.5;,
|
||||
0.063;0.625;,
|
||||
0.188;0.5;,
|
||||
0.125;0.625;,
|
||||
0.188;0.626;,
|
||||
0.125;0.5;,
|
||||
0.125;0.625;,
|
||||
0.063;0.5;,
|
||||
// Right_Foot_Back
|
||||
0.125;0.5;,
|
||||
0.063;0.625;,
|
||||
0.188;0.5;,
|
||||
0.125;0.625;,
|
||||
0.188;0.626;,
|
||||
0.125;0.5;,
|
||||
0.125;0.625;,
|
||||
0.063;0.5;,
|
||||
// Left_Foot_Front
|
||||
0.125;0.5;,
|
||||
0.063;0.625;,
|
||||
0.188;0.5;,
|
||||
0.125;0.625;,
|
||||
0.188;0.626;,
|
||||
0.125;0.5;,
|
||||
0.125;0.625;,
|
||||
0.063;0.5;,
|
||||
// Left_Foot_Back
|
||||
0.125;0.5;,
|
||||
0.063;0.625;,
|
||||
0.188;0.5;,
|
||||
0.125;0.625;,
|
||||
0.188;0.626;,
|
||||
0.125;0.5;,
|
||||
0.125;0.625;,
|
||||
0.063;0.5;;
|
||||
}
|
||||
MeshMaterialList {
|
||||
1;
|
||||
36;
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0;
|
||||
|
||||
Material C4DMAT_NONE {
|
||||
1.0;1.0;1.0;1.0;;
|
||||
1.0;
|
||||
0.0;0.0;0.0;;
|
||||
0.0;0.0;0.0;;
|
||||
}
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 15 KiB |
|
@ -0,0 +1,74 @@
|
|||
|
||||
mobs:register_mob("mobs:sheep", {
|
||||
type = "animal",
|
||||
hp_max = 8,
|
||||
collisionbox = {-0.5, -0.01, -0.5, 0.5, 1, 0.5},
|
||||
textures = {"creatures_sheep.png"},
|
||||
visual = "mesh",
|
||||
mesh = "creatures_sheep.x",
|
||||
makes_footstep_sound = true,
|
||||
walk_velocity = 1,
|
||||
run_velocity = 3,
|
||||
armor = 100,
|
||||
drops = {
|
||||
{name = "mobs:meat_raw_sheep",
|
||||
chance = 2,
|
||||
min = 1,
|
||||
max = 2,},
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 0,
|
||||
lava_damage = 8,
|
||||
animation = {
|
||||
speed_normal = 17,
|
||||
speed_run = 25,
|
||||
stand_start = 0,
|
||||
stand_end = 80,
|
||||
walk_start = 81,
|
||||
walk_end = 100,
|
||||
},
|
||||
follow = "farming:wheat_harvested",
|
||||
view_range = 6,
|
||||
on_rightclick = function(self, clicker)
|
||||
local item = clicker:get_wielded_item()
|
||||
if item:get_name() == "farming:wheat_harvested" then
|
||||
if not self.tamed then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
item:take_item()
|
||||
clicker:set_wielded_item(item)
|
||||
end
|
||||
self.tamed = true
|
||||
self.object:set_hp(self.object:get_hp() + 3)
|
||||
if self.object:get_hp() > 15 then self.object:set_hp(15) end
|
||||
else
|
||||
if not minetest.setting_getbool("creative_mode") and self.naked then
|
||||
item:take_item()
|
||||
clicker:set_wielded_item(item)
|
||||
end
|
||||
self.food = (self.food or 0) + 1
|
||||
if self.food >= 8 then
|
||||
self.food = 0
|
||||
self.naked = false
|
||||
self.object:set_properties({
|
||||
textures = {"creatures_sheep.png"},
|
||||
})
|
||||
end
|
||||
self.object:set_hp(self.object:get_hp() + 3)
|
||||
if self.object:get_hp() > 15 then self.object:set_hp(15) return end
|
||||
if not self.naked then
|
||||
item:take_item()
|
||||
clicker:set_wielded_item(item)
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
if item:get_name() == "default:shears" and not self.naked then
|
||||
self.naked = true
|
||||
clicker:get_inventory():add_item("main", ItemStack("wool:white "..math.random(1,3)))
|
||||
minetest.sound_play("default_snow_footstep", {object = self.object, gain = 0.5,})
|
||||
self.object:set_properties({
|
||||
textures = {"creatures_sheep_shaved.png"},
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
|
@ -0,0 +1,40 @@
|
|||
SLIME_SIZE = 1
|
||||
SLIME_BOX = math.sqrt(2*math.pow(SLIME_SIZE, 2))/2
|
||||
GRAVITY = 9.8
|
||||
|
||||
|
||||
mobs:register_mob("mobs:slime", {
|
||||
type = "monster",
|
||||
hp_max = 8,
|
||||
--collisionbox = {-0.4, -1.0, -0.4, 0.4, 0.8, 0.4},
|
||||
collisionbox = {-SLIME_BOX, -SLIME_SIZE/2, -SLIME_BOX, SLIME_BOX, SLIME_SIZE/2, SLIME_BOX},
|
||||
visual = "cube",
|
||||
textures = {
|
||||
"slime_top.png",
|
||||
"slime_bottom.png",
|
||||
"slime_front.png",
|
||||
"slime_sides.png",
|
||||
"slime_sides.png",
|
||||
"slime_sides.png",
|
||||
},
|
||||
--visual_size = {x = 1.1, y = 1.1},
|
||||
makes_footstep_sound = true,
|
||||
view_range = 20,
|
||||
walk_velocity = 0.2,
|
||||
randomsound= "slime_random",
|
||||
run_velocity = 0.2,
|
||||
on_rightclick = nil,
|
||||
jump = 1,
|
||||
damage = 1,
|
||||
drops = {
|
||||
{name = "mesecons_materials:glue",
|
||||
chance = 1,
|
||||
min = 1,
|
||||
max = 4,},
|
||||
},
|
||||
armor = 100,
|
||||
drawtype = "front",
|
||||
lava_damage = 15,
|
||||
light_damage = 0,
|
||||
attack_type = "dogfight",
|
||||
})
|