2021-03-12 21:56:15 +03:00
|
|
|
# mcl_buckets
|
|
|
|
Add an API to register buckets to mcl
|
|
|
|
|
2021-07-14 16:13:40 +03:00
|
|
|
## mcl_buckets.register_liquid(def)
|
2021-03-12 21:56:15 +03:00
|
|
|
|
2021-07-14 16:13:40 +03:00
|
|
|
Register a new liquid
|
|
|
|
Accept folowing params:
|
2021-03-28 01:07:46 +03:00
|
|
|
* source_place: a string or function.
|
2021-03-12 21:56:15 +03:00
|
|
|
* string: name of the node to place
|
|
|
|
* function(pos): will returns name of the node to place with pos being the placement position
|
2021-03-28 01:07:46 +03:00
|
|
|
* source_take: table of liquid source node names to take
|
2021-07-14 16:22:27 +03:00
|
|
|
* bucketname: itemstring of the new bucket item
|
2021-03-28 01:07:46 +03:00
|
|
|
* inventory_image: texture of the new bucket item (ignored if itemname == nil)
|
|
|
|
* name: user-visible bucket description
|
|
|
|
* longdesc: long explanatory description (for help)
|
|
|
|
* usagehelp: short usage explanation (for help)
|
|
|
|
* tt_help: very short tooltip help
|
2021-07-14 12:29:15 +03:00
|
|
|
* extra_check(pos, placer): (optional) function(pos)
|
2021-03-28 01:07:46 +03:00
|
|
|
* groups: optional list of item groups
|
2021-03-12 21:56:15 +03:00
|
|
|
|
2021-07-14 12:29:15 +03:00
|
|
|
|
|
|
|
**Usage exemple:**
|
|
|
|
```lua
|
2021-07-14 16:13:40 +03:00
|
|
|
mcl_buckets.register_liquid({
|
2021-07-14 16:22:27 +03:00
|
|
|
bucketname = "dummy:bucket_dummy",
|
2021-07-14 12:41:09 +03:00
|
|
|
--source_place = "dummy:dummy_source",
|
|
|
|
source_place = function(pos)
|
|
|
|
if condition then
|
|
|
|
return "dummy:dummy_source"
|
|
|
|
else
|
|
|
|
return "dummy:dummy_source_nether"
|
|
|
|
end
|
|
|
|
end,
|
2021-07-14 12:29:15 +03:00
|
|
|
source_take = {"dummy:dummy_source"},
|
|
|
|
inventory_image = "bucket_dummy.png",
|
|
|
|
name = S("Dummy liquid Bucket"),
|
|
|
|
longdesc = S("This bucket is filled with a dummy liquid."),
|
|
|
|
usagehelp = S("Place it to empty the bucket and create a dummy liquid source."),
|
|
|
|
tt_help = S("Places a dummy liquid source"),
|
|
|
|
extra_check = function(pos, placer)
|
|
|
|
--pos = pos where the liquid should be placed
|
|
|
|
--placer people who tried to place the bucket (can be nil)
|
|
|
|
|
|
|
|
--no liquid node will be placed
|
|
|
|
--the bucket will not be emptied
|
|
|
|
--return false, false
|
|
|
|
|
|
|
|
--liquid node will be placed
|
|
|
|
--the bucket will be emptied
|
|
|
|
return true, true
|
|
|
|
end,
|
|
|
|
groups = { dummy_group = 123 },
|
|
|
|
})
|
|
|
|
```
|