initial draft
This commit is contained in:
commit
c85f2f87ca
14
.luacheckrc
Normal file
14
.luacheckrc
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
globals = {
|
||||
"minetest"
|
||||
}
|
||||
|
||||
read_globals = {
|
||||
-- Stdlib
|
||||
string = {fields = {"split"}},
|
||||
table = {fields = {"copy", "getn"}},
|
||||
|
||||
-- Minetest
|
||||
"vector", "ItemStack",
|
||||
"dump", "VoxelArea"
|
||||
}
|
13
.travis.yml
Normal file
13
.travis.yml
Normal file
@ -0,0 +1,13 @@
|
||||
jobs:
|
||||
include:
|
||||
- stage: luacheck
|
||||
language: generic
|
||||
sudo: false
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- luarocks
|
||||
before_install:
|
||||
- luarocks install --local luacheck
|
||||
script:
|
||||
- $HOME/.luarocks/bin/luacheck --no-color .
|
122
init.lua
Normal file
122
init.lua
Normal file
@ -0,0 +1,122 @@
|
||||
|
||||
local update_formspec = function(meta)
|
||||
local pos = meta:get_string("pos")
|
||||
|
||||
meta:set_string("infotext", "Add item block: pos=" .. pos)
|
||||
|
||||
meta:set_string("formspec", "size[8,7;]" ..
|
||||
"field[0.2,0.5;4,1;amount;Amount;${amount}]" ..
|
||||
"field[4.2,0.5;4,1;amount;Amount;${amount}]" ..
|
||||
|
||||
"button_exit[6.1,1.5;2,1;save;Save]" ..
|
||||
"list[context;main;0.1,1.5;1,1;]" ..
|
||||
|
||||
"list[current_player;main;0,3;8,4;]" ..
|
||||
"listring[]" ..
|
||||
"")
|
||||
end
|
||||
|
||||
minetest.register_node("particlefountain:particlefountain", {
|
||||
description = "Particlefountain",
|
||||
tiles = {
|
||||
"default_gold_block.png^default_mese_crystal.png"
|
||||
},
|
||||
groups = {cracky=3,oddly_breakable_by_hand=3},
|
||||
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("amount", 4)
|
||||
meta:set_int("glow", 9)
|
||||
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 1)
|
||||
|
||||
update_formspec(meta, pos)
|
||||
minetest.get_node_timer(pos):start(2)
|
||||
end,
|
||||
|
||||
on_receive_fields = function(pos, _, fields, sender)
|
||||
if not sender or minetest.is_protected(pos, sender:get_player_name()) then
|
||||
-- not allowed
|
||||
return
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta(pos);
|
||||
|
||||
if fields.save then
|
||||
meta:set_int("amount", tonumber(fields.amount) or 4)
|
||||
meta:set_int("glow", tonumber(fields.glow) or 9)
|
||||
end
|
||||
|
||||
update_formspec(meta)
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_put = function(pos, _, _, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
return stack:get_count()
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_take = function(pos, _, _, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
return stack:get_count()
|
||||
end,
|
||||
|
||||
on_timer = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = inv:get_stack("main", 1)
|
||||
local node_name = stack:get_name()
|
||||
if node_name == "ignore" or node_name == "" then
|
||||
return true
|
||||
end
|
||||
|
||||
local def = minetest.registered_items[node_name]
|
||||
if not def then
|
||||
return true
|
||||
end
|
||||
|
||||
local texture = "default_mese_crystal.png"
|
||||
|
||||
if def.inventory_image then
|
||||
texture = def.inventory_image
|
||||
|
||||
elseif def.tiles then
|
||||
if type(def.tiles) == "string" then
|
||||
texture = def.tiles
|
||||
|
||||
elseif type(def.tiles) == "table" then
|
||||
texture = def.tiles[1]
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
minetest.add_particlespawner({
|
||||
amount = meta:get_int("amount"),
|
||||
time = 2,
|
||||
minpos = vector.add(pos, {x=-0.2, y=0, z=-0.2}),
|
||||
maxpos = vector.add(pos, {x=0.2, y=0, z=0.2}),
|
||||
minvel = {x=0, y=1, z=0},
|
||||
maxvel = {x=0, y=2, z=0},
|
||||
minacc = {x=0, y=0, z=0},
|
||||
maxacc = {x=0, y=0, z=0},
|
||||
minexptime = 1,
|
||||
maxexptime = 2,
|
||||
minsize = 1,
|
||||
maxsize = 1.7,
|
||||
collisiondetection = false,
|
||||
collision_removal = false,
|
||||
object_collision = false,
|
||||
vertical = false,
|
||||
texture = texture,
|
||||
glow = meta:get_int("glow")
|
||||
})
|
||||
|
||||
return true
|
||||
end
|
||||
})
|
56
license.txt
Normal file
56
license.txt
Normal file
@ -0,0 +1,56 @@
|
||||
License of source code
|
||||
----------------------
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (C) 2018-2019 Thomas Rudin
|
||||
|
||||
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.
|
||||
|
||||
For more details:
|
||||
https://opensource.org/licenses/MIT
|
||||
|
||||
|
||||
Licenses of media (textures)
|
||||
----------------------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
Copyright (C) 2019 Thomas Rudin
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
||||
The licensor cannot revoke these freedoms as long as you follow the license terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license, and
|
||||
indicate if changes were made. You may do so in any reasonable manner, but not in any way
|
||||
that suggests the licensor endorses you or your use.
|
||||
|
||||
ShareAlike — If you remix, transform, or build upon the material, you must distribute
|
||||
your contributions under the same license as the original.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological measures that
|
||||
legally restrict others from doing anything the license permits.
|
||||
|
||||
Notices:
|
||||
|
||||
You do not have to comply with the license for elements of the material in the public
|
||||
domain or where your use is permitted by an applicable exception or limitation.
|
||||
No warranties are given. The license may not give you all of the permissions necessary
|
||||
for your intended use. For example, other rights such as publicity, privacy, or moral
|
||||
rights may limit how you use the material.
|
2
mod.conf
Normal file
2
mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = particlefountain
|
||||
description = decorative and configurable particle spawner
|
17
readme.md
Normal file
17
readme.md
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
particlefountain
|
||||
-----------------
|
||||
|
||||
A mod for [minetest](http://www.minetest.net)
|
||||
|
||||
[![Build Status](https://travis-ci.org/damocles-minetest/particlefountain.svg?branch=master)](https://travis-ci.org/damocles-minetest/particlefountain)
|
||||
|
||||
# Overview
|
||||
|
||||
decorative and configurable particle spawner
|
||||
|
||||
# License
|
||||
|
||||
## Code
|
||||
|
||||
* MIT
|
Loading…
x
Reference in New Issue
Block a user