Compare commits
64 Commits
Author | SHA1 | Date |
---|---|---|
Nathan Fritzler | be213aa4b9 | |
Nathan Fritzler | 559270c9a3 | |
Nathan Fritzler | 270f20a496 | |
Nathan Fritzler | 02ee356cba | |
Nathan Fritzler | 7c19d30742 | |
Nathan Fritzler | d39e08c080 | |
Nathan Fritzler | 5b43044368 | |
Nathan Fritzler | fe29c83dd0 | |
Nathan Fritzler | 424a697565 | |
Nathan Fritzler | f57399e162 | |
Nathan Fritzler | 70f8be2a0f | |
Nathan Fritzler | b6dff1782d | |
Nathan Fritzler | d573ec29da | |
Nathan Fritzler | 4e5f45f5ab | |
Nathan Fritzler | a5c2cad473 | |
Nathan Fritzler | eb25cd4f50 | |
Nathan Fritzler | 712179623a | |
Nathan Fritzler | 069ccbe010 | |
Nathan Fritzler | f84dcf0940 | |
Nathan Fritzler | 859892d3b2 | |
Nathan Fritzler | bb54ba53e5 | |
Nathan Fritzler | 00fa1f42cc | |
Nathan Fritzler | 21531eb564 | |
Nathan Fritzler | c9ec16c2eb | |
Nathan Fritzler | b6a140eddf | |
epCode | 5c561b951c | |
epCode | ad486a56fd | |
epCode | 42c764e149 | |
cora | 6c89c8f675 | |
cora | 4bff9710a0 | |
cora | d4e4bc8708 | |
cora | b7419dc207 | |
cora | 4af1094eed | |
cora | dd9a93ca19 | |
cora | ef093d0c00 | |
cora | f1778d839d | |
MysticTempest | b4c5805afe | |
cora | b650cd8a97 | |
MysticTempest | 5dde594c19 | |
cora | 44e4e53cf2 | |
MysticTempest | 983b8f0934 | |
cora | b27634fcb2 | |
NO11 | 25d847f49f | |
cora | 5778c2d27a | |
MysticTempest | 31106a2031 | |
cora | ad1b7510aa | |
cora | dc21b02d04 | |
Lizzy Fleckenstein | a86fc935aa | |
cora | 50c802df98 | |
cora | a44347f641 | |
cora | a85bf22695 | |
cora | e4a4648b25 | |
cora | 6b9cb0062d | |
cora | 2337e72a23 | |
cora | da6563a5b3 | |
cora | 41ebaf12a5 | |
cora | a179a1cb62 | |
cora | 663e6dfe9e | |
cora | 7bc63d2882 | |
cora | c0a9cb7020 | |
cora | e90e17e533 | |
cora | 3d13000599 | |
cora | 86bc398a79 | |
cora | 14ec1aa014 |
|
@ -45,11 +45,8 @@ read_globals = {
|
||||||
------
|
------
|
||||||
|
|
||||||
--GENERAL
|
--GENERAL
|
||||||
"default",
|
"mcljepc_core",
|
||||||
|
|
||||||
--ENTITIES
|
--MAPGEN
|
||||||
"cmi",
|
"mcljepc_mapgen",
|
||||||
|
|
||||||
--HUD
|
|
||||||
"sfinv", "sfinv_buttons", "unified_inventory", "cmsg", "inventory_plus",
|
|
||||||
}
|
}
|
97
API.md
|
@ -1,95 +1,20 @@
|
||||||
# API
|
# API
|
||||||
## Groups
|
|
||||||
MineClone 2 makes very extensive use of groups. Making sure your items and objects have the correct group memberships is very important.
|
|
||||||
Groups are explained in `GROUPS.md`.
|
|
||||||
|
|
||||||
## Mod naming convention
|
## Mod naming convention
|
||||||
Mods mods in MineClone 2 follow a simple naming convention: Mods with the prefix “`mcl_`” are specific to MineClone 2, although they may be based on an existing standalone. Mods which lack this prefix are *usually* verbatim copies of a standalone mod. Some modifications may still have been applied, but the APIs are held compatible.
|
|
||||||
|
|
||||||
## Adding items
|
Mods mods in MineCloneJEpC a simple naming convention: Mods with the prefix
|
||||||
### Special fields
|
“`mcljepc_`” are specific to MineCloneJEpC, although they may be based on an
|
||||||
|
existing standalone or a mod from a different MineClone fork. Mods which lack
|
||||||
Items can have these fields:
|
this prefix are verbatim copies of a standalone mod. Some modifications may
|
||||||
* `_mcl_generate_description(itemstack)`: Required for any items which manipulate their
|
still have been applied, but the APIs are held compatible.
|
||||||
description in any way. This function takes an itemstack of its own type and must set
|
|
||||||
the proper advanced description for this itemstack. If you don't do this, anvils will
|
|
||||||
fail at properly restoring the description when their custom name gets cleared at an
|
|
||||||
anvil.
|
|
||||||
See `mcl_banners` for an example.
|
|
||||||
|
|
||||||
Tools can have these fields:
|
|
||||||
* `_mcl_diggroups`: Specifies the digging groups that a tool can dig and how
|
|
||||||
efficiently. See `_mcl_autogroup` for more information.
|
|
||||||
|
|
||||||
All nodes can have these fields:
|
|
||||||
|
|
||||||
* `_mcl_hardness`: Hardness of the block, ranges from 0 to infinity (represented by -1). Determines digging times. Default: 0
|
|
||||||
* `_mcl_blast_resistance`: How well this block blocks and resists explosions. Default: 0
|
|
||||||
* `_mcl_falling_node_alternative`: If set to an itemstring, the node will turn into this node before it starts to fall.
|
|
||||||
* `_mcl_after_falling(pos)`: Called after a falling node finished falling and turned into a node.
|
|
||||||
|
|
||||||
Use the `mcl_sounds` mod for the sounds.
|
|
||||||
|
|
||||||
## APIs
|
## APIs
|
||||||
A lot of things are possible by using one of the APIs in the mods. Note that not all APIs are documented yet, but it is planned. The following APIs should be more or less stable but keep in mind that MineClone 2 is still unfinished. All directory names are relative to `mods/`
|
A lot of things are possible by using one of the APIs in the mods. Note that not
|
||||||
|
all APIs are documented yet, but it is planned. The following APIs should be
|
||||||
### Items
|
more or less stable but keep in mind that MineCloneJEpC is still unfinished. All
|
||||||
* Doors: `ITEMS/mcl_doors`
|
directory names are relative to `mods/`
|
||||||
* Fences and fence gates: `ITEMS/mcl_fences`
|
|
||||||
* Stairs and slabs: `ITEM/mcl_stairs`
|
|
||||||
* Walls: `ITEMS/mcl_walls`
|
|
||||||
* Beds: `ITEMS/mcl_beds`
|
|
||||||
* Buckets: `ITEMS/mcl_buckets`
|
|
||||||
* Dispenser support: `ITEMS/REDSTONE/mcl_dispensers`
|
|
||||||
|
|
||||||
## Mobs
|
|
||||||
* Mobs: `ENTITIES/mcl_mobs`
|
|
||||||
|
|
||||||
MineClone 2 uses its own mobs framework, called “Mobs Redo: MineClone 2 Edition” or “MRM” for short.
|
|
||||||
This is a fork of Mobs Redo [`mobs`] by TenPlus1.
|
|
||||||
|
|
||||||
You can add your own mobs, spawn eggs and spawning rules with this mod.
|
|
||||||
API documnetation is included in `ENTITIES/mcl_mobs/api.txt`.
|
|
||||||
|
|
||||||
This mod includes modificiations from the original Mobs Redo. Some items have been removed or moved to other mods.
|
|
||||||
The API is mostly identical, but a few features have been added. Compability is not really a goal,
|
|
||||||
but function and attribute names of Mobs Redo 1.41 are kept.
|
|
||||||
If you have code for a mod which works fine under Mobs Redo, it should be easy to make it work in MineClone 2,
|
|
||||||
chances are good that it works out of the box.
|
|
||||||
|
|
||||||
### Help
|
|
||||||
* Item help texts: `HELP/doc/doc_items`
|
|
||||||
* Low-level help entry and category framework: `HELP/doc/doc`
|
|
||||||
* Support for lookup tool (required for all entities): `HELP/doc/doc_identifier`
|
|
||||||
|
|
||||||
### HUD
|
|
||||||
* Statbars: `HUD/hudbars`
|
|
||||||
|
|
||||||
### Utility APIs
|
|
||||||
* Change player physics: `PLAYER/playerphysics`
|
|
||||||
* Select random treasures: `CORE/mcl_loot`
|
|
||||||
* Get flowing direction of liquids: `CORE/flowlib`
|
|
||||||
* `on_walk_over` callback for nodes: `CORE/walkover`
|
|
||||||
* Get node names close to player (to reduce constant querying): `PLAYER/mcl_playerinfo`
|
|
||||||
* Explosion API
|
|
||||||
* Music discs API
|
|
||||||
* Flowers and flower pots
|
|
||||||
|
|
||||||
### Unstable APIs
|
|
||||||
The following APIs may be subject to change in future. You could already use these APIs but there will probably be breaking changes in the future, or the API is not as fleshed out as it should be. Use at your own risk!
|
|
||||||
|
|
||||||
* Panes (like glass panes and iron bars): `ITEMS/xpanes`
|
|
||||||
* `_on_ignite` callback: `ITEMS/mcl_fire`
|
|
||||||
* Farming: `ITEMS/mcl_farming`
|
|
||||||
* Anything related to redstone: Don't touch (yet)
|
|
||||||
* Any other mod not explicitly mentioned above
|
|
||||||
|
|
||||||
### Planned APIs
|
### Planned APIs
|
||||||
|
|
||||||
* Saplings and trees
|
* Event-based apis to ensure that specific startup code inside of mods can run
|
||||||
* Custom banner patterns
|
in the correct order
|
||||||
* Custom dimensions
|
|
||||||
* Custom portals
|
|
||||||
* Dispenser and dropper support
|
|
||||||
* Proper sky and weather APIs
|
|
||||||
|
|
||||||
|
|
12
CREDITS.md
|
@ -6,12 +6,20 @@
|
||||||
## Creator of MineClone2
|
## Creator of MineClone2
|
||||||
* Wuzzy
|
* Wuzzy
|
||||||
|
|
||||||
|
## Creator of Minecraftn't Classic
|
||||||
|
* ROllerozxa
|
||||||
|
|
||||||
## Maintainers
|
## Creator of Minecraftn't Pre-classic
|
||||||
|
* ROllerozxa
|
||||||
|
|
||||||
|
## Creator of MinecloneJEpC
|
||||||
|
* Lazerbeak12345
|
||||||
|
|
||||||
|
## MCL2 Maintainers
|
||||||
* Nicu
|
* Nicu
|
||||||
* cora
|
* cora
|
||||||
|
|
||||||
## Previous Maintainers
|
## Previous MCL2 Maintainers
|
||||||
* Fleckenstein
|
* Fleckenstein
|
||||||
* jordan4ibanez
|
* jordan4ibanez
|
||||||
|
|
||||||
|
|
220
GROUPS.md
|
@ -1,220 +0,0 @@
|
||||||
## Groups
|
|
||||||
This document explains all the groups used in this game.
|
|
||||||
|
|
||||||
### Special groups
|
|
||||||
|
|
||||||
* `not_in_creative_inventory=1`: Item will not be shown in creative inventory
|
|
||||||
* `not_in_craft_guide=1`: Item will not be shown as result or fuel item in crafting guide (but still may be shown as ingredient)
|
|
||||||
|
|
||||||
### Digging time groups
|
|
||||||
|
|
||||||
The basic digging time groups determine by which tools a node can be dug.
|
|
||||||
|
|
||||||
* `pickaxey`: Diggable by pickaxe. The rating is for the possible tool materials in which the node will make its useful drop:
|
|
||||||
* `pickaxey=1`: Wood, gold, stone, iron and diamond
|
|
||||||
* `pickaxey=2`: Gold, stone, iron and diamond
|
|
||||||
* `pickaxey=3`: Stone, iron and diamond
|
|
||||||
* `pickaxey=4`: Iron and diamond
|
|
||||||
* `pickaxey=5`: Diamond
|
|
||||||
* `axey`: Axe. Rating is same as for `pickaxey`
|
|
||||||
* `shovely`: Shovel. Rating is same as for `pickaxey`
|
|
||||||
* `swordy=1`: Diggable by sword (any material), and this node is *not* a cobweb
|
|
||||||
* `swordy_cobweb=1`: Diggable by sword (any material), and this node is a cobweb
|
|
||||||
* `shearsy=1`: Diggable by shears, and this node is *not* wool
|
|
||||||
* `shearsy_wool=1`: Diggable by shears, and this node is wool
|
|
||||||
* `handy=1`: Breakable by hand and this node gives it useful drop when dug by hand. All nodes which are breakable by pickaxe, axe, shovel, sword or shears are also automatically breakable by hand, but not neccess
|
|
||||||
* `creative_breakable=1`: Block is breakable by hand in creative mode. This group is implied if the node belongs to any other digging group
|
|
||||||
|
|
||||||
Please read <http://minecraft.gamepedia.com/Breaking> to learn how digging times work in Minecraft, as MineClone 2 is based on the same system.
|
|
||||||
|
|
||||||
### Groups for interactions
|
|
||||||
|
|
||||||
* `crush_after_fall=1`: For falling nodes. These will crush whatever they hit after falling, not dropping as an item
|
|
||||||
* `falling_node_damage=1`: For falling nodes. Hurts any objects it hits while falling. Damage is based on anvils
|
|
||||||
* `dig_by_water=1`: Blocks with this group will drop when they are near flowing water
|
|
||||||
* `destroy_by_lava_flow=1`: Blocks with this group will be destroyed by flowing lava
|
|
||||||
* `dig_by_piston=1`: Blocks which will drop as an item when pushed by a piston. They also cannot be pulled by sticky pistons
|
|
||||||
* `cultivatable=2`: Block will be turned into Farmland by using a hoe on it
|
|
||||||
* `cultivatable=1`: Block will be turned into Dirt by using a hoe on it
|
|
||||||
* `flammable`: Block spreads fire
|
|
||||||
* `flammable>0`: Gets destroyed by fire
|
|
||||||
* `flammable=-1` Does not get destroyed by fire
|
|
||||||
* `fire_encouragement`: How quickly this block catches fire
|
|
||||||
* `fire_flammability`: How fast the block will burn away
|
|
||||||
* `path_creation_possible=1`: Node can be turned into grass path by using a shovel on it
|
|
||||||
* `spreading_dirt_type=1`: A dirt-type block with a cover (e.g. grass) which may spread to neighbor dirt blocks
|
|
||||||
* `dirtifies_below_solid=1`: This node turns into dirt immediately when a solid or dirtifier node is placed on top
|
|
||||||
* `dirtifier=1`: This node turns nodes the above group into dirt when placed above
|
|
||||||
* `non_mycelium_plant=1`: A plant which can't grow on mycelium. Placing it on mycelium fails and if mycelium spreads below it, it uproots
|
|
||||||
* `soil=1`: Saplings and other small plants can grow on it
|
|
||||||
* `soil_sapling=2`: Soil for saplings. Intended to be natural soil. All saplings will grow on this
|
|
||||||
* `soil_sapling=1`: Artificial soil (such as farmland) for saplings. Some saplings will not grow on this
|
|
||||||
* `soil_sugarcane=1`: Sugar canes will grow on this near water
|
|
||||||
* `soil_nether_wart=1`: Nether wart will grow on this
|
|
||||||
* `enderman_takable=1`: Block can be taken and placed by endermen
|
|
||||||
* `disable_suffocation=1`: Disables suffocation for full solid cubes (1)
|
|
||||||
* `destroys_items=1`: If an item happens to be *inside* this node, the item will be destroyed
|
|
||||||
* `no_eat_delay=1`: Only for foodstuffs. When eating this, all eating delays are ignored.
|
|
||||||
* `can_eat_when_full=1`: Only for foodstuffs. This item can be eaten when the user has a full hunger bar
|
|
||||||
* `attached_node_facedir=1`: Like `attached_node`, but for facedir nodes
|
|
||||||
* `supported_node=1`: Like `attached_node`, but can be placed on any nodes that do not have the `drawtype="airlike"` attribute.
|
|
||||||
* `cauldron`: Cauldron. 1: Empty. 2-4: Water height
|
|
||||||
* `anvil`: Anvil. 1: No damage. 2-3: Higher damage levels
|
|
||||||
* `no_rename=1`: Item cannot be renamed by anvil
|
|
||||||
* `comparator_signal=X`: If set, this node outputs a constant (!) comparator signal output of strength X.
|
|
||||||
* `piston=X`: Piston (main body) (1 = normal, 2 = sticky)
|
|
||||||
* `piston_pusher=X`: Piston pusher (1 = normal, 2 = sticky)
|
|
||||||
* `hopper=X`: Hopper (1 = downwards, 2 = sideways)
|
|
||||||
* `portal=1`: Portal (node that teleports players and things by standing inside)
|
|
||||||
* `end_portal_frame=X`: End portal frame (1 = no eye, 2 = with eye)
|
|
||||||
* `coral=X`: Coral (any type) (1 = alive, 2 = dead)
|
|
||||||
* `coral_plant=X`: Coral in the "plant" shape (1 = alive, 2 = dead)
|
|
||||||
* `coral_fan=X`: Coral fan (1 = alive, 2 = dead)
|
|
||||||
* `coral_block=X`: Coral block (1 = alive, 2 = dead)
|
|
||||||
* `coral_species=X`: Specifies the species of a coral; equal X means equal species
|
|
||||||
* `set_on_fire=X`: Sets any (not fire-resistant) mob or player on fire for X seconds when touching
|
|
||||||
* `compostability=X`: Item can be used on a composter block; X (1-100) is the % chance of adding a level of compost
|
|
||||||
|
|
||||||
#### Footnotes
|
|
||||||
|
|
||||||
1. Normally, all walkable blocks with the default 1×1×1 cube as a collision box (e.g. sand,
|
|
||||||
gravel, stone, but not fences) will damage the players while their head is inside. This
|
|
||||||
is called “suffocation”. Setting this group disables this behaviour
|
|
||||||
|
|
||||||
### Groups (mostly) used for crafting recipes
|
|
||||||
|
|
||||||
* `sand=1`: Sand (any color)
|
|
||||||
* `sandstone=1`: Sandstone (any color) and related nodes (chiseled and the like) (only full blocks)
|
|
||||||
* `normal_sandstone=1`: “Normal” (yellow) sandstone and related nodes (chiseled and the like) (only full blocks)
|
|
||||||
* `red_sandstone=1`: Red sandstone and related nodes (chiseled and the like) (only full blocks)
|
|
||||||
* `hardened_clay=1`: Terracotta (any color)
|
|
||||||
* `quartz_block=1`: Quartz Block and variants (chiseled, pillar, etc.) (only full blocks)
|
|
||||||
* `stonebrick=1`: Stone Bricks and related nodes (only full blocks)
|
|
||||||
* `shulker_box=1`: Block is a shulker box
|
|
||||||
* `tree=1`: Oak Wood, Birch Wood, etc. (tree trunks)
|
|
||||||
* `wood=1`: Oak Wood Planks, Birch Wood Planks, etc. (only full blocks)
|
|
||||||
* `wood_slab=1`: Slabs made out of a kind of wooden planks
|
|
||||||
* `wood_stairs=1`: Stairs made out of a kind of wooden planks
|
|
||||||
* `coal=1`: Coal of any kind (lumps only, not blocks)
|
|
||||||
* `wool=1`: Wool (only full blocks)
|
|
||||||
* `carpet=1:` (Wool) carpet
|
|
||||||
* `stick=1`: Stick
|
|
||||||
* `water_bucket=1`: Bucket containing a liquid of group “water”
|
|
||||||
* `enchantability=X`: How good the enchantments are the item gets (1 equals book)
|
|
||||||
* `enchanted=1`: The item is already enchanted, meaning that it can't be enchanted using an enchanting table
|
|
||||||
* `cobble=1`: Cobblestone of any kind
|
|
||||||
* `soul_block`: Fire burning on these blocks turns to soul fire, can be used to craft soul torch
|
|
||||||
|
|
||||||
### Material groups
|
|
||||||
|
|
||||||
These groups correspond to the Minecraft materials. They classify the block into a type, indicating what the block is “made off”.
|
|
||||||
|
|
||||||
* `material_stone=1`: Stone
|
|
||||||
* `material_wood=1`: Wood
|
|
||||||
* `material_sand=1`: Sand
|
|
||||||
* `material_glass=1`: Glass
|
|
||||||
|
|
||||||
Currently, these groups are used for the note block.
|
|
||||||
Note that not all Minecraft materials are used so far. More Minecraft materials will lilely only be added when they are needed for a concrete use case.
|
|
||||||
|
|
||||||
### Declarative groups
|
|
||||||
These groups are used mostly for informational purposes
|
|
||||||
|
|
||||||
* `solid=1`: Solid full-cube block (automatically assigned)
|
|
||||||
* `opaque=1`: Opaque block (automatically assigned)
|
|
||||||
* `not_solid=1`: Block is not solid (only assign this group for nodes which are automatically detected as “solid” in error
|
|
||||||
* `not_opaque=1`: Block is not opaque (only assign this group for nodes which are automatically detected as “opaque” in error
|
|
||||||
* `fire=1`: Fire
|
|
||||||
* `water=1`: Water
|
|
||||||
* `lava=1`: Lava
|
|
||||||
* `top_snow=X`: Top snow with X layers (1-8)
|
|
||||||
* `torch`: Torch or torch-like node
|
|
||||||
* `torch=1`: Torch on floor
|
|
||||||
* `torch=2`: Torch at wall
|
|
||||||
* `liquid`: Block is a liquid
|
|
||||||
* `liquid=1`: Unspecified type
|
|
||||||
* `liquid=2`: Water
|
|
||||||
* `liquid=3`: Lava
|
|
||||||
* `fence=1`: Fence
|
|
||||||
* `fence_gate=1`: Fence gate
|
|
||||||
* `fence_wood=1`: Wooden fence
|
|
||||||
* `fence_nether_brick=1`: Nether brick fence
|
|
||||||
* `flower_pot`: Flower pot
|
|
||||||
* `flower_pot=1`: Empty flower pot
|
|
||||||
* `flower_pot=2`: Flower pot with a plant or flower
|
|
||||||
* `flower=1`: Flower
|
|
||||||
* `place_flowerlike=1`: Node has placement rules like that of a flower
|
|
||||||
* `place_flowerlike=2`: Node has placement rules like tall grass
|
|
||||||
* `cake`: Cake (rating = slices left)
|
|
||||||
* `book=1`: Book
|
|
||||||
* `pane=1`: Node is a “pane”-like node glass pane or iron bars
|
|
||||||
* `bed=1`: Bed
|
|
||||||
* `door=1`: Door
|
|
||||||
* `trapdoor=1`: Closed trapdoor
|
|
||||||
* `trapdoor=2`: Open trapdoor
|
|
||||||
* `glass=1`: Glass (full cubes only)
|
|
||||||
* `rail=1`: Rail
|
|
||||||
* `music_record`: Item is Music Disc
|
|
||||||
* `tnt=1`: Block is TNT
|
|
||||||
* `boat=1`: Boat
|
|
||||||
* `minecart=1`: Minecart
|
|
||||||
* `food`: Item is a comestible item which can be consumed (healthy or unhealthy)
|
|
||||||
* `food=2`: Food
|
|
||||||
* `food=3`: Drink (including soups)
|
|
||||||
* `food=1`: Other/unsure
|
|
||||||
* `eatable`: Item can be *directly* eaten by wielding + right click (`on_use=item_eat`). Rating is the satiation gain
|
|
||||||
* `cocoa`: Node is a cocoa pod (rating is growth stage, ranging from 1 to 3)
|
|
||||||
* `ammo=1`: Item is used as ammo for a weapon
|
|
||||||
* `ammo_bow=1`: Item is used as ammo for bows
|
|
||||||
* `non_combat_armor=1`: Item can be equipped as armor, but is not made for combat (e.g. zombie head, pumpkin)
|
|
||||||
* `container`: Node is a container which physically stores items within and has at least 1 inventory
|
|
||||||
* `container=2`: Has one inventory with list name `"main"`. Items can be placed and taken freely
|
|
||||||
* `container=3`: Same as `container=2`, but shulker boxes can not be inserted
|
|
||||||
* `container=4`: Furnace-like, has lists `"src"`, `"fuel"` and `"dst"`.
|
|
||||||
It is expected that this also reacts on `on_timer`;
|
|
||||||
the node timer must be started from other mods when they add into `"src"` or `"fuel"`
|
|
||||||
* `container=5`: Left part of a 2-part horizontal connected container. Both parts have a `"main"` inventory
|
|
||||||
list. Both inventories are considered to belong together. This is used for large chests.
|
|
||||||
* `container=6`: Same as above, but for the right part.
|
|
||||||
* `container=7`: Has inventory list "`main`", no movement allowed
|
|
||||||
* `container=1`: Other/unspecified container type
|
|
||||||
* `spawn_egg=1`: Spawn egg
|
|
||||||
|
|
||||||
* `pressure_plate=1`: Pressure plate (off)
|
|
||||||
* `pressure_plate=2`: Wooden pressure (on)
|
|
||||||
* `button=1`: Button (off)
|
|
||||||
* `button=2`: Button (on)
|
|
||||||
* `redstone_torch=1`: Redstone Torch (lit)
|
|
||||||
* `redstone_torch=2`: Redstone Torch (unlit)
|
|
||||||
|
|
||||||
* `plant=1`: Plant or part of a plant
|
|
||||||
* `double_plant`: Part of a double-sized plant. 1 = lower part, 2 = upper part
|
|
||||||
|
|
||||||
* `pickaxe=1`: Pickaxe
|
|
||||||
* `shovel=1`: Shovel
|
|
||||||
* `axe=1`: Axe
|
|
||||||
* `sword=1`: Sword
|
|
||||||
* `hoe=1`: Hoe (farming tool)
|
|
||||||
* `shears=1`: Shears
|
|
||||||
|
|
||||||
* `weapon=1`: Item is primarily (!) a weapon
|
|
||||||
* `tool=1`: Item is primarily (!) a tool
|
|
||||||
* `craftitem=1`: Item is primarily (!) used for crafting
|
|
||||||
* `brewitem=1`: Item is primarily (!) used in brewing
|
|
||||||
* `transport=1`: Item is used for transportation
|
|
||||||
* `building_block=1`: Block is a building block
|
|
||||||
* `deco_block=1`: Block is a decorational block
|
|
||||||
|
|
||||||
* `blast_furnace_smeltable=1` : Item or node is smeltable by a blast furnace
|
|
||||||
* `smoker_cookable=1` : Food is cookable by a smoker.
|
|
||||||
|
|
||||||
|
|
||||||
## Fake item groups
|
|
||||||
These groups put similar items together which should all be treated by the gameplay or the GUI as a single item.
|
|
||||||
You should not add custom items to these groups for no good reason, this is likely to cause a ton of conflicts.
|
|
||||||
|
|
||||||
* `clock`: Clock (rating indicates the “frame”)
|
|
||||||
* `compass`: Compass (rating indicates the “frame”)
|
|
||||||
|
|
||||||
This has the following implication: If you want to use a compass or clock in a crafting recipe, you *must*
|
|
||||||
use `group:compass` or `group:clock`, respectively.
|
|
20
LEGAL.md
|
@ -5,10 +5,11 @@ Copying is an act of love. Please copy and share! <3
|
||||||
Here's the detailed legalese for those who need it:
|
Here's the detailed legalese for those who need it:
|
||||||
|
|
||||||
## License of source code
|
## License of source code
|
||||||
MineClone 2 (by kay27, EliasFleckenstein, Wuzzy, davedevils and countless others)
|
MineCloneJEpC (by kay27, EliasFleckenstein, Wuzzy, ROllerozxa,
|
||||||
is an imitation of Minecraft.
|
Lazerbeak12345, davedevils and countless others) is an imitation
|
||||||
|
of Minecraft.
|
||||||
|
|
||||||
MineClone 2 is free software: you can redistribute it and/or modify
|
MineCloneJEpC is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
@ -25,12 +26,15 @@ You can choose which license applies to you: Either the
|
||||||
license of MineClone 2 (GNU GPLv3) or the mod's license.
|
license of MineClone 2 (GNU GPLv3) or the mod's license.
|
||||||
|
|
||||||
MineClone 2 is a direct continuation of the discontinued MineClone
|
MineClone 2 is a direct continuation of the discontinued MineClone
|
||||||
project by davedevils.
|
project by davedevils. MineCloneJEpC is a fork of MineClone 2, which
|
||||||
|
was merged by Lazerbeak12345 with Minecraftn't Pre-classic by
|
||||||
|
ROllerozxa, a fork of Minecraftn't Classic by ROllerozxa, which is a
|
||||||
|
fork of MineClone 2.
|
||||||
|
|
||||||
Mod credits:
|
Mod credits:
|
||||||
See `README.txt` or `README.md` in each mod directory for information about other authors.
|
See `README.txt` or `README.md` in each mod directory for information about other authors.
|
||||||
For mods that do not have such a file, the license is the source code license
|
For mods that do not have such a file, the license is the source code license
|
||||||
of MineClone 2 and the author is Wuzzy.
|
of MineCloneJEpC and the author is documented in the git history.
|
||||||
|
|
||||||
## License of media (textures and sounds)
|
## License of media (textures and sounds)
|
||||||
No non-free licenses are used anywhere.
|
No non-free licenses are used anywhere.
|
||||||
|
@ -50,3 +54,9 @@ http://creativecommons.org/licenses/by-sa/3.0/
|
||||||
|
|
||||||
See README.txt in each mod directory for detailed information about other authors.
|
See README.txt in each mod directory for detailed information about other authors.
|
||||||
|
|
||||||
|
Due to potential copyright problems with Minecraftn't Classic and
|
||||||
|
Pre-classic at one point containing assets copyrighted by Mojang
|
||||||
|
(which none of these projects are associated with), when manually
|
||||||
|
cherry-picking the code from Minecraftn't Pre-classic to be forked on
|
||||||
|
top of MCL2, I made sure to exclude anything that might be copyrighted
|
||||||
|
by Mojang.
|
||||||
|
|
223
README.md
|
@ -1,195 +1,120 @@
|
||||||
# MineClone2
|
# MineCloneJEpC
|
||||||
An unofficial Minecraft-like game for Minetest. Forked from MineClone by davedevils.
|
|
||||||
|
An unofficial Minecraft-like game for Minetest. Forked from MineClone 2 by Wuzzy
|
||||||
|
and merged with Minecraftn't Pre-classic by ROllerozxa
|
||||||
Developed by many people. Not developed or endorsed by Mojang AB.
|
Developed by many people. Not developed or endorsed by Mojang AB.
|
||||||
|
|
||||||
Version: 0.75 (in development)
|
Version: 0.1 (in development)
|
||||||
|
|
||||||
### Gameplay
|
SPECIFIC VERSION OF MINECRAFT CLONED: `old_alpha rd-132211`
|
||||||
You start in a randomly-generated world made entirely of cubes. You can explore
|
|
||||||
the world and dig and build almost every block in the world to create new
|
|
||||||
structures. You can choose to play in a “survival mode” in which you have to
|
|
||||||
fight monsters and hunger for survival and slowly progress through the
|
|
||||||
various other aspects of the game, such as mining, farming, building machines, and so on
|
|
||||||
Or you can play in “creative mode” in which you can build almost anything instantly.
|
|
||||||
|
|
||||||
#### Gameplay summary
|
## Purpose and method
|
||||||
|
|
||||||
|
### Purpose
|
||||||
|
|
||||||
|
The primary purpose of this game is to improove MineClone 2 by researching the
|
||||||
|
development of Minecraft through implimenting each important release in-order.
|
||||||
|
As a side-effect, this will mean each release is a playable game on it's own -
|
||||||
|
but if this project ever catches up to MineClone 2, it will _not_ duplicate
|
||||||
|
code, and will avoid cloning the exact version that project is cloning.
|
||||||
|
|
||||||
|
### Method
|
||||||
|
|
||||||
|
- Make a game that clones the oldest Minecraft release.
|
||||||
|
- Make a modpack for each release following, that expands that game to become a
|
||||||
|
clone of the modpack's release.
|
||||||
|
- Where only absolutely necessary, fork the game to make a release. All future
|
||||||
|
modpacks are to be based on the new game. Such an example would be where making
|
||||||
|
a change to the `game.conf` file is the only option.
|
||||||
|
|
||||||
|
## Gameplay
|
||||||
|
You start in a flat world made entirely of cubes. You can explore the world and
|
||||||
|
dig almost every block in the world, and can use cobblestone to create new
|
||||||
|
structures.
|
||||||
|
|
||||||
|
Keeping true to the exact version of Minecraft that this is cloning, it's pretty
|
||||||
|
bare. There are only grass and cobblestone blocks. (TODO) Press the action key
|
||||||
|
to respawn.
|
||||||
|
|
||||||
|
### Gameplay summary
|
||||||
|
|
||||||
* Sandbox-style gameplay, no goals
|
* Sandbox-style gameplay, no goals
|
||||||
* Survive: Fight against hostile monsters and hunger
|
* Use blocks to create great buildings, your imagination is the limit
|
||||||
* Mine for ores and other treasures
|
* You can build almost anything for free (no cost) and without limit
|
||||||
* Magic: Gain experience and enchant your tools
|
|
||||||
* Use the collected blocks to create great buildings, your imagination is the limit
|
|
||||||
* Collect flowers (and other dye sources) and colorize your world
|
|
||||||
* Find some seeds and start farming
|
|
||||||
* Find or craft one of hundreds of items
|
|
||||||
* Build a railway system and have fun with minecarts
|
|
||||||
* Build complex machines with redstone circuits
|
|
||||||
* In creative mode you can build almost anything for free and without limits
|
|
||||||
|
|
||||||
## How to play (quick start)
|
## How to play (quick start)
|
||||||
### Getting started
|
### Getting started
|
||||||
* **Punch a tree** trunk until it breaks and collect wood
|
- Mine with right click
|
||||||
* Place the **wood into the 2×2 grid** (your “crafting grid” in your inventory menu and craft 4 wood planks
|
- Place with left click
|
||||||
* Place the 4 wood planks in a 2×2 shape in the crafting grid to **make a crafting table**
|
- Walk around
|
||||||
* **Rightclick the crafting table** for a 3×3 crafting grid to craft more complex things
|
|
||||||
* Use the **crafting guide** (book icon) to learn all the possible crafting recipes
|
|
||||||
* **Craft a wooden pickaxe** so you can dig stone
|
|
||||||
* Different tools break different kinds of blocks. Try them out!
|
|
||||||
* Continue playing as you wish. Have fun!
|
|
||||||
|
|
||||||
### Farming
|
|
||||||
* Find seeds
|
|
||||||
* Craft hoe
|
|
||||||
* Rightclick dirt or similar block with hoe to create farmland
|
|
||||||
* Place seeds on farmland and watch them grow
|
|
||||||
* Collect plant when fully grown
|
|
||||||
* If near water, farmland becomes wet and speeds up growth
|
|
||||||
|
|
||||||
### Furnace
|
|
||||||
* Craft furnace
|
|
||||||
* Furnace allows you to obtain more items
|
|
||||||
* Upper slot must contain a smeltable item (example: iron ore)
|
|
||||||
* Lower slot must contain a fuel item (example: coal)
|
|
||||||
* See tooltips in crafting guide to learn about fuels and smeltable items
|
|
||||||
|
|
||||||
### Additional help
|
|
||||||
More help about the gameplay, blocks items and much more can be found from inside
|
|
||||||
the game. You can access the help from your inventory menu.
|
|
||||||
|
|
||||||
### Special items
|
|
||||||
The following items are interesting for Creative Mode and for adventure
|
|
||||||
map builders. They can not be obtained in-game or in the creative inventory.
|
|
||||||
|
|
||||||
* Barrier: `mcl_core:barrier`
|
|
||||||
|
|
||||||
Use the `/giveme` chat command to obtain them. See the in-game help for
|
|
||||||
an explanation.
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
This game requires [Minetest](http://minetest.net) to run (version 5.4.1 or
|
This game requires [Minetest](http://minetest.net) to run (version 5.4.1 or
|
||||||
later). So you need to install Minetest first. Only stable versions of Minetest
|
later). Older versions might work, but this is untested. So you need to install
|
||||||
are officially supported.
|
Minetest first. Only stable versions of Minetest are officially supported.
|
||||||
There is no support for running MineClone2 in development versions of Minetest.
|
There is no support for running MineCloneJEpC on development versions of
|
||||||
|
Minetest.
|
||||||
|
|
||||||
To install MineClone2 (if you haven't already), move this directory into the
|
To install MineCloneJEpC (if you haven't already), move this directory into
|
||||||
“games” directory of your Minetest data directory. Consult the help of
|
the “games” directory of your Minetest data directory. Consult the help of
|
||||||
Minetest to learn more.
|
Minetest to learn more.
|
||||||
|
|
||||||
## Useful links
|
## Useful links
|
||||||
The MineClone2 repository is hosted at Mesehub. To contribute or report issues, head there.
|
The MineCloneJEpC repository is hosted at Mesehub. To contribute or report issues, head there.
|
||||||
|
|
||||||
* Mesehub: <https://git.minetest.land/MineClone2/MineClone2>
|
* Mesehub: <https://git.minetest.land/Lazerbeak12345/MineCloneJEpC>
|
||||||
* Discord: <https://discord.gg/xE4z8EEpDC>
|
|
||||||
* YouTube <https://www.youtube.com/channel/UClI_YcsXMF3KNeJtoBfnk9A>
|
Here's the Minecraft wiki page on the version of Minecraft that this is cloning.
|
||||||
* IRC: <https://web.libera.chat/#mineclone2>
|
|
||||||
* Matrix: <https://app.element.io/#/room/#mc2:matrix.org>
|
<https://minecraft.fandom.com/wiki/Java_Edition_pre-Classic_rd-132211>
|
||||||
* Reddit: <https://www.reddit.com/r/MineClone2/>
|
|
||||||
* Minetest forums: <https://forum.minetest.net/viewtopic.php?f=50&t=16407>
|
|
||||||
* ContentDB: <https://content.minetest.net/packages/wuzzy/mineclone2/>
|
|
||||||
* OpenCollective: <https://opencollective.com/mineclone2>
|
|
||||||
|
|
||||||
## Target
|
## Target
|
||||||
|
|
||||||
- Crucially, create a stable, moddable, free/libre clone of Minecraft
|
- Crucially, create a stable, moddable, free/libre clone of Minecraft
|
||||||
based on the Minetest engine with polished features, usable in both
|
`old_alpha rd-132211` based on the Minetest engine with polished features.
|
||||||
singleplayer and multiplayer. Currently, most of **Minecraft Java
|
No other features will be added - though modifications to apis will be, if
|
||||||
Edition 1.12.2** features are already implemented and polishing existing
|
they facilitate making mods or modpacks to expand this game to clone a newer
|
||||||
features are prioritized over new feature requests.
|
version of Minecraft.
|
||||||
- With lessened priority yet strictly, implement features targetting
|
|
||||||
**Minecraft version 1.17 + OptiFine** (OptiFine only as far as supported
|
|
||||||
by the Minetest Engine). This means features in parity with the listed
|
|
||||||
Minecraft experiences are prioritized over those that don't fulfill this
|
|
||||||
scope.
|
|
||||||
- Optionally, create a performant experience that will run relatively
|
- Optionally, create a performant experience that will run relatively
|
||||||
well on really low spec computers. Unfortunately, due to Minecraft's
|
well on really low spec computers. Unfortunately, due to Minecraft's
|
||||||
mechanisms and Minetest engine's limitations along with a very small
|
mechanisms and Minetest engine's limitations along with a very small
|
||||||
playerbase on low spec computers, optimizations are hard to investigate.
|
playerbase on low spec computers, optimizations are hard to investigate.
|
||||||
|
|
||||||
## Completion status
|
## Completion status
|
||||||
This game is currently in **beta** stage.
|
This game is currently in **pre-alpha** stage.
|
||||||
It is playable, but not yet feature-complete.
|
It is playable, but has a few tweaks left.
|
||||||
Backwards-compability is not entirely guaranteed, updating your world might cause small bugs.
|
Backwards-compability is not entirely guaranteed, updating your world might cause small bugs.
|
||||||
If you want to use the git version of MineClone2 in production, consider using the production branch.
|
|
||||||
It is updated weekly and contains relatively stable code for servers.
|
|
||||||
|
|
||||||
The following main features are available:
|
These things need figured out, and I don't know how to do them:
|
||||||
|
|
||||||
* Tools, weapons
|
* In this edition of minecraft, a left-click places, and a right-click mines.
|
||||||
* Armor
|
(opposite of later versions, and of Minetest defaults)
|
||||||
* Crafting system: 2×2 grid, crafting table (3×3 grid), furnace, including a crafting guide
|
* A way for modpacks to change values in `game.conf` (This will only effect how mods expanding this game function)
|
||||||
* Chests, large chests, ender chests, shulker boxes
|
* mapgen
|
||||||
* Furnaces, hoppers
|
* gamemodes
|
||||||
* Hunger
|
* etc.
|
||||||
* Most monsters and animals
|
|
||||||
* All ores from Minecraft
|
|
||||||
* Most blocks in the overworld
|
|
||||||
* Water and lava
|
|
||||||
* Weather
|
|
||||||
* 28 biomes
|
|
||||||
* The Nether, a fiery underworld in another dimension
|
|
||||||
* Redstone circuits (partially)
|
|
||||||
* Minecarts (partial)
|
|
||||||
* Status effects (partial)
|
|
||||||
* Experience
|
|
||||||
* Enchanting
|
|
||||||
* Brewing, potions, tipped arrow (partial)
|
|
||||||
* Boats
|
|
||||||
* Fire
|
|
||||||
* Buidling blocks: Stairs, slabs, doors, trapdoors, fences, fence gates, walls
|
|
||||||
* Clock
|
|
||||||
* Compass
|
|
||||||
* Sponge
|
|
||||||
* Slime block
|
|
||||||
* Small plants and saplings
|
|
||||||
* Dyes
|
|
||||||
* Banners
|
|
||||||
* Deco blocks: Glass, stained glass, glass panes, iron bars, hardened clay (and colors), heads and more
|
|
||||||
* Item frames
|
|
||||||
* Jukeboxes
|
|
||||||
* Beds
|
|
||||||
* Inventory menu
|
|
||||||
* Creative inventory
|
|
||||||
* Farming
|
|
||||||
* Writable books
|
|
||||||
* Commands
|
|
||||||
* Villages
|
|
||||||
* The End
|
|
||||||
* And more!
|
|
||||||
|
|
||||||
The following features are incomplete:
|
The following main features are available (including features I must now remove):
|
||||||
|
|
||||||
* Some monsters and animals
|
* Blocks in the overworld
|
||||||
* Redstone-related things
|
* Buidling blocks: Stone, Dirt
|
||||||
* Special minecarts
|
* Commands (TO BE REMOVED)
|
||||||
* A couple of non-trivial blocks and items
|
|
||||||
|
|
||||||
Bonus features (not found in Minecraft 1.12):
|
|
||||||
|
|
||||||
* Built-in crafting guide which shows you crafting and smelting recipes
|
|
||||||
* In-game help system containing extensive help about gameplay basics, blocks, items and more
|
|
||||||
* Temporary crafting recipes. They only exist to make some otherwise unaccessible items available when you're not in creative mode. These recipes will be removed as development goes on an more features become available
|
|
||||||
* Saplings in chests in mapgen v6
|
|
||||||
* Fully moddable (thanks to Minetest's powerful Lua API)
|
* Fully moddable (thanks to Minetest's powerful Lua API)
|
||||||
* New blocks and items:
|
* And more! (It's a lot of work to remove - but not so much anymore thanks to ROllerozxa)
|
||||||
* Lookup tool, shows you the help for whatever it touches
|
|
||||||
* More slabs and stairs
|
|
||||||
* Nether Brick Fence Gate
|
|
||||||
* Red Nether Brick Fence
|
|
||||||
* Red Nether Brick Fence Gate
|
|
||||||
|
|
||||||
Technical differences from Minecraft:
|
Technical differences from Minecraft:
|
||||||
|
|
||||||
* Height limit of ca. 31000 blocks (much higher than in Minecraft)
|
* Height limit of ca. 31000 blocks (much higher than in Minecraft)
|
||||||
* Horizontal world size is ca. 62000×62000 blocks (much smaller than in Minecraft, but it is still very large)
|
* Horizontal world size is ca. 62000×62000 blocks (much smaller than in Minecraft, but it is still very large)
|
||||||
* Still very incomplete and buggy
|
* Still very incomplete and buggy
|
||||||
* Blocks, items, enemies and other features are missing
|
* Blocks, items and other features that shouldn't be there
|
||||||
* A few items have slightly different names to make them easier to distinguish
|
* A few items have slightly different names to make them easier to distinguish
|
||||||
* Different music for jukebox
|
|
||||||
* Different textures (Pixel Perfection)
|
* Different textures (Pixel Perfection)
|
||||||
* Different sounds (various sources)
|
* Different sounds (various sources) (TO BE REMOVED)
|
||||||
* Different engine (Minetest)
|
* Different engine (Minetest)
|
||||||
* Different easter eggs
|
* Different easter eggs
|
||||||
|
|
||||||
… and finally, MineClone2 is free software (“free” as in “freedom”)!
|
… and finally, MineCloneJEpC is free software (“free” as in “freedom”)!
|
||||||
|
|
||||||
## Other readme files
|
## Other readme files
|
||||||
|
|
||||||
|
|
|
@ -1,324 +0,0 @@
|
||||||
# MineClone 2
|
|
||||||
一個非官方的Minetest遊戲,遊玩方式和Minecraft類似。由davedevils從MineClone分拆。
|
|
||||||
由許多人開發。並非由Mojang Studios開發。<!-- "Mojang AB"'s Name changed at 2020/05, main README should change too -->
|
|
||||||
|
|
||||||
版本:0.71.0
|
|
||||||
|
|
||||||
### 遊玩
|
|
||||||
你開始在一個完全由方塊隨機生成的世界裡。你可以探索這個世界,挖掘和建造世界上幾乎所有的方塊,以創造新的結構。你可以選擇在「生存模式」中進行遊戲,在這個模式中,你必須與怪物戰鬥,飢餓求生,並在遊戲的其他各個環節中慢慢進步,如採礦、養殖、建造機器等等。
|
|
||||||
|
|
||||||
或者你也可以在「創造模式」中玩,在這個模式中,你可以瞬間建造大部分東西。
|
|
||||||
#### Gameplay summary
|
|
||||||
|
|
||||||
* 沙盒式遊戲,沒有明確目標
|
|
||||||
* 生存:與怪物和飢餓搏鬥
|
|
||||||
* 挖礦來獲得礦物和寶物
|
|
||||||
* 附魔:獲得經驗值並以附魔強化你的工具
|
|
||||||
* 使用收集的方塊來創造偉大的建築
|
|
||||||
* 收集鮮花(和其他染料來源),令世界多姿多彩
|
|
||||||
* 找些種子並開始耕種
|
|
||||||
* 尋找或合成數百個物品之一
|
|
||||||
* 建立一個鐵路系統,並從礦車中得到樂趣
|
|
||||||
* 用紅石電路建造複雜的機器
|
|
||||||
* 在創造模式下,你幾乎可以免費建造任何東西,而且沒有限制。
|
|
||||||
|
|
||||||
## 如何開始
|
|
||||||
### 開始生存
|
|
||||||
* **挖樹幹**直到其破裂並收集木材
|
|
||||||
* 將木頭**放入2×2的格子中**(你的物品欄中的「合成格子」),然後製作4塊木材。
|
|
||||||
* 將4塊木材按2×2的形狀擺放在合成格子裡,製作成合成臺。
|
|
||||||
* **右鍵單擊製作臺**以獲得3×3製作網格,製作更複雜的東西
|
|
||||||
* 使用**合成指南**(書形圖標)了解所有可能的合成方式
|
|
||||||
* **製作一個木鎬**,這樣你就可以挖石頭了。
|
|
||||||
* 不同的工具可以打破不同種類的方塊。試試吧!
|
|
||||||
* 繼續玩你想玩的。盡情享受吧!
|
|
||||||
|
|
||||||
### 耕種
|
|
||||||
* 找到種子
|
|
||||||
* 合成鋤頭
|
|
||||||
* 用鋤頭右鍵點擊泥土或類似的方塊,創建農田
|
|
||||||
* 將種子放在農田上,看著它們長出來
|
|
||||||
* Collect plant when fully grown
|
|
||||||
* If near water, farmland becomes wet and speeds up growth
|
|
||||||
|
|
||||||
### Furnace
|
|
||||||
* Craft furnace
|
|
||||||
* Furnace allows you to obtain more items
|
|
||||||
* Upper slot must contain a smeltable item (example: iron ore)
|
|
||||||
* Lower slot must contain a fuel item (example: coal)
|
|
||||||
* See tooltips in crafting guide to learn about fuels and smeltable items
|
|
||||||
|
|
||||||
### Additional help
|
|
||||||
More help about the gameplay, blocks items and much more can be found from inside
|
|
||||||
the game. You can access the help from your inventory menu.
|
|
||||||
|
|
||||||
### Special items
|
|
||||||
The following items are interesting for Creative Mode and for adventure
|
|
||||||
map builders. They can not be obtained in-game or in the creative inventory.
|
|
||||||
|
|
||||||
* Barrier: `mcl_core:barrier`
|
|
||||||
|
|
||||||
Use the `/giveme` chat command to obtain them. See the in-game help for
|
|
||||||
an explanation.
|
|
||||||
|
|
||||||
#### Incomplete items
|
|
||||||
These items do not work yet, but you can get them with `/giveme` for testing:
|
|
||||||
|
|
||||||
* Minecart with Chest: `mcl_minecarts:chest_minecart`
|
|
||||||
* Minecart with Furnace: `mcl_minecarts:furnace_minecart`
|
|
||||||
* Minecart with Hopper: `mcl_minecarts:hopper_minecart`
|
|
||||||
* Minecart with Command Block: `mcl_minecarts:command_block_minecart`
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
This game requires [Minetest](http://minetest.net) to run (version 5.0.0 or
|
|
||||||
later). So you need to install Minetest first. Only stable versions of Minetest
|
|
||||||
are officially supported.
|
|
||||||
There is no support for running MineClone 2 in development versions of Minetest.
|
|
||||||
|
|
||||||
To install MineClone 2 (if you haven't already), move this directory into the
|
|
||||||
“games” directory of your Minetest data directory. Consult the help of
|
|
||||||
Minetest to learn more.
|
|
||||||
|
|
||||||
## Project description
|
|
||||||
The main goal of **MineClone 2** is to be a clone of Minecraft and to be released as free software.
|
|
||||||
|
|
||||||
* **開發目標:我的世界, Java版, 版本 1.12**
|
|
||||||
* MineClone2還包括Minetest支持的Optifine功能。
|
|
||||||
* 後期Minecraft版本的功能可能會偷偷加入,但它們的優先級較低。
|
|
||||||
* 總的來說,Minecraft的目標是在Minetest目前允許的情況下進行克隆。
|
|
||||||
* 克隆Minecraft是最優先的。
|
|
||||||
* MineClone2將使用不同的圖形和聲音,但風格相似。
|
|
||||||
* 克隆界面沒有優先權。只會被粗略地模仿。
|
|
||||||
* 在Minetest中發現的局限性將在開發過程中被記錄和報告。
|
|
||||||
|
|
||||||
## 完成程度
|
|
||||||
該遊戲目前處於**alpha**階段。
|
|
||||||
它是可玩的,但尚未完成,預計會出現許多錯誤。
|
|
||||||
向後兼容性是**不能保證的**,更新你的世界可能會造成大大小小的bug(比如「缺少節點」的錯誤甚至崩潰)。
|
|
||||||
|
|
||||||
已經實現以下功能:
|
|
||||||
|
|
||||||
* 工具,武器
|
|
||||||
* 盔甲
|
|
||||||
* 合成和熔煉系統:2×2 合成格, 合成臺 (3×3 合成格), 熔爐, 合成教學
|
|
||||||
* 儲物箱,大型儲物箱,終界箱和界伏盒
|
|
||||||
* 熔爐, 漏斗
|
|
||||||
* 飢餓和飽食
|
|
||||||
* 大多數怪物和動物
|
|
||||||
* Minecraft 1.12中的所有礦物<!-- Minecraft 1.17 added copper, so here must mark the version is 1.12, then main README should also add this -->
|
|
||||||
* 主世界的大部分方塊
|
|
||||||
* 水和岩漿
|
|
||||||
* 天氣
|
|
||||||
* 28個生態域
|
|
||||||
* 地獄,熾熱的維度
|
|
||||||
* 紅石電路(部分)
|
|
||||||
* 礦車(部分)
|
|
||||||
* 狀態效果(部分)
|
|
||||||
* 經驗系統
|
|
||||||
* 附魔
|
|
||||||
* 釀造,藥水,藥水箭(部分)
|
|
||||||
* 船
|
|
||||||
* 火
|
|
||||||
* 建築方塊:樓梯、半磚、門、地板門、柵欄、柵欄門、牆。
|
|
||||||
* 時鐘
|
|
||||||
* 指南針
|
|
||||||
* 海綿
|
|
||||||
* 史萊姆方塊(不與紅石互動)
|
|
||||||
* 小植物和樹苗
|
|
||||||
* 染料
|
|
||||||
* 旗幟
|
|
||||||
* 裝飾方塊:玻璃、染色玻璃、玻璃片、鐵柵欄、陶土(和染色版本)、頭顱等
|
|
||||||
* 物品展示框
|
|
||||||
* 唱片機
|
|
||||||
* 床
|
|
||||||
* 物品欄
|
|
||||||
* 創造模式物品欄
|
|
||||||
* 生產
|
|
||||||
* 書和羽毛筆
|
|
||||||
* 一些服務器命令
|
|
||||||
* 還有更多!
|
|
||||||
|
|
||||||
以下是不完整的特性:
|
|
||||||
|
|
||||||
* 生成結構(特別是村莊)
|
|
||||||
* 一些怪物和動物
|
|
||||||
* 紅石系統
|
|
||||||
* 終界
|
|
||||||
* 特殊的礦車
|
|
||||||
* 一些不簡單的方塊和物品。
|
|
||||||
|
|
||||||
額外功能(在Minecraft 1.11中沒有)。
|
|
||||||
|
|
||||||
* 內置合成指南,向你展示製作和熔煉的配方
|
|
||||||
* 遊戲中的幫助系統包含了大量關於遊戲基礎知識、方塊、物品等方面的幫助。
|
|
||||||
* 臨時製作配方。它們的存在只是為了在你不在創造模式下時,提供一些其他無法獲得的物品。這些配方將隨著開發的進行和更多功能的出現而被移除。
|
|
||||||
* v6地圖生成器中箱子裡的樹苗。
|
|
||||||
* 完全可修改(得益於Minetest強大的Lua API)。
|
|
||||||
* 新的方塊和物品:
|
|
||||||
* 查找工具,顯示觸及事物的幫助
|
|
||||||
* 更多的半磚和樓梯
|
|
||||||
* 地獄磚柵欄門
|
|
||||||
* 紅地獄磚柵欄
|
|
||||||
* 紅地獄磚柵欄門
|
|
||||||
|
|
||||||
與Minecraft的技性術差異:
|
|
||||||
|
|
||||||
* 高度限制為31000格(遠高於Minecraft)
|
|
||||||
* 水平世界大小約為62000×62000格(比Minecraft中的小得多,但仍然非常大)。
|
|
||||||
* 仍然非常不完整和有問題
|
|
||||||
* 塊、物品、敵人和其他功能缺失。
|
|
||||||
* 一些項目的名稱略有不同,以便於區分。
|
|
||||||
* 唱片機的音樂不同
|
|
||||||
* 不同的材質(像素完美)
|
|
||||||
* 不同的聲音(各種來源)
|
|
||||||
* 不同的引擎(Minetest)
|
|
||||||
|
|
||||||
...最後,MineClone2是自由軟件!
|
|
||||||
|
|
||||||
## 錯誤報告
|
|
||||||
請在此處報告所有錯誤和缺少的功能:
|
|
||||||
|
|
||||||
<https://git.minetest.land/MineClone2/MineClone2/issues>
|
|
||||||
|
|
||||||
## Chating with the community
|
|
||||||
我們有Discord交流羣:
|
|
||||||
|
|
||||||
<https://discord.gg/84GKcxczG3>
|
|
||||||
|
|
||||||
|
|
||||||
## Other readme files
|
|
||||||
|
|
||||||
* `LICENSE.txt`:GPLv3許可文本
|
|
||||||
* `CONTRIBUTING.md`: 為那些想參與貢獻的人提供資訊
|
|
||||||
* `MISSING_ENGINE_FEATURES.md`: MineClone2需要改进,Minetest中缺失的功能列表。
|
|
||||||
* `API.md`: 關於MineClone2的API
|
|
||||||
|
|
||||||
## 參與者
|
|
||||||
有這麼多人要列出(抱歉)。詳情請查看各mod目錄。本節只是粗略地介紹了本遊戲的核心作者。
|
|
||||||
|
|
||||||
### 程式碼
|
|
||||||
* [Wuzzy](https://forum.minetest.net/memberlist.php?mode=viewprofile&u=3082):大多數mod的主要程序員(已退休)
|
|
||||||
* davedevils:MineClone 2的原型——「MineClone」的創造者
|
|
||||||
* [ex-bart](https://github.com/ex-bart):紅石比較器
|
|
||||||
* [Rootyjr](https://github.com/Rootyjr):釣竿和錯誤修復
|
|
||||||
* [aligator](https://github.com/aligator):改進門
|
|
||||||
* [ryvnf](https://github.com/ryvnf):爆炸物理
|
|
||||||
* MysticTempest:錯誤修復
|
|
||||||
* [bzoss](https://github.com/bzoss):狀態效果,釀造,藥水
|
|
||||||
* kay27 <kay27@bk.ru>:經驗系統,錯誤修復和優化(當前維護者)
|
|
||||||
* [EliasFleckenstein03](https://github.com/EliasFleckenstein03):終界水晶,附魔,燃燒的怪物/玩家,箱子的動畫和錯誤修復(當前維護者)
|
|
||||||
* epCode:更好的玩家動畫,新徽標
|
|
||||||
* 2mac:修復動力鐵軌的錯誤
|
|
||||||
* 更多:待篇寫 (請查看各mod目錄)
|
|
||||||
|
|
||||||
#### Mod(概括)
|
|
||||||
|
|
||||||
* `controls`: Arcelmi
|
|
||||||
* `flowlib`: Qwertymine13
|
|
||||||
* `walkover`: lordfingle
|
|
||||||
* `drippingwater`: kddekadenz
|
|
||||||
* `mobs_mc`: maikerumine, 22i and others
|
|
||||||
* `awards`: rubenwardy
|
|
||||||
* `screwdriver`: RealBadAngel, Maciej Kastakin, Minetest contributors
|
|
||||||
* `xpanes`: Minetest contributors
|
|
||||||
* `mesecons` mods: Jeija and contributors
|
|
||||||
* `wieldview`: Stuart Jones
|
|
||||||
* `mcl_meshhand`: Based on `newhand` by jordan4ibanez
|
|
||||||
* `mcl_mobs`: Based on Mobs Redo [`mobs`] by TenPlus1 and contributors
|
|
||||||
* 大多其他的Mod: Wuzzy
|
|
||||||
|
|
||||||
每个mod的详细參與者可以在各个mod目录中找到。
|
|
||||||
|
|
||||||
### 圖形
|
|
||||||
* [XSSheep](http://www.minecraftforum.net/members/XSSheep):主要作者;Minecraft 1.11的Pixel Perfection资源包的制作者
|
|
||||||
* [Wuzzy](https://forum.minetest.net/memberlist.php?mode=viewprofile&u=3082):主菜單圖像和各種編輯和添加的材質包
|
|
||||||
* [kingoscargames](https://github.com/kingoscargames):現有材質的各種編輯和添加
|
|
||||||
* [leorockway](https://github.com/leorockway):怪物紋理的一些編輯
|
|
||||||
* [xMrVizzy](https://minecraft.curseforge.com/members/xMrVizzy):釉陶(材質以後會被替換)
|
|
||||||
* yutyo <tanakinci2002@gmail.com>:MineClone2標志
|
|
||||||
* 其他:GUI圖片
|
|
||||||
|
|
||||||
### 翻譯
|
|
||||||
* Wuzzy:德語
|
|
||||||
* Rocher Laurent <rocherl@club-internet.fr>:法語
|
|
||||||
* wuniversales:西班牙語
|
|
||||||
* kay27 <kay27@bk.ru>:俄語
|
|
||||||
* [Emoji](https://toyshost2.ddns.net):繁體中文<!-- Hi, after the translate finish, this name should add to the main README too! -->
|
|
||||||
|
|
||||||
### 模型
|
|
||||||
* [22i](https://github.com/22i):所有模型的作者
|
|
||||||
* [tobyplowy](https://github.com/tobyplowy):對上述模型進行UV映射修復
|
|
||||||
|
|
||||||
### 聲音和音樂
|
|
||||||
多種來源。 有關詳細信息,請參見相應的mod目錄。
|
|
||||||
|
|
||||||
### 特殊感謝
|
|
||||||
|
|
||||||
* Wuzzy,感謝他啟動和維護MineClone2多年。
|
|
||||||
* celeron55,創建Minetest。
|
|
||||||
* Minetest的社區提供了大量的mods選擇,其中一些最終被納入MineClone 2。
|
|
||||||
* Jordach,為《Big Freaking Dig》的唱片機音樂合輯而來
|
|
||||||
* 花了太多時間為Minecraft Wiki寫作的工作狂。它是創建這個遊戲的寶貴資源。
|
|
||||||
* Notch和Jeb是Minecraft背后的主要力量
|
|
||||||
* XSSheep用於創建Pixel Perfection資源包。
|
|
||||||
* [22i](https://github.com/22i) 提供出色的模型和支持
|
|
||||||
* [maikerumine](http://github.com/maikerumine) 揭開生物和生物群落的序幕
|
|
||||||
|
|
||||||
## 給程序員的信息
|
|
||||||
你可以在「API.md」中找到有趣和有用的信息。
|
|
||||||
|
|
||||||
## 法律信息
|
|
||||||
這是一款粉絲開發的遊戲,並非由Mojang AB開發或認可。
|
|
||||||
|
|
||||||
複製是一種愛的行為。請複制和分享! <3
|
|
||||||
下面是詳細的法律條文,有需要的朋友可以參考。
|
|
||||||
|
|
||||||
### License of source code
|
|
||||||
```
|
|
||||||
MineClone 2 (by kay27, EliasFleckenstein, Wuzzy, davedevils and countless others)
|
|
||||||
is an imitation of Minecraft.
|
|
||||||
|
|
||||||
MineClone 2 is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License (in the LICENSE.txt file) for more
|
|
||||||
details.
|
|
||||||
|
|
||||||
In the mods you might find in the read-me or license
|
|
||||||
text files a different license. This counts as dual-licensing.
|
|
||||||
You can choose which license applies to you: Either the
|
|
||||||
license of MineClone 2 (GNU GPLv3) or the mod's license.
|
|
||||||
|
|
||||||
MineClone 2 is a direct continuation of the discontinued MineClone
|
|
||||||
project by davedevils.
|
|
||||||
|
|
||||||
Mod credits:
|
|
||||||
See `README.txt` or `README.md` in each mod directory for information about other authors.
|
|
||||||
For mods that do not have such a file, the license is the source code license
|
|
||||||
of MineClone 2 and the author is Wuzzy.
|
|
||||||
```
|
|
||||||
|
|
||||||
### License of media (textures and sounds)
|
|
||||||
```
|
|
||||||
No non-free licenses are used anywhere.
|
|
||||||
|
|
||||||
The textures, unless otherwise noted, are based on the Pixel Perfection resource pack for Minecraft 1.11,
|
|
||||||
authored by XSSheep. Most textures are verbatim copies, while some textures have been changed or redone
|
|
||||||
from scratch.
|
|
||||||
The glazed terracotta textures have been created by (MysticTempest)[https://github.com/MysticTempest].
|
|
||||||
Source: <https://www.planetminecraft.com/texture_pack/131pixel-perfection/>
|
|
||||||
License: [CC BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)
|
|
||||||
|
|
||||||
The main menu images are release under: [CC0](https://creativecommons.org/publicdomain/zero/1.0/)
|
|
||||||
|
|
||||||
All other files, unless mentioned otherwise, fall under:
|
|
||||||
Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
|
||||||
http://creativecommons.org/licenses/by-sa/3.0/
|
|
||||||
|
|
||||||
See README.txt in each mod directory for detailed information about other authors.
|
|
||||||
```
|
|
|
@ -1 +1 @@
|
||||||
A survival sandbox game. Survive, gather, hunt, mine, build, explore, and do much more. Faithful clone of Minecraft 1.12. This is a work in progress! Expect bugs!
|
A clone of a historic sandbox game, Mincraft rd-132211. Mine, build and explore. This is a work in progress! Expect bugs!
|
||||||
|
|
|
@ -1,2 +1,5 @@
|
||||||
name = MineClone 2
|
name = MineCloneJEpC
|
||||||
description = A survival sandbox game. Survive, gather, hunt, build, explore, and do much more.
|
description = A clone of a historic sandbox game. Build, explore, and do little more.
|
||||||
|
disabled_settings = enable_damage,creative_mode,enable_server
|
||||||
|
allowed_mapgens = singlenode
|
||||||
|
disallowed_mapgen_settings = seed
|
||||||
|
|
|
@ -4,44 +4,7 @@
|
||||||
# They will override these settings
|
# They will override these settings
|
||||||
|
|
||||||
# Basic game rules
|
# Basic game rules
|
||||||
time_speed = 72
|
item_entity_ttl = 1
|
||||||
|
# This wasn't working, so I've also specified this in `mcljepc_core`
|
||||||
# Player physics
|
time_speed = 0
|
||||||
movement_acceleration_default = 2.4
|
node_highlighting = halo
|
||||||
movement_acceleration_air = 1.2
|
|
||||||
#movement_acceleration_fast = 10
|
|
||||||
|
|
||||||
movement_speed_walk = 4.317
|
|
||||||
movement_speed_crouch = 1.295
|
|
||||||
movement_speed_fast = 25.0
|
|
||||||
|
|
||||||
movement_speed_jump = 6.6
|
|
||||||
movement_speed_climb = 2.35
|
|
||||||
# TODO: Add descend speed (3.0) when available
|
|
||||||
|
|
||||||
movement_liquid_fluidity = 1.13
|
|
||||||
movement_liquid_fluidity_smooth = 0.5
|
|
||||||
movement_liquid_sink = 23
|
|
||||||
|
|
||||||
movement_gravity = 10.4
|
|
||||||
|
|
||||||
# Mapgen stuff
|
|
||||||
|
|
||||||
# altitude_chill and altitude_dry doesn't go well together with MCL2 biomes
|
|
||||||
# which already include "snowed" variants as you go higher.
|
|
||||||
# humid_rivers would cause the MushroomIsland biome to appear frequently around rivers.
|
|
||||||
mgvalleys_spflags = noaltitude_chill,noaltitude_dry,nohumid_rivers,vary_river_depth
|
|
||||||
|
|
||||||
# MCL2-specific stuff
|
|
||||||
keepInventory = false
|
|
||||||
|
|
||||||
# Performance settings
|
|
||||||
dedicated_server_step = 0.05 #tick rate
|
|
||||||
# abm_interval = 0.25
|
|
||||||
# max_objects_per_block = 4096
|
|
||||||
# max_packets_per_iteration = 10096
|
|
||||||
|
|
||||||
# Clientmodding to support official client
|
|
||||||
enable_client_modding = true
|
|
||||||
csm_restriction_flags = 0
|
|
||||||
enable_mod_channels = true
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
This mod automatically adds groups to items based on item metadata.
|
|
||||||
|
|
||||||
Specifically, this mod has 2 purposes:
|
|
||||||
1) Automatically adding the group “solid” for blocks considered “solid” in Minecraft.
|
|
||||||
2) Generating digging time group for all nodes based on node metadata (it's complicated)
|
|
||||||
|
|
||||||
This mod also requires another mod called “mcl_autogroup” to function properly.
|
|
||||||
“mcl_autogroup” exposes the API used to register digging groups, while this mod
|
|
||||||
uses those digging groups to set the digging time groups for all the nodes and
|
|
||||||
tools.
|
|
||||||
|
|
||||||
See init.lua for more infos.
|
|
||||||
|
|
||||||
The leading underscore in the name “_mcl_autogroup” was added to force Minetest to load this mod as late as possible.
|
|
||||||
As of 0.4.16, Minetest loads mods in reverse alphabetical order.
|
|
|
@ -1,367 +0,0 @@
|
||||||
--[[
|
|
||||||
This mod implements a HACK to make 100% sure the digging times of all tools
|
|
||||||
match Minecraft's perfectly. The digging times system of Minetest is very
|
|
||||||
different, so this weird group trickery has to be used. In Minecraft, each
|
|
||||||
block has a hardness and the actual Minecraft digging time is determined by
|
|
||||||
this:
|
|
||||||
|
|
||||||
1) The block's hardness
|
|
||||||
2) The tool being used (the tool speed and its efficiency level)
|
|
||||||
3) Whether the tool is considered as "eligible" for the block
|
|
||||||
(e.g. only diamond pick eligible for obsidian)
|
|
||||||
|
|
||||||
See Minecraft Wiki <http://minecraft.gamepedia.com/Minecraft_Wiki> for more
|
|
||||||
information.
|
|
||||||
|
|
||||||
How the mod is used
|
|
||||||
===================
|
|
||||||
|
|
||||||
In MineClone 2, all diggable nodes have the hardness set in the custom field
|
|
||||||
"_mcl_hardness" (0 by default). These values are used together with digging
|
|
||||||
groups by this mod to create the correct digging times for nodes. Digging
|
|
||||||
groups are registered using the following code:
|
|
||||||
|
|
||||||
mcl_autogroup.register_diggroup("shovely")
|
|
||||||
mcl_autogroup.register_diggroup("pickaxey", {
|
|
||||||
levels = { "wood", "gold", "stone", "iron", "diamond" }
|
|
||||||
})
|
|
||||||
|
|
||||||
The first line registers a simple digging group. The second line registers a
|
|
||||||
digging group with 5 different levels (in this case one for each material of a
|
|
||||||
pickaxes).
|
|
||||||
|
|
||||||
Nodes indicate that they belong to a particular digging group by being member of
|
|
||||||
the digging group in their node definition. "mcl_core:dirt" for example has
|
|
||||||
shovely=1 in its groups. If the digging group has multiple levels the value of
|
|
||||||
the group indicates which digging level the node requires.
|
|
||||||
"mcl_core:stone_with_gold" for example has pickaxey=4 because it requires a
|
|
||||||
pickaxe of level 4 be mined.
|
|
||||||
|
|
||||||
For tools to be able to dig nodes of digging groups they need to use the have
|
|
||||||
the custom field "_mcl_diggroups" function to get the groupcaps. The value of
|
|
||||||
this field is a table which defines which groups the tool can dig and how
|
|
||||||
efficiently.
|
|
||||||
|
|
||||||
_mcl_diggroups = {
|
|
||||||
handy = { speed = 1, level = 1, uses = 0 },
|
|
||||||
pickaxey = { speed = 1, level = 0, uses = 0 },
|
|
||||||
}
|
|
||||||
|
|
||||||
The "uses" field indicate how many uses (0 for infinite) a tool has when used on
|
|
||||||
the specified digging group. The "speed" field is a multiplier to the dig speed
|
|
||||||
on that digging group.
|
|
||||||
|
|
||||||
The "level" field indicates which levels of the group the tool can harvest. A
|
|
||||||
level of 0 means that the tool cannot harvest blocks of that node. A level of 1
|
|
||||||
or above means that the tool can harvest nodes with that level or below. See
|
|
||||||
"mcl_tools/init.lua" for examples on how "_mcl_diggroups" is used in practice.
|
|
||||||
|
|
||||||
Information about the mod
|
|
||||||
=========================
|
|
||||||
|
|
||||||
The mod is split up into two parts, mcl_autogroup and _mcl_autogroup.
|
|
||||||
mcl_autogroup contains the API functions used to register custom digging groups.
|
|
||||||
_mcl_autogroup contains most of the code. The leading underscore in the name
|
|
||||||
"_mcl_autogroup" is used to force Minetest to load that part of the mod as late
|
|
||||||
as possible. Minetest loads mods in reverse alphabetical order.
|
|
||||||
|
|
||||||
This also means that it is very important that no mod adds _mcl_autogroup as a
|
|
||||||
dependency.
|
|
||||||
--]]
|
|
||||||
|
|
||||||
assert(minetest.get_modpath("mcl_autogroup"), "This mod requires the mod mcl_autogroup to function")
|
|
||||||
|
|
||||||
-- Returns a table containing the unique "_mcl_hardness" for nodes belonging to
|
|
||||||
-- each diggroup.
|
|
||||||
local function get_hardness_values_for_groups()
|
|
||||||
local maps = {}
|
|
||||||
local values = {}
|
|
||||||
for g, _ in pairs(mcl_autogroup.registered_diggroups) do
|
|
||||||
maps[g] = {}
|
|
||||||
values[g] = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, ndef in pairs(minetest.registered_nodes) do
|
|
||||||
for g, _ in pairs(mcl_autogroup.registered_diggroups) do
|
|
||||||
if ndef.groups[g] then
|
|
||||||
maps[g][ndef._mcl_hardness or 0] = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for g, map in pairs(maps) do
|
|
||||||
for k, _ in pairs(map) do
|
|
||||||
table.insert(values[g], k)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for g, _ in pairs(mcl_autogroup.registered_diggroups) do
|
|
||||||
table.sort(values[g])
|
|
||||||
end
|
|
||||||
return values
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Returns a table containing a table indexed by "_mcl_hardness_value" to get
|
|
||||||
-- its index in the list of unique hardnesses for each diggroup.
|
|
||||||
local function get_hardness_lookup_for_groups(hardness_values)
|
|
||||||
local map = {}
|
|
||||||
for g, values in pairs(hardness_values) do
|
|
||||||
map[g] = {}
|
|
||||||
for k, v in pairs(values) do
|
|
||||||
map[g][v] = k
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return map
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Array of unique hardness values for each group which affects dig time.
|
|
||||||
local hardness_values = get_hardness_values_for_groups()
|
|
||||||
|
|
||||||
-- Map indexed by hardness values which return the index of that value in
|
|
||||||
-- hardness_value. Used for quick lookup.
|
|
||||||
local hardness_lookup = get_hardness_lookup_for_groups(hardness_values)
|
|
||||||
|
|
||||||
--[[local function compute_creativetimes(group)
|
|
||||||
local creativetimes = {}
|
|
||||||
|
|
||||||
for index, hardness in pairs(hardness_values[group]) do
|
|
||||||
table.insert(creativetimes, 0)
|
|
||||||
end
|
|
||||||
|
|
||||||
return creativetimes
|
|
||||||
end]]
|
|
||||||
|
|
||||||
-- Get the list of digging times for using a specific tool on a specific
|
|
||||||
-- diggroup.
|
|
||||||
--
|
|
||||||
-- Parameters:
|
|
||||||
-- group - the group which it is digging
|
|
||||||
-- can_harvest - if the tool can harvest the block
|
|
||||||
-- speed - dig speed multiplier for tool (default 1)
|
|
||||||
-- efficiency - efficiency level for the tool if applicable
|
|
||||||
local function get_digtimes(group, can_harvest, speed, efficiency)
|
|
||||||
local speed = speed or 1
|
|
||||||
if efficiency then
|
|
||||||
speed = speed + efficiency * efficiency + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
local digtimes = {}
|
|
||||||
|
|
||||||
for index, hardness in pairs(hardness_values[group]) do
|
|
||||||
local digtime = (hardness or 0) / speed
|
|
||||||
if can_harvest then
|
|
||||||
digtime = digtime * 1.5
|
|
||||||
else
|
|
||||||
digtime = digtime * 5
|
|
||||||
end
|
|
||||||
|
|
||||||
if digtime <= 0.05 then
|
|
||||||
digtime = 0
|
|
||||||
else
|
|
||||||
digtime = math.ceil(digtime * 20) / 20
|
|
||||||
end
|
|
||||||
table.insert(digtimes, digtime)
|
|
||||||
end
|
|
||||||
|
|
||||||
return digtimes
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Get one groupcap field for using a specific tool on a specific group.
|
|
||||||
local function get_groupcap(group, can_harvest, multiplier, efficiency, uses)
|
|
||||||
return {
|
|
||||||
times = get_digtimes(group, can_harvest, multiplier, efficiency),
|
|
||||||
uses = uses,
|
|
||||||
maxlevel = 0,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Add the groupcaps from a field in "_mcl_diggroups" to the groupcaps of a
|
|
||||||
-- tool.
|
|
||||||
local function add_groupcaps(toolname, groupcaps, groupcaps_def, efficiency)
|
|
||||||
if not groupcaps_def then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
for g, capsdef in pairs(groupcaps_def) do
|
|
||||||
local mult = capsdef.speed or 1
|
|
||||||
local uses = capsdef.uses
|
|
||||||
local def = mcl_autogroup.registered_diggroups[g]
|
|
||||||
local max_level = def.levels and #def.levels or 1
|
|
||||||
|
|
||||||
assert(capsdef.level, toolname .. ' is missing level for ' .. g)
|
|
||||||
local level = math.min(capsdef.level, max_level)
|
|
||||||
|
|
||||||
if def.levels then
|
|
||||||
groupcaps[g .. "_dig_default"] = get_groupcap(g, false, mult, efficiency, uses)
|
|
||||||
if level > 0 then
|
|
||||||
groupcaps[g .. "_dig_" .. def.levels[level]] = get_groupcap(g, true, mult, efficiency, uses)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
groupcaps[g .. "_dig"] = get_groupcap(g, level > 0, mult, efficiency, uses)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Checks if the given node would drop its useful drop if dug by a given tool.
|
|
||||||
-- Returns true if it will yield its useful drop, false otherwise.
|
|
||||||
function mcl_autogroup.can_harvest(nodename, toolname)
|
|
||||||
local ndef = minetest.registered_nodes[nodename]
|
|
||||||
|
|
||||||
if not ndef then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
if minetest.get_item_group(nodename, "dig_immediate") >= 2 then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Check if it can be dug by tool
|
|
||||||
local tdef = minetest.registered_tools[toolname]
|
|
||||||
if tdef and tdef._mcl_diggroups then
|
|
||||||
for g, gdef in pairs(tdef._mcl_diggroups) do
|
|
||||||
if ndef.groups[g] then
|
|
||||||
if ndef.groups[g] <= gdef.level then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Check if it can be dug by hand
|
|
||||||
local tdef = minetest.registered_tools[""]
|
|
||||||
if tdef then
|
|
||||||
for g, gdef in pairs(tdef._mcl_diggroups) do
|
|
||||||
if ndef.groups[g] then
|
|
||||||
if ndef.groups[g] <= gdef.level then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Get one groupcap field for using a specific tool on a specific group.
|
|
||||||
--[[local function get_groupcap(group, can_harvest, multiplier, efficiency, uses)
|
|
||||||
return {
|
|
||||||
times = get_digtimes(group, can_harvest, multiplier, efficiency),
|
|
||||||
uses = uses,
|
|
||||||
maxlevel = 0,
|
|
||||||
}
|
|
||||||
end]]
|
|
||||||
|
|
||||||
-- Returns the tool_capabilities from a tool definition or a default set of
|
|
||||||
-- tool_capabilities
|
|
||||||
local function get_tool_capabilities(tdef)
|
|
||||||
if tdef.tool_capabilities then
|
|
||||||
return tdef.tool_capabilities
|
|
||||||
end
|
|
||||||
|
|
||||||
-- If the damage group and punch interval from hand is not included,
|
|
||||||
-- then the user will not be able to attack with the tool.
|
|
||||||
local hand_toolcaps = minetest.registered_tools[""].tool_capabilities
|
|
||||||
return {
|
|
||||||
full_punch_interval = hand_toolcaps.full_punch_interval,
|
|
||||||
damage_groups = hand_toolcaps.damage_groups
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Get the groupcaps for a tool. This function returns "groupcaps" table of
|
|
||||||
-- digging which should be put in the "tool_capabilities" of the tool definition
|
|
||||||
-- or in the metadata of an enchanted tool.
|
|
||||||
--
|
|
||||||
-- Parameters:
|
|
||||||
-- toolname - Name of the tool being enchanted (like "mcl_tools:diamond_pickaxe")
|
|
||||||
-- efficiency - The efficiency level the tool is enchanted with (default 0)
|
|
||||||
--
|
|
||||||
-- NOTE:
|
|
||||||
-- This function can only be called after mod initialization. Otherwise a mod
|
|
||||||
-- would have to add _mcl_autogroup as a dependency which would break the mod
|
|
||||||
-- loading order.
|
|
||||||
function mcl_autogroup.get_groupcaps(toolname, efficiency)
|
|
||||||
local tdef = minetest.registered_tools[toolname]
|
|
||||||
local groupcaps = table.copy(get_tool_capabilities(tdef).groupcaps or {})
|
|
||||||
add_groupcaps(toolname, groupcaps, tdef._mcl_diggroups, efficiency)
|
|
||||||
return groupcaps
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Get the wear from using a tool on a digging group.
|
|
||||||
--
|
|
||||||
-- Parameters
|
|
||||||
-- toolname - Name of the tool used
|
|
||||||
-- diggroup - The name of the diggroup the tool is used on
|
|
||||||
--
|
|
||||||
-- NOTE:
|
|
||||||
-- This function can only be called after mod initialization. Otherwise a mod
|
|
||||||
-- would have to add _mcl_autogroup as a dependency which would break the mod
|
|
||||||
-- loading order.
|
|
||||||
function mcl_autogroup.get_wear(toolname, diggroup)
|
|
||||||
local tdef = minetest.registered_tools[toolname]
|
|
||||||
local uses = tdef._mcl_diggroups[diggroup].uses
|
|
||||||
return math.ceil(65535 / uses)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function overwrite()
|
|
||||||
for nname, ndef in pairs(minetest.registered_nodes) do
|
|
||||||
local newgroups = table.copy(ndef.groups)
|
|
||||||
if (nname ~= "ignore" and ndef.diggable) then
|
|
||||||
-- Automatically assign the "solid" group for solid nodes
|
|
||||||
if (ndef.walkable == nil or ndef.walkable == true)
|
|
||||||
and (ndef.collision_box == nil or ndef.collision_box.type == "regular")
|
|
||||||
and (ndef.node_box == nil or ndef.node_box.type == "regular")
|
|
||||||
and (ndef.groups.not_solid == 0 or ndef.groups.not_solid == nil) then
|
|
||||||
newgroups.solid = 1
|
|
||||||
end
|
|
||||||
-- Automatically assign the "opaque" group for opaque nodes
|
|
||||||
if (not (ndef.paramtype == "light" or ndef.sunlight_propagates)) and
|
|
||||||
(ndef.groups.not_opaque == 0 or ndef.groups.not_opaque == nil) then
|
|
||||||
newgroups.opaque = 1
|
|
||||||
end
|
|
||||||
|
|
||||||
--local creative_breakable = false
|
|
||||||
|
|
||||||
-- Assign groups used for digging this node depending on
|
|
||||||
-- the registered digging groups
|
|
||||||
for g, gdef in pairs(mcl_autogroup.registered_diggroups) do
|
|
||||||
--creative_breakable = true
|
|
||||||
local index = hardness_lookup[g][ndef._mcl_hardness or 0]
|
|
||||||
if ndef.groups[g] then
|
|
||||||
if gdef.levels then
|
|
||||||
newgroups[g .. "_dig_default"] = index
|
|
||||||
|
|
||||||
for i = ndef.groups[g], #gdef.levels do
|
|
||||||
newgroups[g .. "_dig_" .. gdef.levels[i]] = index
|
|
||||||
end
|
|
||||||
else
|
|
||||||
newgroups[g .. "_dig"] = index
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Automatically assign the node to the
|
|
||||||
-- creative_breakable group if it belongs to any digging
|
|
||||||
-- group.
|
|
||||||
newgroups["creative_breakable"] = 1
|
|
||||||
|
|
||||||
minetest.override_item(nname, {
|
|
||||||
groups = newgroups
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for tname, tdef in pairs(minetest.registered_tools) do
|
|
||||||
-- Assign groupcaps for digging the registered digging groups
|
|
||||||
-- depending on the _mcl_diggroups in the tool definition
|
|
||||||
if tdef._mcl_diggroups then
|
|
||||||
local toolcaps = table.copy(get_tool_capabilities(tdef))
|
|
||||||
toolcaps.groupcaps = mcl_autogroup.get_groupcaps(tname)
|
|
||||||
|
|
||||||
minetest.override_item(tname, {
|
|
||||||
tool_capabilities = toolcaps
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
overwrite()
|
|
|
@ -1,3 +0,0 @@
|
||||||
name = _mcl_autogroup
|
|
||||||
author = ryvnf
|
|
||||||
description = MineClone 2 core mod which automatically adds groups to all items. Very important for digging times.
|
|
|
@ -1,42 +0,0 @@
|
||||||
# Biome Info API
|
|
||||||
This document explains the API of this mod.
|
|
||||||
|
|
||||||
## v6 mapgen functions
|
|
||||||
These are functions for the v6 mapgen only.
|
|
||||||
|
|
||||||
Use these functions only in worlds in which the v6 mapgen is used.
|
|
||||||
If you use these in any other mapgen, bad things might happen.
|
|
||||||
|
|
||||||
### `biomeinfo.get_v6_humidity(pos)`
|
|
||||||
Get the biome humidity at pos (for v6 mapgen).
|
|
||||||
|
|
||||||
### `biomeinfo.get_v6_heat(pos)`
|
|
||||||
Get the biome heat/temperature at pos (for v6 mapgen).
|
|
||||||
|
|
||||||
### `biomeinfo.get_v6_biome(pos)`
|
|
||||||
Get the v6 biome at pos.
|
|
||||||
Returns a string, which is the unique biome name.
|
|
||||||
|
|
||||||
Note: This function currently ignores the `biomeblend` v6 mapgen flag,
|
|
||||||
it just pretends this setting is disabled.
|
|
||||||
This is normally not a problem, but at areas where biomes blend,
|
|
||||||
the result is not perfectly accurate and just an estimate.
|
|
||||||
|
|
||||||
### `biomeinfo.get_active_v6_biomes()`
|
|
||||||
Returns a table containing the names of all v6 biomes that are actively
|
|
||||||
used in the current world, e.g. those that have been activated
|
|
||||||
by the use of the mapgen v6 flags (`mgv6_spflags`).
|
|
||||||
|
|
||||||
### `biomeinfo.all_v6_biomes`
|
|
||||||
This is a table containing all v6 biomes (as strings), even those that
|
|
||||||
might not be used in the current world.
|
|
||||||
|
|
||||||
### v6 biome names
|
|
||||||
|
|
||||||
These are the biome names used in this mod:
|
|
||||||
|
|
||||||
* Normal
|
|
||||||
* Desert
|
|
||||||
* Jungle
|
|
||||||
* Tundra
|
|
||||||
* Taiga
|
|
|
@ -1,11 +0,0 @@
|
||||||
# Biome Info API [`biomeinfo`]
|
|
||||||
This is an API mod for mod developers to add a couple of missing
|
|
||||||
biome-related functions.
|
|
||||||
Currently, this mod only adds v6-related functions.
|
|
||||||
Most importantly, you can get the heat, humidity and biome in the v6 mapgen.
|
|
||||||
|
|
||||||
See `API.md` for the API documentation.
|
|
||||||
|
|
||||||
Current version: 1.0.3 (this is a [SemVer](https://semver.org/))
|
|
||||||
|
|
||||||
License: MIT License
|
|
|
@ -1,211 +0,0 @@
|
||||||
biomeinfo = {}
|
|
||||||
|
|
||||||
-- Copied from mapgen_v6.h
|
|
||||||
local MGV6_FREQ_HOT = 0.4
|
|
||||||
local MGV6_FREQ_SNOW = -0.4
|
|
||||||
local MGV6_FREQ_TAIGA = 0.5
|
|
||||||
local MGV6_FREQ_JUNGLE = 0.5
|
|
||||||
|
|
||||||
-- Biome types
|
|
||||||
local BT_NORMAL = "Normal"
|
|
||||||
local BT_TUNDRA = "Tundra"
|
|
||||||
local BT_TAIGA = "Taiga"
|
|
||||||
local BT_DESERT = "Desert"
|
|
||||||
local BT_JUNGLE = "Jungle"
|
|
||||||
|
|
||||||
-- Get mapgen settings
|
|
||||||
|
|
||||||
local seed = tonumber(minetest.get_mapgen_setting("seed")) or 0
|
|
||||||
|
|
||||||
local mgv6_perlin_biome, mgv6_perlin_humidity, mgv6_np_biome
|
|
||||||
|
|
||||||
-- v6 default noiseparams are hardcoded here because Minetest doesn't give us those
|
|
||||||
local mgv6_np_biome_default = {
|
|
||||||
offset = 0,
|
|
||||||
scale = 1,
|
|
||||||
spread = { x = 500, y = 500, z = 500},
|
|
||||||
seed = 9130,
|
|
||||||
octaves = 3,
|
|
||||||
persistence = 0.50,
|
|
||||||
lacunarity = 2.0,
|
|
||||||
flags = "eased",
|
|
||||||
}
|
|
||||||
local mgv6_np_humidity_default = {
|
|
||||||
offset = 0.5,
|
|
||||||
scale = 0.5,
|
|
||||||
spread = { x = 500, y = 500, z = 500},
|
|
||||||
seed = 72384,
|
|
||||||
octaves = 3,
|
|
||||||
persistence = 0.50,
|
|
||||||
lacunarity = 2.0,
|
|
||||||
flags = "eased",
|
|
||||||
}
|
|
||||||
|
|
||||||
local v6_flags_str = minetest.get_mapgen_setting("mgv6_spflags")
|
|
||||||
if v6_flags_str == nil then
|
|
||||||
v6_flags_str = ""
|
|
||||||
end
|
|
||||||
local v6_flags = string.split(v6_flags_str)
|
|
||||||
local v6_use_snow_biomes = true
|
|
||||||
local v6_use_jungles = true
|
|
||||||
-- TODO: Implement biome blend.
|
|
||||||
-- Currently we pretend biome blend is disabled.
|
|
||||||
-- This just makes the calculations inaccurate near biome boundaries,
|
|
||||||
-- but should be fine otherwise.
|
|
||||||
local v6_use_biome_blend = false
|
|
||||||
for f=1, #v6_flags do
|
|
||||||
local flag = v6_flags[f]:trim()
|
|
||||||
if flag == "nosnowbiomes" then
|
|
||||||
v6_use_snow_biomes = false
|
|
||||||
end
|
|
||||||
if flag == "snowbiomes" then
|
|
||||||
v6_use_snow_biomes = true
|
|
||||||
end
|
|
||||||
if flag == "nojungles" then
|
|
||||||
v6_use_jungles = false
|
|
||||||
end
|
|
||||||
if flag == "jungles" then
|
|
||||||
v6_use_jungles = true
|
|
||||||
end
|
|
||||||
if flag == "nobiomeblend" then
|
|
||||||
v6_use_biome_blend = false
|
|
||||||
end
|
|
||||||
-- TODO
|
|
||||||
-- if flag == "biomeblend" then
|
|
||||||
-- v6_use_biome_blend = true
|
|
||||||
-- end
|
|
||||||
end
|
|
||||||
-- Force-enable jungles when snowbiomes flag is set
|
|
||||||
if v6_use_snow_biomes then
|
|
||||||
v6_use_jungles = true
|
|
||||||
end
|
|
||||||
local v6_freq_desert = tonumber(minetest.get_mapgen_setting("mgv6_freq_desert") or 0.45)
|
|
||||||
|
|
||||||
--local NOISE_MAGIC_X = 1619
|
|
||||||
--local NOISE_MAGIC_Y = 31337
|
|
||||||
--local NOISE_MAGIC_Z = 52591
|
|
||||||
--local NOISE_MAGIC_SEED = 1013
|
|
||||||
local function noise2d(x, y, seed)
|
|
||||||
-- TODO: implement noise2d function for biome blend
|
|
||||||
return 0
|
|
||||||
--[[
|
|
||||||
local n = (NOISE_MAGIC_X * x + NOISE_MAGIC_Y * y
|
|
||||||
+ NOISE_MAGIC_SEED * seed) & 0x7fffffff;
|
|
||||||
n = (n >> 13) ^ n;
|
|
||||||
n = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
|
|
||||||
return 1.0 - n / 0x40000000;
|
|
||||||
]]
|
|
||||||
end
|
|
||||||
|
|
||||||
biomeinfo.all_v6_biomes = {
|
|
||||||
BT_NORMAL,
|
|
||||||
BT_DESERT,
|
|
||||||
BT_JUNGLE,
|
|
||||||
BT_TUNDRA,
|
|
||||||
BT_TAIGA
|
|
||||||
}
|
|
||||||
|
|
||||||
local function init_perlins()
|
|
||||||
if not mgv6_perlin_biome then
|
|
||||||
mgv6_np_biome = minetest.get_mapgen_setting_noiseparams("mgv6_np_biome")
|
|
||||||
if not mgv6_np_biome then
|
|
||||||
mgv6_np_biome = mgv6_np_biome_default
|
|
||||||
minetest.log("action", "[biomeinfo] Using hardcoded mgv6_np_biome default")
|
|
||||||
end
|
|
||||||
mgv6_perlin_biome = minetest.get_perlin(mgv6_np_biome)
|
|
||||||
end
|
|
||||||
if not mgv6_perlin_humidity then
|
|
||||||
local np_humidity = minetest.get_mapgen_setting_noiseparams("mgv6_np_humidity")
|
|
||||||
if not np_humidity then
|
|
||||||
np_humidity = mgv6_np_humidity_default
|
|
||||||
minetest.log("action", "[biomeinfo] Using hardcoded mgv6_np_humidity default")
|
|
||||||
end
|
|
||||||
mgv6_perlin_humidity = minetest.get_perlin(np_humidity)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function biomeinfo.get_active_v6_biomes()
|
|
||||||
local biomes = { BT_NORMAL, BT_DESERT }
|
|
||||||
if v6_use_jungles then
|
|
||||||
table.insert(biomes, BT_JUNGLE)
|
|
||||||
end
|
|
||||||
if v6_use_snow_biomes then
|
|
||||||
table.insert(biomes, BT_TUNDRA)
|
|
||||||
table.insert(biomes, BT_TAIGA)
|
|
||||||
end
|
|
||||||
return biomes
|
|
||||||
end
|
|
||||||
|
|
||||||
function biomeinfo.get_v6_heat(pos)
|
|
||||||
init_perlins()
|
|
||||||
if not mgv6_perlin_biome then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
local bpos = vector.floor(pos)
|
|
||||||
-- The temperature noise needs a special offset (see calculateNoise in mapgen_v6.cpp)
|
|
||||||
return mgv6_perlin_biome:get_2d({x=bpos.x + mgv6_np_biome.spread.x*0.6, y=bpos.z + mgv6_np_biome.spread.z*0.2})
|
|
||||||
end
|
|
||||||
|
|
||||||
function biomeinfo.get_v6_humidity(pos)
|
|
||||||
init_perlins()
|
|
||||||
if not mgv6_perlin_humidity then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
local bpos = vector.floor(pos)
|
|
||||||
return mgv6_perlin_humidity:get_2d({x=bpos.x, y=bpos.z})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Returns the v6 biome at pos.
|
|
||||||
-- Returns a string representing the biome name.
|
|
||||||
function biomeinfo.get_v6_biome(pos)
|
|
||||||
init_perlins()
|
|
||||||
local bpos = vector.floor(pos)
|
|
||||||
-- Based on the algorithm MapgenV6::getBiome in mapgen_v6.cpp
|
|
||||||
|
|
||||||
local pos2d = {x=bpos.x, y=bpos.z}
|
|
||||||
if not mgv6_perlin_biome or not mgv6_perlin_humidity then
|
|
||||||
return "???"
|
|
||||||
end
|
|
||||||
local d = biomeinfo.get_v6_heat(bpos)
|
|
||||||
local h = biomeinfo.get_v6_humidity(bpos)
|
|
||||||
|
|
||||||
if (v6_use_snow_biomes) then
|
|
||||||
local blend
|
|
||||||
if v6_use_biome_blend then
|
|
||||||
blend = noise2d(pos2d.x, pos2d.y, seed) / 40
|
|
||||||
else
|
|
||||||
blend = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
if (d > MGV6_FREQ_HOT + blend) then
|
|
||||||
if (h > MGV6_FREQ_JUNGLE + blend) then
|
|
||||||
return BT_JUNGLE
|
|
||||||
end
|
|
||||||
return BT_DESERT
|
|
||||||
end
|
|
||||||
if (d < MGV6_FREQ_SNOW + blend) then
|
|
||||||
if (h > MGV6_FREQ_TAIGA + blend) then
|
|
||||||
return BT_TAIGA
|
|
||||||
end
|
|
||||||
return BT_TUNDRA
|
|
||||||
end
|
|
||||||
return BT_NORMAL
|
|
||||||
end
|
|
||||||
|
|
||||||
if (d > v6_freq_desert) then
|
|
||||||
return BT_DESERT
|
|
||||||
end
|
|
||||||
|
|
||||||
if ((v6_use_biome_blend) and (d > v6_freq_desert - 0.10) and
|
|
||||||
((noise2d(pos2d.x, pos2d.y, seed) + 1.0) > (v6_freq_desert - d) * 20.0)) then
|
|
||||||
return BT_DESERT
|
|
||||||
end
|
|
||||||
|
|
||||||
if ((v6_use_jungles) and (h > 0.75)) then
|
|
||||||
return BT_JUNGLE
|
|
||||||
end
|
|
||||||
|
|
||||||
return BT_NORMAL
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
name = biomeinfo
|
|
||||||
author = Wuzzy
|
|
||||||
description = Simple API to get data about biomes.
|
|
|
@ -1,23 +0,0 @@
|
||||||
# controls
|
|
||||||
|
|
||||||
## controls.players
|
|
||||||
Table containing player controls at runtime.
|
|
||||||
WARNING: Never use this table in writing
|
|
||||||
|
|
||||||
## controls.register_on_press(func)
|
|
||||||
Register a function that will be executed with (player, keyname) every time a player press a key.
|
|
||||||
|
|
||||||
## controls.registered_on_press
|
|
||||||
Table containing functions registered with controls.register_on_press().
|
|
||||||
|
|
||||||
## controls.register_on_release(func)
|
|
||||||
Register a function that will be executed with (player, keyname, clock_from_last_press) every time a player release a key.
|
|
||||||
|
|
||||||
## controls.registered_on_release
|
|
||||||
Table containing functions registered with controls.register_on_release().
|
|
||||||
|
|
||||||
## controls.register_on_hold(func)
|
|
||||||
Register a function that will be executed with (player, keyname, clock_from_start_hold) every time a player hold a key.
|
|
||||||
|
|
||||||
## controls.registered_on_hold
|
|
||||||
Table containing functions registered with controls.register_on_hold().
|
|
|
@ -1,504 +0,0 @@
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
|
||||||
Version 2.1, February 1999
|
|
||||||
|
|
||||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
[This is the first released version of the Lesser GPL. It also counts
|
|
||||||
as the successor of the GNU Library Public License, version 2, hence
|
|
||||||
the version number 2.1.]
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
|
||||||
Licenses are intended to guarantee your freedom to share and change
|
|
||||||
free software--to make sure the software is free for all its users.
|
|
||||||
|
|
||||||
This license, the Lesser General Public License, applies to some
|
|
||||||
specially designated software packages--typically libraries--of the
|
|
||||||
Free Software Foundation and other authors who decide to use it. You
|
|
||||||
can use it too, but we suggest you first think carefully about whether
|
|
||||||
this license or the ordinary General Public License is the better
|
|
||||||
strategy to use in any particular case, based on the explanations below.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom of use,
|
|
||||||
not price. Our General Public Licenses are designed to make sure that
|
|
||||||
you have the freedom to distribute copies of free software (and charge
|
|
||||||
for this service if you wish); that you receive source code or can get
|
|
||||||
it if you want it; that you can change the software and use pieces of
|
|
||||||
it in new free programs; and that you are informed that you can do
|
|
||||||
these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to make restrictions that forbid
|
|
||||||
distributors to deny you these rights or to ask you to surrender these
|
|
||||||
rights. These restrictions translate to certain responsibilities for
|
|
||||||
you if you distribute copies of the library or if you modify it.
|
|
||||||
|
|
||||||
For example, if you distribute copies of the library, whether gratis
|
|
||||||
or for a fee, you must give the recipients all the rights that we gave
|
|
||||||
you. You must make sure that they, too, receive or can get the source
|
|
||||||
code. If you link other code with the library, you must provide
|
|
||||||
complete object files to the recipients, so that they can relink them
|
|
||||||
with the library after making changes to the library and recompiling
|
|
||||||
it. And you must show them these terms so they know their rights.
|
|
||||||
|
|
||||||
We protect your rights with a two-step method: (1) we copyright the
|
|
||||||
library, and (2) we offer you this license, which gives you legal
|
|
||||||
permission to copy, distribute and/or modify the library.
|
|
||||||
|
|
||||||
To protect each distributor, we want to make it very clear that
|
|
||||||
there is no warranty for the free library. Also, if the library is
|
|
||||||
modified by someone else and passed on, the recipients should know
|
|
||||||
that what they have is not the original version, so that the original
|
|
||||||
author's reputation will not be affected by problems that might be
|
|
||||||
introduced by others.
|
|
||||||
|
|
||||||
Finally, software patents pose a constant threat to the existence of
|
|
||||||
any free program. We wish to make sure that a company cannot
|
|
||||||
effectively restrict the users of a free program by obtaining a
|
|
||||||
restrictive license from a patent holder. Therefore, we insist that
|
|
||||||
any patent license obtained for a version of the library must be
|
|
||||||
consistent with the full freedom of use specified in this license.
|
|
||||||
|
|
||||||
Most GNU software, including some libraries, is covered by the
|
|
||||||
ordinary GNU General Public License. This license, the GNU Lesser
|
|
||||||
General Public License, applies to certain designated libraries, and
|
|
||||||
is quite different from the ordinary General Public License. We use
|
|
||||||
this license for certain libraries in order to permit linking those
|
|
||||||
libraries into non-free programs.
|
|
||||||
|
|
||||||
When a program is linked with a library, whether statically or using
|
|
||||||
a shared library, the combination of the two is legally speaking a
|
|
||||||
combined work, a derivative of the original library. The ordinary
|
|
||||||
General Public License therefore permits such linking only if the
|
|
||||||
entire combination fits its criteria of freedom. The Lesser General
|
|
||||||
Public License permits more lax criteria for linking other code with
|
|
||||||
the library.
|
|
||||||
|
|
||||||
We call this license the "Lesser" General Public License because it
|
|
||||||
does Less to protect the user's freedom than the ordinary General
|
|
||||||
Public License. It also provides other free software developers Less
|
|
||||||
of an advantage over competing non-free programs. These disadvantages
|
|
||||||
are the reason we use the ordinary General Public License for many
|
|
||||||
libraries. However, the Lesser license provides advantages in certain
|
|
||||||
special circumstances.
|
|
||||||
|
|
||||||
For example, on rare occasions, there may be a special need to
|
|
||||||
encourage the widest possible use of a certain library, so that it becomes
|
|
||||||
a de-facto standard. To achieve this, non-free programs must be
|
|
||||||
allowed to use the library. A more frequent case is that a free
|
|
||||||
library does the same job as widely used non-free libraries. In this
|
|
||||||
case, there is little to gain by limiting the free library to free
|
|
||||||
software only, so we use the Lesser General Public License.
|
|
||||||
|
|
||||||
In other cases, permission to use a particular library in non-free
|
|
||||||
programs enables a greater number of people to use a large body of
|
|
||||||
free software. For example, permission to use the GNU C Library in
|
|
||||||
non-free programs enables many more people to use the whole GNU
|
|
||||||
operating system, as well as its variant, the GNU/Linux operating
|
|
||||||
system.
|
|
||||||
|
|
||||||
Although the Lesser General Public License is Less protective of the
|
|
||||||
users' freedom, it does ensure that the user of a program that is
|
|
||||||
linked with the Library has the freedom and the wherewithal to run
|
|
||||||
that program using a modified version of the Library.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow. Pay close attention to the difference between a
|
|
||||||
"work based on the library" and a "work that uses the library". The
|
|
||||||
former contains code derived from the library, whereas the latter must
|
|
||||||
be combined with the library in order to run.
|
|
||||||
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
||||||
|
|
||||||
0. This License Agreement applies to any software library or other
|
|
||||||
program which contains a notice placed by the copyright holder or
|
|
||||||
other authorized party saying it may be distributed under the terms of
|
|
||||||
this Lesser General Public License (also called "this License").
|
|
||||||
Each licensee is addressed as "you".
|
|
||||||
|
|
||||||
A "library" means a collection of software functions and/or data
|
|
||||||
prepared so as to be conveniently linked with application programs
|
|
||||||
(which use some of those functions and data) to form executables.
|
|
||||||
|
|
||||||
The "Library", below, refers to any such software library or work
|
|
||||||
which has been distributed under these terms. A "work based on the
|
|
||||||
Library" means either the Library or any derivative work under
|
|
||||||
copyright law: that is to say, a work containing the Library or a
|
|
||||||
portion of it, either verbatim or with modifications and/or translated
|
|
||||||
straightforwardly into another language. (Hereinafter, translation is
|
|
||||||
included without limitation in the term "modification".)
|
|
||||||
|
|
||||||
"Source code" for a work means the preferred form of the work for
|
|
||||||
making modifications to it. For a library, complete source code means
|
|
||||||
all the source code for all modules it contains, plus any associated
|
|
||||||
interface definition files, plus the scripts used to control compilation
|
|
||||||
and installation of the library.
|
|
||||||
|
|
||||||
Activities other than copying, distribution and modification are not
|
|
||||||
covered by this License; they are outside its scope. The act of
|
|
||||||
running a program using the Library is not restricted, and output from
|
|
||||||
such a program is covered only if its contents constitute a work based
|
|
||||||
on the Library (independent of the use of the Library in a tool for
|
|
||||||
writing it). Whether that is true depends on what the Library does
|
|
||||||
and what the program that uses the Library does.
|
|
||||||
|
|
||||||
1. You may copy and distribute verbatim copies of the Library's
|
|
||||||
complete source code as you receive it, in any medium, provided that
|
|
||||||
you conspicuously and appropriately publish on each copy an
|
|
||||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
|
||||||
all the notices that refer to this License and to the absence of any
|
|
||||||
warranty; and distribute a copy of this License along with the
|
|
||||||
Library.
|
|
||||||
|
|
||||||
You may charge a fee for the physical act of transferring a copy,
|
|
||||||
and you may at your option offer warranty protection in exchange for a
|
|
||||||
fee.
|
|
||||||
|
|
||||||
2. You may modify your copy or copies of the Library or any portion
|
|
||||||
of it, thus forming a work based on the Library, and copy and
|
|
||||||
distribute such modifications or work under the terms of Section 1
|
|
||||||
above, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The modified work must itself be a software library.
|
|
||||||
|
|
||||||
b) You must cause the files modified to carry prominent notices
|
|
||||||
stating that you changed the files and the date of any change.
|
|
||||||
|
|
||||||
c) You must cause the whole of the work to be licensed at no
|
|
||||||
charge to all third parties under the terms of this License.
|
|
||||||
|
|
||||||
d) If a facility in the modified Library refers to a function or a
|
|
||||||
table of data to be supplied by an application program that uses
|
|
||||||
the facility, other than as an argument passed when the facility
|
|
||||||
is invoked, then you must make a good faith effort to ensure that,
|
|
||||||
in the event an application does not supply such function or
|
|
||||||
table, the facility still operates, and performs whatever part of
|
|
||||||
its purpose remains meaningful.
|
|
||||||
|
|
||||||
(For example, a function in a library to compute square roots has
|
|
||||||
a purpose that is entirely well-defined independent of the
|
|
||||||
application. Therefore, Subsection 2d requires that any
|
|
||||||
application-supplied function or table used by this function must
|
|
||||||
be optional: if the application does not supply it, the square
|
|
||||||
root function must still compute square roots.)
|
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If
|
|
||||||
identifiable sections of that work are not derived from the Library,
|
|
||||||
and can be reasonably considered independent and separate works in
|
|
||||||
themselves, then this License, and its terms, do not apply to those
|
|
||||||
sections when you distribute them as separate works. But when you
|
|
||||||
distribute the same sections as part of a whole which is a work based
|
|
||||||
on the Library, the distribution of the whole must be on the terms of
|
|
||||||
this License, whose permissions for other licensees extend to the
|
|
||||||
entire whole, and thus to each and every part regardless of who wrote
|
|
||||||
it.
|
|
||||||
|
|
||||||
Thus, it is not the intent of this section to claim rights or contest
|
|
||||||
your rights to work written entirely by you; rather, the intent is to
|
|
||||||
exercise the right to control the distribution of derivative or
|
|
||||||
collective works based on the Library.
|
|
||||||
|
|
||||||
In addition, mere aggregation of another work not based on the Library
|
|
||||||
with the Library (or with a work based on the Library) on a volume of
|
|
||||||
a storage or distribution medium does not bring the other work under
|
|
||||||
the scope of this License.
|
|
||||||
|
|
||||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
|
||||||
License instead of this License to a given copy of the Library. To do
|
|
||||||
this, you must alter all the notices that refer to this License, so
|
|
||||||
that they refer to the ordinary GNU General Public License, version 2,
|
|
||||||
instead of to this License. (If a newer version than version 2 of the
|
|
||||||
ordinary GNU General Public License has appeared, then you can specify
|
|
||||||
that version instead if you wish.) Do not make any other change in
|
|
||||||
these notices.
|
|
||||||
|
|
||||||
Once this change is made in a given copy, it is irreversible for
|
|
||||||
that copy, so the ordinary GNU General Public License applies to all
|
|
||||||
subsequent copies and derivative works made from that copy.
|
|
||||||
|
|
||||||
This option is useful when you wish to copy part of the code of
|
|
||||||
the Library into a program that is not a library.
|
|
||||||
|
|
||||||
4. You may copy and distribute the Library (or a portion or
|
|
||||||
derivative of it, under Section 2) in object code or executable form
|
|
||||||
under the terms of Sections 1 and 2 above provided that you accompany
|
|
||||||
it with the complete corresponding machine-readable source code, which
|
|
||||||
must be distributed under the terms of Sections 1 and 2 above on a
|
|
||||||
medium customarily used for software interchange.
|
|
||||||
|
|
||||||
If distribution of object code is made by offering access to copy
|
|
||||||
from a designated place, then offering equivalent access to copy the
|
|
||||||
source code from the same place satisfies the requirement to
|
|
||||||
distribute the source code, even though third parties are not
|
|
||||||
compelled to copy the source along with the object code.
|
|
||||||
|
|
||||||
5. A program that contains no derivative of any portion of the
|
|
||||||
Library, but is designed to work with the Library by being compiled or
|
|
||||||
linked with it, is called a "work that uses the Library". Such a
|
|
||||||
work, in isolation, is not a derivative work of the Library, and
|
|
||||||
therefore falls outside the scope of this License.
|
|
||||||
|
|
||||||
However, linking a "work that uses the Library" with the Library
|
|
||||||
creates an executable that is a derivative of the Library (because it
|
|
||||||
contains portions of the Library), rather than a "work that uses the
|
|
||||||
library". The executable is therefore covered by this License.
|
|
||||||
Section 6 states terms for distribution of such executables.
|
|
||||||
|
|
||||||
When a "work that uses the Library" uses material from a header file
|
|
||||||
that is part of the Library, the object code for the work may be a
|
|
||||||
derivative work of the Library even though the source code is not.
|
|
||||||
Whether this is true is especially significant if the work can be
|
|
||||||
linked without the Library, or if the work is itself a library. The
|
|
||||||
threshold for this to be true is not precisely defined by law.
|
|
||||||
|
|
||||||
If such an object file uses only numerical parameters, data
|
|
||||||
structure layouts and accessors, and small macros and small inline
|
|
||||||
functions (ten lines or less in length), then the use of the object
|
|
||||||
file is unrestricted, regardless of whether it is legally a derivative
|
|
||||||
work. (Executables containing this object code plus portions of the
|
|
||||||
Library will still fall under Section 6.)
|
|
||||||
|
|
||||||
Otherwise, if the work is a derivative of the Library, you may
|
|
||||||
distribute the object code for the work under the terms of Section 6.
|
|
||||||
Any executables containing that work also fall under Section 6,
|
|
||||||
whether or not they are linked directly with the Library itself.
|
|
||||||
|
|
||||||
6. As an exception to the Sections above, you may also combine or
|
|
||||||
link a "work that uses the Library" with the Library to produce a
|
|
||||||
work containing portions of the Library, and distribute that work
|
|
||||||
under terms of your choice, provided that the terms permit
|
|
||||||
modification of the work for the customer's own use and reverse
|
|
||||||
engineering for debugging such modifications.
|
|
||||||
|
|
||||||
You must give prominent notice with each copy of the work that the
|
|
||||||
Library is used in it and that the Library and its use are covered by
|
|
||||||
this License. You must supply a copy of this License. If the work
|
|
||||||
during execution displays copyright notices, you must include the
|
|
||||||
copyright notice for the Library among them, as well as a reference
|
|
||||||
directing the user to the copy of this License. Also, you must do one
|
|
||||||
of these things:
|
|
||||||
|
|
||||||
a) Accompany the work with the complete corresponding
|
|
||||||
machine-readable source code for the Library including whatever
|
|
||||||
changes were used in the work (which must be distributed under
|
|
||||||
Sections 1 and 2 above); and, if the work is an executable linked
|
|
||||||
with the Library, with the complete machine-readable "work that
|
|
||||||
uses the Library", as object code and/or source code, so that the
|
|
||||||
user can modify the Library and then relink to produce a modified
|
|
||||||
executable containing the modified Library. (It is understood
|
|
||||||
that the user who changes the contents of definitions files in the
|
|
||||||
Library will not necessarily be able to recompile the application
|
|
||||||
to use the modified definitions.)
|
|
||||||
|
|
||||||
b) Use a suitable shared library mechanism for linking with the
|
|
||||||
Library. A suitable mechanism is one that (1) uses at run time a
|
|
||||||
copy of the library already present on the user's computer system,
|
|
||||||
rather than copying library functions into the executable, and (2)
|
|
||||||
will operate properly with a modified version of the library, if
|
|
||||||
the user installs one, as long as the modified version is
|
|
||||||
interface-compatible with the version that the work was made with.
|
|
||||||
|
|
||||||
c) Accompany the work with a written offer, valid for at
|
|
||||||
least three years, to give the same user the materials
|
|
||||||
specified in Subsection 6a, above, for a charge no more
|
|
||||||
than the cost of performing this distribution.
|
|
||||||
|
|
||||||
d) If distribution of the work is made by offering access to copy
|
|
||||||
from a designated place, offer equivalent access to copy the above
|
|
||||||
specified materials from the same place.
|
|
||||||
|
|
||||||
e) Verify that the user has already received a copy of these
|
|
||||||
materials or that you have already sent this user a copy.
|
|
||||||
|
|
||||||
For an executable, the required form of the "work that uses the
|
|
||||||
Library" must include any data and utility programs needed for
|
|
||||||
reproducing the executable from it. However, as a special exception,
|
|
||||||
the materials to be distributed need not include anything that is
|
|
||||||
normally distributed (in either source or binary form) with the major
|
|
||||||
components (compiler, kernel, and so on) of the operating system on
|
|
||||||
which the executable runs, unless that component itself accompanies
|
|
||||||
the executable.
|
|
||||||
|
|
||||||
It may happen that this requirement contradicts the license
|
|
||||||
restrictions of other proprietary libraries that do not normally
|
|
||||||
accompany the operating system. Such a contradiction means you cannot
|
|
||||||
use both them and the Library together in an executable that you
|
|
||||||
distribute.
|
|
||||||
|
|
||||||
7. You may place library facilities that are a work based on the
|
|
||||||
Library side-by-side in a single library together with other library
|
|
||||||
facilities not covered by this License, and distribute such a combined
|
|
||||||
library, provided that the separate distribution of the work based on
|
|
||||||
the Library and of the other library facilities is otherwise
|
|
||||||
permitted, and provided that you do these two things:
|
|
||||||
|
|
||||||
a) Accompany the combined library with a copy of the same work
|
|
||||||
based on the Library, uncombined with any other library
|
|
||||||
facilities. This must be distributed under the terms of the
|
|
||||||
Sections above.
|
|
||||||
|
|
||||||
b) Give prominent notice with the combined library of the fact
|
|
||||||
that part of it is a work based on the Library, and explaining
|
|
||||||
where to find the accompanying uncombined form of the same work.
|
|
||||||
|
|
||||||
8. You may not copy, modify, sublicense, link with, or distribute
|
|
||||||
the Library except as expressly provided under this License. Any
|
|
||||||
attempt otherwise to copy, modify, sublicense, link with, or
|
|
||||||
distribute the Library is void, and will automatically terminate your
|
|
||||||
rights under this License. However, parties who have received copies,
|
|
||||||
or rights, from you under this License will not have their licenses
|
|
||||||
terminated so long as such parties remain in full compliance.
|
|
||||||
|
|
||||||
9. You are not required to accept this License, since you have not
|
|
||||||
signed it. However, nothing else grants you permission to modify or
|
|
||||||
distribute the Library or its derivative works. These actions are
|
|
||||||
prohibited by law if you do not accept this License. Therefore, by
|
|
||||||
modifying or distributing the Library (or any work based on the
|
|
||||||
Library), you indicate your acceptance of this License to do so, and
|
|
||||||
all its terms and conditions for copying, distributing or modifying
|
|
||||||
the Library or works based on it.
|
|
||||||
|
|
||||||
10. Each time you redistribute the Library (or any work based on the
|
|
||||||
Library), the recipient automatically receives a license from the
|
|
||||||
original licensor to copy, distribute, link with or modify the Library
|
|
||||||
subject to these terms and conditions. You may not impose any further
|
|
||||||
restrictions on the recipients' exercise of the rights granted herein.
|
|
||||||
You are not responsible for enforcing compliance by third parties with
|
|
||||||
this License.
|
|
||||||
|
|
||||||
11. If, as a consequence of a court judgment or allegation of patent
|
|
||||||
infringement or for any other reason (not limited to patent issues),
|
|
||||||
conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot
|
|
||||||
distribute so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you
|
|
||||||
may not distribute the Library at all. For example, if a patent
|
|
||||||
license would not permit royalty-free redistribution of the Library by
|
|
||||||
all those who receive copies directly or indirectly through you, then
|
|
||||||
the only way you could satisfy both it and this License would be to
|
|
||||||
refrain entirely from distribution of the Library.
|
|
||||||
|
|
||||||
If any portion of this section is held invalid or unenforceable under any
|
|
||||||
particular circumstance, the balance of the section is intended to apply,
|
|
||||||
and the section as a whole is intended to apply in other circumstances.
|
|
||||||
|
|
||||||
It is not the purpose of this section to induce you to infringe any
|
|
||||||
patents or other property right claims or to contest validity of any
|
|
||||||
such claims; this section has the sole purpose of protecting the
|
|
||||||
integrity of the free software distribution system which is
|
|
||||||
implemented by public license practices. Many people have made
|
|
||||||
generous contributions to the wide range of software distributed
|
|
||||||
through that system in reliance on consistent application of that
|
|
||||||
system; it is up to the author/donor to decide if he or she is willing
|
|
||||||
to distribute software through any other system and a licensee cannot
|
|
||||||
impose that choice.
|
|
||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to
|
|
||||||
be a consequence of the rest of this License.
|
|
||||||
|
|
||||||
12. If the distribution and/or use of the Library is restricted in
|
|
||||||
certain countries either by patents or by copyrighted interfaces, the
|
|
||||||
original copyright holder who places the Library under this License may add
|
|
||||||
an explicit geographical distribution limitation excluding those countries,
|
|
||||||
so that distribution is permitted only in or among countries not thus
|
|
||||||
excluded. In such case, this License incorporates the limitation as if
|
|
||||||
written in the body of this License.
|
|
||||||
|
|
||||||
13. The Free Software Foundation may publish revised and/or new
|
|
||||||
versions of the Lesser General Public License from time to time.
|
|
||||||
Such new versions will be similar in spirit to the present version,
|
|
||||||
but may differ in detail to address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Library
|
|
||||||
specifies a version number of this License which applies to it and
|
|
||||||
"any later version", you have the option of following the terms and
|
|
||||||
conditions either of that version or of any later version published by
|
|
||||||
the Free Software Foundation. If the Library does not specify a
|
|
||||||
license version number, you may choose any version ever published by
|
|
||||||
the Free Software Foundation.
|
|
||||||
|
|
||||||
14. If you wish to incorporate parts of the Library into other free
|
|
||||||
programs whose distribution conditions are incompatible with these,
|
|
||||||
write to the author to ask for permission. For software which is
|
|
||||||
copyrighted by the Free Software Foundation, write to the Free
|
|
||||||
Software Foundation; we sometimes make exceptions for this. Our
|
|
||||||
decision will be guided by the two goals of preserving the free status
|
|
||||||
of all derivatives of our free software and of promoting the sharing
|
|
||||||
and reuse of software generally.
|
|
||||||
|
|
||||||
NO WARRANTY
|
|
||||||
|
|
||||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
|
||||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
|
||||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
|
||||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
|
||||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
|
||||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
|
||||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
|
||||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
|
||||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
|
||||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
|
||||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
|
||||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
|
||||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
|
||||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
|
||||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
||||||
DAMAGES.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Libraries
|
|
||||||
|
|
||||||
If you develop a new library, and you want it to be of the greatest
|
|
||||||
possible use to the public, we recommend making it free software that
|
|
||||||
everyone can redistribute and change. You can do so by permitting
|
|
||||||
redistribution under these terms (or, alternatively, under the terms of the
|
|
||||||
ordinary General Public License).
|
|
||||||
|
|
||||||
To apply these terms, attach the following notices to the library. It is
|
|
||||||
safest to attach them to the start of each source file to most effectively
|
|
||||||
convey the exclusion of warranty; and each file should have at least the
|
|
||||||
"copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the library's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
|
||||||
USA
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or your
|
|
||||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
|
||||||
necessary. Here is a sample; alter the names:
|
|
||||||
|
|
||||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
|
||||||
library `Frob' (a library for tweaking knobs) written by James Random
|
|
||||||
Hacker.
|
|
||||||
|
|
||||||
<signature of Ty Coon>, 1 April 1990
|
|
||||||
Ty Coon, President of Vice
|
|
||||||
|
|
||||||
That's all there is to it!
|
|
|
@ -1,2 +0,0 @@
|
||||||
Controls framework by Arcelmi.
|
|
||||||
https://github.com/Arcelmi/minetest-controls
|
|
|
@ -1,77 +0,0 @@
|
||||||
local get_connected_players = minetest.get_connected_players
|
|
||||||
local clock = os.clock
|
|
||||||
|
|
||||||
local pairs = pairs
|
|
||||||
|
|
||||||
controls = {}
|
|
||||||
controls.players = {}
|
|
||||||
|
|
||||||
controls.registered_on_press = {}
|
|
||||||
function controls.register_on_press(func)
|
|
||||||
controls.registered_on_press[#controls.registered_on_press+1] = func
|
|
||||||
end
|
|
||||||
|
|
||||||
controls.registered_on_release = {}
|
|
||||||
function controls.register_on_release(func)
|
|
||||||
controls.registered_on_release[#controls.registered_on_release+1] = func
|
|
||||||
end
|
|
||||||
|
|
||||||
controls.registered_on_hold = {}
|
|
||||||
function controls.register_on_hold(func)
|
|
||||||
controls.registered_on_hold[#controls.registered_on_hold+1]=func
|
|
||||||
end
|
|
||||||
|
|
||||||
local known_controls = {
|
|
||||||
jump = true,
|
|
||||||
right = true,
|
|
||||||
left = true,
|
|
||||||
LMB = true,
|
|
||||||
RMB = true,
|
|
||||||
sneak = true,
|
|
||||||
aux1 = true,
|
|
||||||
down = true,
|
|
||||||
up = true,
|
|
||||||
}
|
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
|
||||||
local name = player:get_player_name()
|
|
||||||
controls.players[name] = {}
|
|
||||||
for cname,_ in pairs(known_controls) do
|
|
||||||
controls.players[name][cname] = { false }
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
minetest.register_on_leaveplayer(function(player)
|
|
||||||
local name = player:get_player_name()
|
|
||||||
controls.players[name] = nil
|
|
||||||
end)
|
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
|
||||||
for _, player in pairs(get_connected_players()) do
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
local player_controls = player:get_player_control()
|
|
||||||
if controls.players[player_name] then
|
|
||||||
for cname, cbool in pairs(player_controls) do
|
|
||||||
if known_controls[cname] == true then
|
|
||||||
--Press a key
|
|
||||||
if cbool == true and controls.players[player_name][cname][1] == false then
|
|
||||||
for _, func in pairs(controls.registered_on_press) do
|
|
||||||
func(player, cname)
|
|
||||||
end
|
|
||||||
controls.players[player_name][cname] = {true, clock()}
|
|
||||||
elseif cbool == true and controls.players[player_name][cname][1] == true then
|
|
||||||
for _, func in pairs(controls.registered_on_hold) do
|
|
||||||
func(player, cname, clock()-controls.players[player_name][cname][2])
|
|
||||||
end
|
|
||||||
--Release a key
|
|
||||||
elseif cbool == false and controls.players[player_name][cname][1] == true then
|
|
||||||
for _, func in pairs(controls.registered_on_release) do
|
|
||||||
func(player, cname, clock()-controls.players[player_name][cname][2])
|
|
||||||
end
|
|
||||||
controls.players[player_name][cname] = {false}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
|
@ -1,4 +0,0 @@
|
||||||
name = controls
|
|
||||||
author = Arcelmi
|
|
||||||
description = Controls framework by Arcelmi
|
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
# flowlib
|
|
||||||
Simple flow functions.
|
|
||||||
|
|
||||||
## flowlib.is_touching(realpos, nodepos, radius)
|
|
||||||
Return true if a sphere of <radius> at <realpos> collide with node at <nodepos>.
|
|
||||||
* realpos: position
|
|
||||||
* nodepos: position
|
|
||||||
* radius: number
|
|
||||||
|
|
||||||
## flowlib.is_water(pos)
|
|
||||||
Return true if node at <pos> is water, false overwise.
|
|
||||||
* pos: position
|
|
||||||
|
|
||||||
## flowlib.node_is_water(node)
|
|
||||||
Return true if <node> is water, false overwise.
|
|
||||||
* node: node
|
|
||||||
|
|
||||||
## flowlib.is_lava(pos)
|
|
||||||
Return true if node at <pos> is lava, false overwise.
|
|
||||||
* pos: position
|
|
||||||
|
|
||||||
## flowlib.node_is_lava(node)
|
|
||||||
Return true if <node> is lava, false overwise.
|
|
||||||
* node: node
|
|
||||||
|
|
||||||
## flowlib.is_liquid(pos)
|
|
||||||
Return true if node at <pos> is liquid, false overwise.
|
|
||||||
* pos: position
|
|
||||||
|
|
||||||
## flowlib.node_is_liquid(node)
|
|
||||||
Return true if <node> is liquid, false overwise.
|
|
||||||
* node: node
|
|
||||||
|
|
||||||
## flowlib.quick_flow(pos, node)
|
|
||||||
Return direction where the water is flowing (to be use to push mobs, items...).
|
|
||||||
* pos: position
|
|
||||||
* node: node
|
|
||||||
|
|
||||||
## flowlib.move_centre(pos, realpos, node, radius)
|
|
||||||
Return the pos of the nearest not water block near from <pos> in a sphere of <radius> at <realpos>.
|
|
||||||
WARNING: This function is never used in mcl2, use at your own risk. The informations described here may be wrong.
|
|
||||||
* pos: position
|
|
||||||
* realpos: position, position of the entity
|
|
||||||
* node: node
|
|
||||||
* radius: number
|
|
|
@ -1,7 +0,0 @@
|
||||||
Flowlib
|
|
||||||
================
|
|
||||||
Simple flow functions for use in Minetest mods by Qwertymine3
|
|
||||||
|
|
||||||
License of source code:
|
|
||||||
-----------------------
|
|
||||||
WTFPL
|
|
|
@ -1,153 +0,0 @@
|
||||||
local math = math
|
|
||||||
|
|
||||||
local get_node = minetest.get_node
|
|
||||||
local get_item_group = minetest.get_item_group
|
|
||||||
|
|
||||||
local registered_nodes = minetest.registered_nodes
|
|
||||||
|
|
||||||
flowlib = {}
|
|
||||||
|
|
||||||
--sum of direction vectors must match an array index
|
|
||||||
|
|
||||||
--(sum,root)
|
|
||||||
--(0,1), (1,1+0=1), (2,1+1=2), (3,1+2^2=5), (4,2^2+2^2=8)
|
|
||||||
|
|
||||||
local inv_roots = {
|
|
||||||
[0] = 1,
|
|
||||||
[1] = 1,
|
|
||||||
[2] = 0.70710678118655,
|
|
||||||
[4] = 0.5,
|
|
||||||
[5] = 0.44721359549996,
|
|
||||||
[8] = 0.35355339059327,
|
|
||||||
}
|
|
||||||
|
|
||||||
local function to_unit_vector(dir_vector)
|
|
||||||
local sum = dir_vector.x * dir_vector.x + dir_vector.z * dir_vector.z
|
|
||||||
return {x = dir_vector.x * inv_roots[sum], y = dir_vector.y, z = dir_vector.z * inv_roots[sum]}
|
|
||||||
end
|
|
||||||
|
|
||||||
local function is_touching(realpos,nodepos,radius)
|
|
||||||
local boarder = 0.5 - radius
|
|
||||||
return math.abs(realpos - nodepos) > (boarder)
|
|
||||||
end
|
|
||||||
|
|
||||||
flowlib.is_touching = is_touching
|
|
||||||
|
|
||||||
local function is_water(pos)
|
|
||||||
return get_item_group(get_node(pos).name, "water") ~= 0
|
|
||||||
end
|
|
||||||
|
|
||||||
flowlib.is_water = is_water
|
|
||||||
|
|
||||||
local function node_is_water(node)
|
|
||||||
return get_item_group(node.name, "water") ~= 0
|
|
||||||
end
|
|
||||||
|
|
||||||
flowlib.node_is_water = node_is_water
|
|
||||||
|
|
||||||
local function is_lava(pos)
|
|
||||||
return get_item_group(get_node(pos).name, "lava") ~= 0
|
|
||||||
end
|
|
||||||
|
|
||||||
flowlib.is_lava = is_lava
|
|
||||||
|
|
||||||
local function node_is_lava(node)
|
|
||||||
return get_item_group(node.name, "lava") ~= 0
|
|
||||||
end
|
|
||||||
|
|
||||||
flowlib.node_is_lava = node_is_lava
|
|
||||||
|
|
||||||
|
|
||||||
local function is_liquid(pos)
|
|
||||||
return get_item_group(get_node(pos).name, "liquid") ~= 0
|
|
||||||
end
|
|
||||||
|
|
||||||
flowlib.is_liquid = is_liquid
|
|
||||||
|
|
||||||
local function node_is_liquid(node)
|
|
||||||
return minetest.get_item_group(node.name, "liquid") ~= 0
|
|
||||||
end
|
|
||||||
|
|
||||||
flowlib.node_is_liquid = node_is_liquid
|
|
||||||
|
|
||||||
--This code is more efficient
|
|
||||||
local function quick_flow_logic(node, pos_testing, direction)
|
|
||||||
local name = node.name
|
|
||||||
if not registered_nodes[name] then
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
if registered_nodes[name].liquidtype == "source" then
|
|
||||||
local node_testing = get_node(pos_testing)
|
|
||||||
if not registered_nodes[node_testing.name] then
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
if registered_nodes[node_testing.name].liquidtype ~= "flowing" then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return direction
|
|
||||||
end
|
|
||||||
elseif registered_nodes[name].liquidtype == "flowing" then
|
|
||||||
local node_testing = get_node(pos_testing)
|
|
||||||
local param2_testing = node_testing.param2
|
|
||||||
if not registered_nodes[node_testing.name] then
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
if registered_nodes[node_testing.name].liquidtype == "source" then
|
|
||||||
return -direction
|
|
||||||
elseif registered_nodes[node_testing.name].liquidtype == "flowing" then
|
|
||||||
if param2_testing < node.param2 then
|
|
||||||
if (node.param2 - param2_testing) > 6 then
|
|
||||||
return -direction
|
|
||||||
else
|
|
||||||
return direction
|
|
||||||
end
|
|
||||||
elseif param2_testing > node.param2 then
|
|
||||||
if (param2_testing - node.param2) > 6 then
|
|
||||||
return direction
|
|
||||||
else
|
|
||||||
return -direction
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
local function quick_flow(pos, node)
|
|
||||||
if not node_is_liquid(node) then
|
|
||||||
return {x = 0, y = 0, z = 0}
|
|
||||||
end
|
|
||||||
local x = quick_flow_logic(node,{x = pos.x-1, y = pos.y, z = pos.z},-1) + quick_flow_logic(node,{x = pos.x+1, y = pos.y, z = pos.z}, 1)
|
|
||||||
local z = quick_flow_logic(node,{x = pos.x, y = pos.y, z = pos.z-1},-1) + quick_flow_logic(node,{x = pos.x, y = pos.y, z = pos.z+1}, 1)
|
|
||||||
return to_unit_vector({x = x, y = 0, z = z})
|
|
||||||
end
|
|
||||||
|
|
||||||
flowlib.quick_flow = quick_flow
|
|
||||||
|
|
||||||
--if not in water but touching, move centre to touching block
|
|
||||||
--x has higher precedence than z
|
|
||||||
--if pos changes with x, it affects z
|
|
||||||
|
|
||||||
local function move_centre(pos, realpos, node, radius)
|
|
||||||
if is_touching(realpos.x, pos.x, radius) then
|
|
||||||
if is_liquid({x = pos.x-1, y = pos.y, z = pos.z}) then
|
|
||||||
node = get_node({x=pos.x-1, y = pos.y, z = pos.z})
|
|
||||||
pos = {x = pos.x-1, y = pos.y, z = pos.z}
|
|
||||||
elseif is_liquid({x = pos.x+1, y = pos.y, z = pos.z}) then
|
|
||||||
node = get_node({x = pos.x+1, y = pos.y, z = pos.z})
|
|
||||||
pos = {x = pos.x+1, y = pos.y, z = pos.z}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if is_touching(realpos.z, pos.z, radius) then
|
|
||||||
if is_liquid({x = pos.x, y = pos.y, z = pos.z - 1}) then
|
|
||||||
node = get_node({x = pos.x, y = pos.y, z = pos.z - 1})
|
|
||||||
pos = {x = pos.x, y = pos.y, z = pos.z - 1}
|
|
||||||
elseif is_liquid({x = pos.x, y = pos.y, z = pos.z + 1}) then
|
|
||||||
node = get_node({x = pos.x, y = pos.y, z = pos.z + 1})
|
|
||||||
pos = {x = pos.x, y = pos.y, z = pos.z + 1}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return pos, node
|
|
||||||
end
|
|
||||||
|
|
||||||
flowlib.move_centre = move_centre
|
|
|
@ -1,4 +0,0 @@
|
||||||
name = flowlib
|
|
||||||
author = Qwertymine3
|
|
||||||
description = Simple flow functions for use in Minetest mods by Qwertymine3
|
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
-- Overrides the builtin minetest.check_single_for_falling.
|
|
||||||
-- We need to do this in order to handle nodes in mineclone specific groups
|
|
||||||
-- "supported_node" and "attached_node_facedir".
|
|
||||||
--
|
|
||||||
-- Nodes in group "supported_node" can be placed on any node that does not
|
|
||||||
-- have the "airlike" drawtype. Carpets are an example of this type.
|
|
||||||
|
|
||||||
local vector = vector
|
|
||||||
|
|
||||||
local facedir_to_dir = minetest.facedir_to_dir
|
|
||||||
local get_item_group = minetest.get_item_group
|
|
||||||
local remove_node = minetest.remove_node
|
|
||||||
local get_node = minetest.get_node
|
|
||||||
local get_meta = minetest.get_meta
|
|
||||||
local registered_nodes = minetest.registered_nodes
|
|
||||||
local get_node_drops = minetest.get_node_drops
|
|
||||||
local add_item = minetest.add_item
|
|
||||||
|
|
||||||
-- drop_attached_node(p)
|
|
||||||
--
|
|
||||||
-- This function is copied verbatim from minetest/builtin/game/falling.lua
|
|
||||||
-- We need this to do the exact same dropping node handling in our override
|
|
||||||
-- minetest.check_single_for_falling() function as in the builtin function.
|
|
||||||
--
|
|
||||||
local function drop_attached_node(p)
|
|
||||||
local n = get_node(p)
|
|
||||||
local drops = get_node_drops(n, "")
|
|
||||||
local def = registered_nodes[n.name]
|
|
||||||
if def and def.preserve_metadata then
|
|
||||||
local oldmeta = get_meta(p):to_table().fields
|
|
||||||
-- Copy pos and node because the callback can modify them.
|
|
||||||
local pos_copy = vector.new(p)
|
|
||||||
local node_copy = {name=n.name, param1=n.param1, param2=n.param2}
|
|
||||||
local drop_stacks = {}
|
|
||||||
for k, v in pairs(drops) do
|
|
||||||
drop_stacks[k] = ItemStack(v)
|
|
||||||
end
|
|
||||||
drops = drop_stacks
|
|
||||||
def.preserve_metadata(pos_copy, node_copy, oldmeta, drops)
|
|
||||||
end
|
|
||||||
if def and def.sounds and def.sounds.fall then
|
|
||||||
core.sound_play(def.sounds.fall, {pos = p}, true)
|
|
||||||
end
|
|
||||||
remove_node(p)
|
|
||||||
for _, item in pairs(drops) do
|
|
||||||
local pos = {
|
|
||||||
x = p.x + math.random()/2 - 0.25,
|
|
||||||
y = p.y + math.random()/2 - 0.25,
|
|
||||||
z = p.z + math.random()/2 - 0.25,
|
|
||||||
}
|
|
||||||
add_item(pos, item)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- minetest.check_single_for_falling(pos)
|
|
||||||
--
|
|
||||||
-- * causes an unsupported `group:falling_node` node to fall and causes an
|
|
||||||
-- unattached `group:attached_node` or `group:attached_node_facedir` node
|
|
||||||
-- or unsupported `group:supported_node` node to drop.
|
|
||||||
-- * does not spread these updates to neighbours.
|
|
||||||
--
|
|
||||||
-- Returns true if the node at <pos> has spawned a falling node or has been
|
|
||||||
-- dropped as item(s).
|
|
||||||
--
|
|
||||||
local original_function = minetest.check_single_for_falling
|
|
||||||
|
|
||||||
function minetest.check_single_for_falling(pos)
|
|
||||||
if original_function(pos) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
local node = get_node(pos)
|
|
||||||
if get_item_group(node.name, "attached_node_facedir") ~= 0 then
|
|
||||||
local dir = facedir_to_dir(node.param2)
|
|
||||||
if dir then
|
|
||||||
if get_item_group(get_node(vector.add(pos, dir)).name, "solid") == 0 then
|
|
||||||
drop_attached_node(pos)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if get_item_group(node.name, "supported_node") ~= 0 then
|
|
||||||
local def = registered_nodes[get_node(vector.offset(pos, 0, -1, 0)).name]
|
|
||||||
if def and def.drawtype == "airlike" then
|
|
||||||
drop_attached_node(pos)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
name = mcl_attached
|
|
||||||
author = Wuzzy
|
|
||||||
description = Adds additional ways for nodes to be attached.
|
|
|
@ -1,27 +0,0 @@
|
||||||
# mcl_autogroup
|
|
||||||
This mod emulate digging times from mc.
|
|
||||||
|
|
||||||
## mcl_autogroup.can_harvest(nodename, toolname)
|
|
||||||
Return true if <nodename> can be dig with <toolname>.
|
|
||||||
* nodename: string, valid nodename
|
|
||||||
* toolname: (optional) string, valid toolname
|
|
||||||
|
|
||||||
## mcl_autogroup.get_groupcaps(toolname, efficiency)
|
|
||||||
This function is used to calculate diggroups for tools.
|
|
||||||
WARNING: This function can only be called after mod initialization.
|
|
||||||
* toolname: string, name of the tool being enchanted (like "mcl_tools:diamond_pickaxe")
|
|
||||||
* efficiency: (optional) integer, the efficiency level the tool is enchanted with (default 0)
|
|
||||||
|
|
||||||
## mcl_autogroup.get_wear(toolname, diggroup)
|
|
||||||
Return the max wear of <toolname> with <diggroup>
|
|
||||||
WARNING: This function can only be called after mod initialization.
|
|
||||||
* toolname: string, name of the tool used
|
|
||||||
* diggroup: string, the name of the diggroup the tool is used on
|
|
||||||
|
|
||||||
## mcl_autogroup.register_diggroup(group, def)
|
|
||||||
* group: string, name of the group to register as a digging group
|
|
||||||
* def: (optional) table, table with information about the diggroup (defaults to {} if unspecified)
|
|
||||||
* level: (optional) string, if specified it is an array containing the names of the different digging levels the digging group supports
|
|
||||||
|
|
||||||
## mcl_autogroup.registered_diggroups
|
|
||||||
List of registered diggroups, indexed by name.
|
|
|
@ -1,28 +0,0 @@
|
||||||
--[[
|
|
||||||
This is one part of a mod to replicate the digging times from Minecraft. This
|
|
||||||
part only exposes a function to register digging groups. The rest of the mod is
|
|
||||||
implemented and documented in the _mcl_autogroup.
|
|
||||||
|
|
||||||
The mod is split up into two parts, mcl_autogroup and _mcl_autogroup.
|
|
||||||
mcl_autogroup contains the API functions used to register custom digging groups.
|
|
||||||
_mcl_autogroup contains most of the code. The leading underscore in the name
|
|
||||||
"_mcl_autogroup" is used to force Minetest to load that part of the mod as late
|
|
||||||
as possible. Minetest loads mods in reverse alphabetical order.
|
|
||||||
--]]
|
|
||||||
mcl_autogroup = {}
|
|
||||||
mcl_autogroup.registered_diggroups = {}
|
|
||||||
|
|
||||||
assert(minetest.get_modpath("_mcl_autogroup"), "This mod requires the mod _mcl_autogroup to function")
|
|
||||||
|
|
||||||
-- Register a group as a digging group.
|
|
||||||
--
|
|
||||||
-- Parameters:
|
|
||||||
-- group - Name of the group to register as a digging group
|
|
||||||
-- def - Table with information about the diggroup (defaults to {} if unspecified)
|
|
||||||
--
|
|
||||||
-- Values in def:
|
|
||||||
-- level - If specified it is an array containing the names of the different
|
|
||||||
-- digging levels the digging group supports.
|
|
||||||
function mcl_autogroup.register_diggroup(group, def)
|
|
||||||
mcl_autogroup.registered_diggroups[group] = def or {}
|
|
||||||
end
|
|
|
@ -1,3 +0,0 @@
|
||||||
name = mcl_autogroup
|
|
||||||
author = ryvnf
|
|
||||||
description = MineClone 2 core mod which automatically adds groups to all items. Very important for digging times.
|
|
|
@ -1,8 +0,0 @@
|
||||||
# mcl_colors
|
|
||||||
Mod providing global table containing legacity minecraft colors to be used in mods.
|
|
||||||
|
|
||||||
## mcl_colors.*
|
|
||||||
Colors by upper name, in hex value.
|
|
||||||
|
|
||||||
## mcl_colors.background.*
|
|
||||||
Background colors by upper name, in hex value.
|
|
|
@ -1,36 +0,0 @@
|
||||||
mcl_colors = {
|
|
||||||
BLACK = "#000000",
|
|
||||||
DARK_BLUE = "#0000AA",
|
|
||||||
DARK_GREEN = "#00AA00",
|
|
||||||
DARK_AQUA = "#00AAAA",
|
|
||||||
DARK_RED = "#AA0000",
|
|
||||||
DARK_PURPLE = "#AA00AA",
|
|
||||||
GOLD = "#FFAA00",
|
|
||||||
GRAY = "#AAAAAA",
|
|
||||||
DARK_GRAY = "#555555",
|
|
||||||
BLUE = "#5555FF",
|
|
||||||
GREEN = "#55FF55",
|
|
||||||
AQUA = "#55FFFF",
|
|
||||||
RED = "#FF5555",
|
|
||||||
LIGHT_PURPLE = "#FF55FF",
|
|
||||||
YELLOW = "#FFFF55",
|
|
||||||
WHITE = "#FFFFFF",
|
|
||||||
background = {
|
|
||||||
BLACK = "#000000",
|
|
||||||
DARK_BLUE = "#00002A",
|
|
||||||
DARK_GREEN = "#002A00",
|
|
||||||
DARK_AQUA = "#002A2A",
|
|
||||||
DARK_RED = "#2A0000",
|
|
||||||
DARK_PURPLE = "#2A002A",
|
|
||||||
GOLD = "#2A2A00",
|
|
||||||
GRAY = "#2A2A2A",
|
|
||||||
DARK_GRAY = "#151515",
|
|
||||||
BLUE = "#15153F",
|
|
||||||
GREEN = "#153F15",
|
|
||||||
AQUA = "#153F3F",
|
|
||||||
RED = "#3F1515",
|
|
||||||
LIGHT_PURPLE = "#3F153F",
|
|
||||||
YELLOW = "#3F3F15",
|
|
||||||
WHITE = "#373501",
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
name = mcl_colors
|
|
||||||
author = Fleckenstein
|
|
||||||
description = The HTML sequences for the minecraft colors
|
|
|
@ -1,15 +0,0 @@
|
||||||
# mcl_damage
|
|
||||||
|
|
||||||
This mod is intended to overall minetest's native damage system, to provide a better integration between features that deals with entities' health.
|
|
||||||
|
|
||||||
WARNING: Not using it inside your mods may cause strange bugs (using the native damage system may cause conflicts with this system).
|
|
||||||
|
|
||||||
## Callbacks
|
|
||||||
|
|
||||||
To modify the amount of damage made by something:
|
|
||||||
|
|
||||||
```lua
|
|
||||||
--obj: an ObjectRef
|
|
||||||
mcl_damage.register_modifier(function(obj, damage, reason)
|
|
||||||
end, 0)
|
|
||||||
```
|
|
|
@ -1,169 +0,0 @@
|
||||||
mcl_damage = {
|
|
||||||
modifiers = {},
|
|
||||||
damage_callbacks = {},
|
|
||||||
death_callbacks = {},
|
|
||||||
types = {
|
|
||||||
in_fire = {is_fire = true},
|
|
||||||
lightning_bolt = {is_lightning = true},
|
|
||||||
on_fire = {is_fire = true, bypasses_armor = true},
|
|
||||||
lava = {is_fire = true},
|
|
||||||
hot_floor = {is_fire = true},
|
|
||||||
in_wall = {bypasses_armor = true},
|
|
||||||
drown = {bypasses_armor = true},
|
|
||||||
starve = {bypasses_armor = true, bypasses_magic = true},
|
|
||||||
cactus = {},
|
|
||||||
fall = {bypasses_armor = true},
|
|
||||||
fly_into_wall = {bypasses_armor = true}, -- unused
|
|
||||||
out_of_world = {bypasses_armor = true, bypasses_magic = true, bypasses_invulnerability = true, bypasses_totem = true},
|
|
||||||
generic = {bypasses_armor = true},
|
|
||||||
magic = {is_magic = true, bypasses_armor = true},
|
|
||||||
dragon_breath = {is_magic = true, bypasses_armor = true}, -- this is only used for dragon fireball; dragon fireball does not actually deal impact damage tho, so this is unreachable
|
|
||||||
wither = {bypasses_armor = true}, -- unused
|
|
||||||
wither_skull = {is_magic = true, is_explosion = true}, -- this is non-MC but a workaround to get the proper death message
|
|
||||||
anvil = {},
|
|
||||||
falling_node = {}, -- this is falling_block in MC
|
|
||||||
mob = {},
|
|
||||||
player = {},
|
|
||||||
arrow = {is_projectile = true},
|
|
||||||
fireball = {is_projectile = true, is_fire = true},
|
|
||||||
thorns = {is_magic = true},
|
|
||||||
explosion = {is_explosion = true},
|
|
||||||
cramming = {bypasses_armor = true}, -- unused
|
|
||||||
fireworks = {is_explosion = true}, -- unused
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function mcl_damage.register_modifier(func, priority)
|
|
||||||
table.insert(mcl_damage.modifiers, {func = func, priority = priority or 0})
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_damage.register_on_damage(func)
|
|
||||||
table.insert(mcl_damage.damage_callbacks, func)
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_damage.register_on_death(func)
|
|
||||||
table.insert(mcl_damage.death_callbacks, func)
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_damage.run_modifiers(obj, damage, reason)
|
|
||||||
for _, modf in ipairs(mcl_damage.modifiers) do
|
|
||||||
damage = modf.func(obj, damage, reason) or damage
|
|
||||||
if damage == 0 then
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return damage
|
|
||||||
end
|
|
||||||
|
|
||||||
local function run_callbacks(funcs, ...)
|
|
||||||
for _, func in pairs(funcs) do
|
|
||||||
func(...)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_damage.run_damage_callbacks(obj, damage, reason)
|
|
||||||
run_callbacks(mcl_damage.damage_callbacks, obj, damage, reason)
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_damage.run_death_callbacks(obj, reason)
|
|
||||||
run_callbacks(mcl_damage.death_callbacks, obj, reason)
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_damage.from_punch(mcl_reason, object)
|
|
||||||
mcl_reason.direct = object
|
|
||||||
local luaentity = mcl_reason.direct:get_luaentity()
|
|
||||||
if luaentity then
|
|
||||||
if luaentity._is_arrow then
|
|
||||||
mcl_reason.type = "arrow"
|
|
||||||
elseif luaentity._is_fireball then
|
|
||||||
mcl_reason.type = "fireball"
|
|
||||||
elseif luaentity.is_mob then
|
|
||||||
mcl_reason.type = "mob"
|
|
||||||
end
|
|
||||||
mcl_reason.source = mcl_reason.source or luaentity._source_object
|
|
||||||
else
|
|
||||||
mcl_reason.type = "player"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_damage.finish_reason(mcl_reason)
|
|
||||||
mcl_reason.source = mcl_reason.source or mcl_reason.direct
|
|
||||||
mcl_reason.flags = mcl_damage.types[mcl_reason.type]
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_damage.from_mt(mt_reason)
|
|
||||||
if mt_reason._mcl_chached_reason then
|
|
||||||
return mt_reason._mcl_chached_reason
|
|
||||||
end
|
|
||||||
|
|
||||||
local mcl_reason
|
|
||||||
|
|
||||||
if mt_reason._mcl_reason then
|
|
||||||
mcl_reason = mt_reason._mcl_reason
|
|
||||||
else
|
|
||||||
mcl_reason = {type = "generic"}
|
|
||||||
|
|
||||||
if mt_reason._mcl_type then
|
|
||||||
mcl_reason.type = mt_reason._mcl_type
|
|
||||||
elseif mt_reason.type == "fall" then
|
|
||||||
mcl_reason.type = "fall"
|
|
||||||
elseif mt_reason.type == "drown" then
|
|
||||||
mcl_reason.type = "drown"
|
|
||||||
elseif mt_reason.type == "punch" then
|
|
||||||
mcl_damage.from_punch(mcl_reason, mt_reason.object)
|
|
||||||
elseif mt_reason.type == "node_damage" and mt_reason.node then
|
|
||||||
if minetest.get_item_group(mt_reason.node, "fire") > 0 then
|
|
||||||
mcl_reason.type = "in_fire"
|
|
||||||
end
|
|
||||||
if minetest.get_item_group(mt_reason.node, "lava") > 0 then
|
|
||||||
mcl_reason.type = "lava"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for key, value in pairs(mt_reason) do
|
|
||||||
if key:find("_mcl_") == 1 then
|
|
||||||
mcl_reason[key:sub(6, #key)] = value
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
mcl_damage.finish_reason(mcl_reason)
|
|
||||||
mt_reason._mcl_cached_reason = mcl_reason
|
|
||||||
|
|
||||||
return mcl_reason
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_damage.register_type(name, def)
|
|
||||||
mcl_damage.types[name] = def
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
|
||||||
if hp_change < 0 then
|
|
||||||
if player:get_hp() <= 0 then
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
hp_change = -mcl_damage.run_modifiers(player, -hp_change, mcl_damage.from_mt(mt_reason))
|
|
||||||
end
|
|
||||||
return hp_change
|
|
||||||
end, true)
|
|
||||||
|
|
||||||
minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
|
||||||
if player:get_hp() > 0 then
|
|
||||||
mt_reason.approved = true
|
|
||||||
if hp_change < 0 then
|
|
||||||
mcl_damage.run_damage_callbacks(player, -hp_change, mcl_damage.from_mt(mt_reason))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end, false)
|
|
||||||
|
|
||||||
minetest.register_on_dieplayer(function(player, mt_reason)
|
|
||||||
if mt_reason.approved then
|
|
||||||
mcl_damage.run_death_callbacks(player, mcl_damage.from_mt(mt_reason))
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
minetest.register_on_mods_loaded(function()
|
|
||||||
table.sort(mcl_damage.modifiers, function(a, b) return a.priority < b.priority end)
|
|
||||||
end)
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
name = mcl_damage
|
|
||||||
author = Fleckenstein
|
|
||||||
description = Minecraft-like damage reason system
|
|
|
@ -1,15 +0,0 @@
|
||||||
# mcl_explosions
|
|
||||||
This mod provide helper functions to create explosions.
|
|
||||||
|
|
||||||
## mcl_explosions.explode(pos, strength, info, puncher)
|
|
||||||
* pos: position, initial position of the explosion
|
|
||||||
* strenght: number, radius of the explosion
|
|
||||||
* info: table, explosion informations:
|
|
||||||
* drop_chance: number, if specified becomes the drop chance of all nodes in the explosion (default: 1.0 / strength)
|
|
||||||
* max_blast_resistance: int, if specified the explosion will treat all non-indestructible nodes as having a blast resistance of no more than this value
|
|
||||||
* sound: bool, if true, the explosion will play a sound (default: true)
|
|
||||||
* particles: bool, if true, the explosion will create particles (default: true)
|
|
||||||
* fire: bool, if true, 1/3 nodes become fire (default: false)
|
|
||||||
* griefing: bool, if true, the explosion will destroy nodes (default: true)
|
|
||||||
* grief_protected: bool, if true, the explosion will also destroy nodes which have been protected (default: false)
|
|
||||||
* puncher: (optional) entity, will be used as source for damage done by the explosion
|
|
|
@ -1,472 +0,0 @@
|
||||||
--[[
|
|
||||||
Explosion API mod for Minetest (adapted to MineClone 2)
|
|
||||||
|
|
||||||
This mod is based on the Minetest explosion API mod, but has been changed
|
|
||||||
to have the same explosion mechanics as Minecraft and work with MineClone.
|
|
||||||
The computation-intensive parts of the mod has been optimized to allow for
|
|
||||||
larger explosions and faster world updating.
|
|
||||||
|
|
||||||
This mod was created by Elias Astrom <ryvnf@riseup.net> and is released
|
|
||||||
under the LGPLv2.1 license.
|
|
||||||
--]]
|
|
||||||
|
|
||||||
mcl_explosions = {}
|
|
||||||
|
|
||||||
local mod_fire = minetest.get_modpath("mcl_fire")
|
|
||||||
--local CONTENT_FIRE = minetest.get_content_id("mcl_fire:fire")
|
|
||||||
|
|
||||||
local math = math
|
|
||||||
local vector = vector
|
|
||||||
local table = table
|
|
||||||
|
|
||||||
local hash_node_position = minetest.hash_node_position
|
|
||||||
local get_objects_inside_radius = minetest.get_objects_inside_radius
|
|
||||||
local get_position_from_hash = minetest.get_position_from_hash
|
|
||||||
local get_node_drops = minetest.get_node_drops
|
|
||||||
local get_name_from_content_id = minetest.get_name_from_content_id
|
|
||||||
local get_voxel_manip = minetest.get_voxel_manip
|
|
||||||
local bulk_set_node = minetest.bulk_set_node
|
|
||||||
local check_for_falling = minetest.check_for_falling
|
|
||||||
local add_item = minetest.add_item
|
|
||||||
local pos_to_string = minetest.pos_to_string
|
|
||||||
|
|
||||||
-- Saved sphere explosion shapes for various radiuses
|
|
||||||
local sphere_shapes = {}
|
|
||||||
|
|
||||||
-- Saved node definitions in table using cid-keys for faster look-up.
|
|
||||||
local node_blastres = {}
|
|
||||||
local node_on_blast = {}
|
|
||||||
local node_walkable = {}
|
|
||||||
|
|
||||||
-- The step length for the rays (Minecraft uses 0.3)
|
|
||||||
local STEP_LENGTH = 0.3
|
|
||||||
|
|
||||||
-- How many rays to compute entity exposure to explosion
|
|
||||||
local N_EXPOSURE_RAYS = 16
|
|
||||||
|
|
||||||
-- Nodes having a blast resistance of this value or higher are treated as
|
|
||||||
-- indestructible
|
|
||||||
local INDESTRUCT_BLASTRES = 1000000
|
|
||||||
|
|
||||||
minetest.register_on_mods_loaded(function()
|
|
||||||
-- Store blast resistance values by content ids to improve performance.
|
|
||||||
for name, def in pairs(minetest.registered_nodes) do
|
|
||||||
local id = minetest.get_content_id(name)
|
|
||||||
node_blastres[id] = def._mcl_blast_resistance or 0
|
|
||||||
node_on_blast[id] = def.on_blast
|
|
||||||
node_walkable[id] = def.walkable
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Compute the rays which make up a sphere with radius. Returns a list of rays
|
|
||||||
-- which can be used to trace explosions. This function is not efficient
|
|
||||||
-- (especially for larger radiuses), so the generated rays for various radiuses
|
|
||||||
-- should be cached and reused.
|
|
||||||
--
|
|
||||||
-- Should be possible to improve by using a midpoint circle algorithm multiple
|
|
||||||
-- times to create the sphere, currently uses more of a brute-force approach.
|
|
||||||
local function compute_sphere_rays(radius)
|
|
||||||
local rays = {}
|
|
||||||
local sphere = {}
|
|
||||||
|
|
||||||
local function add_ray(pos)
|
|
||||||
sphere[hash_node_position(pos)] = pos
|
|
||||||
end
|
|
||||||
|
|
||||||
for y = -radius, radius do
|
|
||||||
for z = -radius, radius do
|
|
||||||
for x = -radius, 0 do
|
|
||||||
local d = x * x + y * y + z * z
|
|
||||||
if d <= radius * radius then
|
|
||||||
add_ray(vector.new(x, y, z))
|
|
||||||
add_ray(vector.new(-x, y, z))
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for x = -radius, radius do
|
|
||||||
for z = -radius, radius do
|
|
||||||
for y = -radius, 0 do
|
|
||||||
local d = x * x + y * y + z * z
|
|
||||||
if d <= radius * radius then
|
|
||||||
add_ray(vector.new(x, y, z))
|
|
||||||
add_ray(vector.new(x, -y, z))
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for x = -radius, radius do
|
|
||||||
for y = -radius, radius do
|
|
||||||
for z = -radius, 0 do
|
|
||||||
local d = x * x + y * y + z * z
|
|
||||||
if d <= radius * radius then
|
|
||||||
add_ray(vector.new(x, y, z))
|
|
||||||
add_ray(vector.new(x, y, -z))
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, pos in pairs(sphere) do
|
|
||||||
rays[#rays + 1] = vector.normalize(pos)
|
|
||||||
end
|
|
||||||
|
|
||||||
return rays
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Add particles from explosion
|
|
||||||
--
|
|
||||||
-- Parameters:
|
|
||||||
-- pos - The position of the explosion
|
|
||||||
-- radius - The radius of the explosion
|
|
||||||
local function add_particles(pos, radius)
|
|
||||||
minetest.add_particlespawner({
|
|
||||||
amount = 64,
|
|
||||||
time = 0.125,
|
|
||||||
minpos = pos,
|
|
||||||
maxpos = pos,
|
|
||||||
minvel = {x = -radius, y = -radius, z = -radius},
|
|
||||||
maxvel = {x = radius, y = radius, z = radius},
|
|
||||||
minacc = vector.new(),
|
|
||||||
maxacc = vector.new(),
|
|
||||||
minexptime = 0.5,
|
|
||||||
maxexptime = 1.0,
|
|
||||||
minsize = radius * 0.5,
|
|
||||||
maxsize = radius * 1.0,
|
|
||||||
texture = "mcl_particles_smoke.png",
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Traces the rays of an explosion, and updates the environment.
|
|
||||||
--
|
|
||||||
-- Parameters:
|
|
||||||
-- pos - Where the rays in the explosion should start from
|
|
||||||
-- strength - The strength of each ray
|
|
||||||
-- raydirs - The directions for each ray
|
|
||||||
-- radius - The maximum distance each ray will go
|
|
||||||
-- info - Table containing information about explosion
|
|
||||||
-- direct - direct source object of the damage (optional)
|
|
||||||
-- source - indirect source object of the damage (optional)
|
|
||||||
--
|
|
||||||
-- Values in info:
|
|
||||||
-- drop_chance - The chance that destroyed nodes will drop their items
|
|
||||||
-- fire - If true, 1/3 nodes become fire
|
|
||||||
-- griefing - If true, the explosion will destroy nodes (default: true)
|
|
||||||
-- max_blast_resistance - The explosion will treat all non-indestructible nodes
|
|
||||||
-- as having a blast resistance of no more than this
|
|
||||||
-- value
|
|
||||||
-- grief_protected - If true, the explosion will also destroy nodes which have
|
|
||||||
-- been protected
|
|
||||||
--
|
|
||||||
-- Note that this function has been optimized, it contains code which has been
|
|
||||||
-- inlined to avoid function calls and unnecessary table creation. This was
|
|
||||||
-- measured to give a significant performance increase.
|
|
||||||
local function trace_explode(pos, strength, raydirs, radius, info, direct, source)
|
|
||||||
local vm = get_voxel_manip()
|
|
||||||
|
|
||||||
local emin, emax = vm:read_from_map(vector.subtract(pos, radius),
|
|
||||||
vector.add(pos, radius))
|
|
||||||
local emin_x = emin.x
|
|
||||||
local emin_y = emin.y
|
|
||||||
local emin_z = emin.z
|
|
||||||
|
|
||||||
local ystride = (emax.x - emin_x + 1)
|
|
||||||
local zstride = ystride * (emax.y - emin_y + 1)
|
|
||||||
|
|
||||||
--[[local area = VoxelArea:new {
|
|
||||||
MinEdge = emin,
|
|
||||||
MaxEdge = emax
|
|
||||||
}]]
|
|
||||||
local data = vm:get_data()
|
|
||||||
local destroy = {}
|
|
||||||
|
|
||||||
local drop_chance = info.drop_chance
|
|
||||||
local fire = info.fire
|
|
||||||
local max_blast_resistance = info.max_blast_resistance
|
|
||||||
local grief_protected = info.grief_protected
|
|
||||||
|
|
||||||
-- Trace rays for environment destruction
|
|
||||||
if info.griefing then
|
|
||||||
for i = 1, #raydirs do
|
|
||||||
local rpos_x = pos.x
|
|
||||||
local rpos_y = pos.y
|
|
||||||
local rpos_z = pos.z
|
|
||||||
local rdir_x = raydirs[i].x
|
|
||||||
local rdir_y = raydirs[i].y
|
|
||||||
local rdir_z = raydirs[i].z
|
|
||||||
local rstr = (0.7 + math.random() * 0.6) * strength
|
|
||||||
|
|
||||||
for r = 0, math.ceil(radius * (1.0 / STEP_LENGTH)) do
|
|
||||||
local npos_x = math.floor(rpos_x + 0.5)
|
|
||||||
local npos_y = math.floor(rpos_y + 0.5)
|
|
||||||
local npos_z = math.floor(rpos_z + 0.5)
|
|
||||||
local npos = { x = npos_x, y = npos_y, z = npos_z }
|
|
||||||
local idx = (npos_z - emin_z) * zstride + (npos_y - emin_y) * ystride +
|
|
||||||
npos_x - emin_x + 1
|
|
||||||
|
|
||||||
local cid = data[idx]
|
|
||||||
local br = node_blastres[cid] or INDESTRUCT_BLASTRES
|
|
||||||
if br < INDESTRUCT_BLASTRES and br > max_blast_resistance then
|
|
||||||
br = max_blast_resistance
|
|
||||||
end
|
|
||||||
|
|
||||||
local hash = hash_node_position(npos)
|
|
||||||
|
|
||||||
rpos_x = rpos_x + STEP_LENGTH * rdir_x
|
|
||||||
rpos_y = rpos_y + STEP_LENGTH * rdir_y
|
|
||||||
rpos_z = rpos_z + STEP_LENGTH * rdir_z
|
|
||||||
|
|
||||||
rstr = rstr - 0.75 * STEP_LENGTH - (br + 0.3) * STEP_LENGTH
|
|
||||||
|
|
||||||
if rstr <= 0 then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
|
|
||||||
if cid ~= minetest.CONTENT_AIR then
|
|
||||||
if not minetest.is_protected(npos, "") or grief_protected then
|
|
||||||
destroy[hash] = idx
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Entities in radius of explosion
|
|
||||||
local punch_radius = 2 * strength
|
|
||||||
local objs = get_objects_inside_radius(pos, punch_radius)
|
|
||||||
|
|
||||||
-- Trace rays for entity damage
|
|
||||||
for _, obj in pairs(objs) do
|
|
||||||
local ent = obj:get_luaentity()
|
|
||||||
|
|
||||||
-- Ignore items to lower lag
|
|
||||||
if (obj:is_player() or (ent and ent.name ~= "__builtin.item")) and obj:get_hp() > 0 then
|
|
||||||
local opos = obj:get_pos()
|
|
||||||
local collisionbox = nil
|
|
||||||
|
|
||||||
if obj:is_player() then
|
|
||||||
collisionbox = { -0.3, 0.0, -0.3, 0.3, 1.77, 0.3 }
|
|
||||||
elseif ent.name then
|
|
||||||
local def = minetest.registered_entities[ent.name]
|
|
||||||
collisionbox = def.collisionbox
|
|
||||||
end
|
|
||||||
|
|
||||||
if collisionbox then
|
|
||||||
-- Create rays from random points in the collision box
|
|
||||||
local x1 = collisionbox[1]
|
|
||||||
local y1 = collisionbox[2]
|
|
||||||
local z1 = collisionbox[3]
|
|
||||||
local x2 = collisionbox[4]
|
|
||||||
local y2 = collisionbox[5]
|
|
||||||
local z2 = collisionbox[6]
|
|
||||||
local x_len = math.abs(x2 - x1)
|
|
||||||
local y_len = math.abs(y2 - y1)
|
|
||||||
local z_len = math.abs(z2 - z1)
|
|
||||||
|
|
||||||
-- Move object position to the center of its bounding box
|
|
||||||
opos.x = opos.x + 0.5 * (x1 + x2)
|
|
||||||
opos.y = opos.y + 0.5 * (y1 + y2)
|
|
||||||
opos.z = opos.z + 0.5 * (z1 + z2)
|
|
||||||
|
|
||||||
-- Count number of rays from collision box which are unobstructed
|
|
||||||
local count = N_EXPOSURE_RAYS
|
|
||||||
|
|
||||||
for i = 1, N_EXPOSURE_RAYS do
|
|
||||||
local rpos_x = opos.x + math.random() * x_len - x_len / 2
|
|
||||||
local rpos_y = opos.y + math.random() * y_len - y_len / 2
|
|
||||||
local rpos_z = opos.z + math.random() * z_len - z_len / 2
|
|
||||||
local rdir_x = pos.x - rpos_x
|
|
||||||
local rdir_y = pos.y - rpos_y
|
|
||||||
local rdir_z = pos.z - rpos_z
|
|
||||||
local rdir_len = math.hypot(rdir_x, math.hypot(rdir_y, rdir_z))
|
|
||||||
rdir_x = rdir_x / rdir_len
|
|
||||||
rdir_y = rdir_y / rdir_len
|
|
||||||
rdir_z = rdir_z / rdir_len
|
|
||||||
|
|
||||||
for i=0, rdir_len / STEP_LENGTH do
|
|
||||||
rpos_x = rpos_x + rdir_x * STEP_LENGTH
|
|
||||||
rpos_y = rpos_y + rdir_y * STEP_LENGTH
|
|
||||||
rpos_z = rpos_z + rdir_z * STEP_LENGTH
|
|
||||||
local npos_x = math.floor(rpos_x + 0.5)
|
|
||||||
local npos_y = math.floor(rpos_y + 0.5)
|
|
||||||
local npos_z = math.floor(rpos_z + 0.5)
|
|
||||||
local idx = (npos_z - emin_z) * zstride + (npos_y - emin_y) * ystride +
|
|
||||||
npos_x - emin_x + 1
|
|
||||||
|
|
||||||
|
|
||||||
local cid = data[idx]
|
|
||||||
local walkable = node_walkable[cid]
|
|
||||||
|
|
||||||
if walkable then
|
|
||||||
count = count - 1
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Punch entity with damage depending on explosion exposure and
|
|
||||||
-- distance to explosion
|
|
||||||
local exposure = count / N_EXPOSURE_RAYS
|
|
||||||
local punch_vec = vector.subtract(opos, pos)
|
|
||||||
local punch_dir = vector.normalize(punch_vec)
|
|
||||||
local impact = (1 - vector.length(punch_vec) / punch_radius) * exposure
|
|
||||||
if impact < 0 then
|
|
||||||
impact = 0
|
|
||||||
end
|
|
||||||
local damage = math.floor((impact * impact + impact) * 7 * strength + 1)
|
|
||||||
|
|
||||||
local sleep_formspec_doesnt_close_mt53 = false
|
|
||||||
if obj:is_player() then
|
|
||||||
local name = obj:get_player_name()
|
|
||||||
if mcl_beds then
|
|
||||||
local meta = obj:get_meta()
|
|
||||||
if meta:get_string("mcl_beds:sleeping") == "true" then
|
|
||||||
minetest.close_formspec(name, "") -- ABSOLUTELY NECESSARY FOR MT5.3 -- TODO: REMOVE THIS IN THE FUTURE
|
|
||||||
sleep_formspec_doesnt_close_mt53 = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if sleep_formspec_doesnt_close_mt53 then
|
|
||||||
minetest.after(0.3, function() -- 0.2 is minimum delay for closing old formspec and open died formspec -- TODO: REMOVE THIS IN THE FUTURE
|
|
||||||
if not obj:is_player() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
mcl_util.deal_damage(obj, damage, {type = "explosion", direct = direct, source = source})
|
|
||||||
|
|
||||||
obj:add_velocity(vector.multiply(punch_dir, impact * 20))
|
|
||||||
end)
|
|
||||||
else
|
|
||||||
mcl_util.deal_damage(obj, damage, {type = "explosion", direct = direct, source = source})
|
|
||||||
|
|
||||||
if obj:is_player() or ent.tnt_knockback then
|
|
||||||
obj:add_velocity(vector.multiply(punch_dir, impact * 20))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local airs, fires = {}, {}
|
|
||||||
|
|
||||||
-- Remove destroyed blocks and drop items
|
|
||||||
for hash, idx in pairs(destroy) do
|
|
||||||
local do_drop = math.random() <= drop_chance
|
|
||||||
local on_blast = node_on_blast[data[idx]]
|
|
||||||
local remove = true
|
|
||||||
|
|
||||||
if do_drop or on_blast then
|
|
||||||
local npos = get_position_from_hash(hash)
|
|
||||||
if on_blast then
|
|
||||||
on_blast(npos, 1.0, do_drop)
|
|
||||||
remove = false
|
|
||||||
else
|
|
||||||
local name = get_name_from_content_id(data[idx])
|
|
||||||
local drop = get_node_drops(name, "")
|
|
||||||
|
|
||||||
for _, item in ipairs(drop) do
|
|
||||||
if type(item) ~= "string" then
|
|
||||||
item = item:get_name() .. item:get_count()
|
|
||||||
end
|
|
||||||
add_item(npos, item)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if remove then
|
|
||||||
if mod_fire and fire and math.random(1, 3) == 1 then
|
|
||||||
table.insert(fires, get_position_from_hash(hash))
|
|
||||||
else
|
|
||||||
table.insert(airs, get_position_from_hash(hash))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- We use bulk_set_node instead of LVM because we want to have on_destruct and
|
|
||||||
-- on_construct being called
|
|
||||||
if #airs > 0 then
|
|
||||||
bulk_set_node(airs, {name="air"})
|
|
||||||
end
|
|
||||||
if #fires > 0 then
|
|
||||||
bulk_set_node(fires, {name="mcl_fire:fire"})
|
|
||||||
end
|
|
||||||
-- Update falling nodes
|
|
||||||
for a=1, #airs do
|
|
||||||
local p = airs[a]
|
|
||||||
check_for_falling({x=p.x, y=p.y+1, z=p.z})
|
|
||||||
end
|
|
||||||
for f=1, #fires do
|
|
||||||
local p = fires[f]
|
|
||||||
check_for_falling({x=p.x, y=p.y+1, z=p.z})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Log explosion
|
|
||||||
minetest.log("action", "Explosion at "..pos_to_string(pos).." with strength "..strength.." and radius "..radius)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Create an explosion with strength at pos.
|
|
||||||
--
|
|
||||||
-- Parameters:
|
|
||||||
-- pos - The position where the explosion originates from
|
|
||||||
-- strength - The blast strength of the explosion (a TNT explosion uses 4)
|
|
||||||
-- info - Table containing information about explosion
|
|
||||||
-- direct - direct source object of the damage (optional)
|
|
||||||
-- source - indirect source object of the damage (optional)
|
|
||||||
--
|
|
||||||
-- Values in info:
|
|
||||||
-- drop_chance - If specified becomes the drop chance of all nodes in the
|
|
||||||
-- explosion (default: 1.0 / strength)
|
|
||||||
-- max_blast_resistance - If specified the explosion will treat all
|
|
||||||
-- non-indestructible nodes as having a blast resistance
|
|
||||||
-- of no more than this value
|
|
||||||
-- sound - If true, the explosion will play a sound (default: true)
|
|
||||||
-- particles - If true, the explosion will create particles (default: true)
|
|
||||||
-- fire - If true, 1/3 nodes become fire (default: false)
|
|
||||||
-- griefing - If true, the explosion will destroy nodes (default: true)
|
|
||||||
-- grief_protected - If true, the explosion will also destroy nodes which have
|
|
||||||
-- been protected (default: false)
|
|
||||||
function mcl_explosions.explode(pos, strength, info, direct, source)
|
|
||||||
if info == nil then
|
|
||||||
info = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- The maximum blast radius (in the air)
|
|
||||||
local radius = math.ceil(1.3 * strength / (0.3 * 0.75) * 0.3)
|
|
||||||
|
|
||||||
if not sphere_shapes[radius] then
|
|
||||||
sphere_shapes[radius] = compute_sphere_rays(radius)
|
|
||||||
end
|
|
||||||
local shape = sphere_shapes[radius]
|
|
||||||
|
|
||||||
-- Default values
|
|
||||||
if info.drop_chance == nil then info.drop_chance = 1 / strength end
|
|
||||||
if info.particles == nil then info.particles = true end
|
|
||||||
if info.sound == nil then info.sound = true end
|
|
||||||
if info.fire == nil then info.fire = false end
|
|
||||||
if info.griefing == nil then info.griefing = true end
|
|
||||||
if info.grief_protected == nil then info.grief_protected = false end
|
|
||||||
if info.max_blast_resistance == nil then
|
|
||||||
info.max_blast_resistance = INDESTRUCT_BLASTRES
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Dont do drops in creative mode
|
|
||||||
if minetest.is_creative_enabled("") then
|
|
||||||
info.drop_chance = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
trace_explode(pos, strength, shape, radius, info, direct, source)
|
|
||||||
|
|
||||||
if info.particles then
|
|
||||||
add_particles(pos, radius)
|
|
||||||
end
|
|
||||||
if info.sound then
|
|
||||||
minetest.sound_play("tnt_explode", {
|
|
||||||
pos = pos, gain = 1.0,
|
|
||||||
max_hear_distance = strength * 16
|
|
||||||
}, true)
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,2 +0,0 @@
|
||||||
# textdomain:mcl_explosions
|
|
||||||
@1 was caught in an explosion.=@1 została wysadzona.
|
|
|
@ -1,2 +0,0 @@
|
||||||
# textdomain:mcl_explosions
|
|
||||||
@1 was caught in an explosion.=@1 被炸飛了
|
|
|
@ -1,5 +0,0 @@
|
||||||
name = mcl_explosions
|
|
||||||
author = ryvnf
|
|
||||||
description = A common API to create explosions.
|
|
||||||
depends = mcl_particles
|
|
||||||
optional_depends = mcl_fire
|
|
|
@ -1,263 +0,0 @@
|
||||||
-- Some global variables (don't overwrite them!)
|
|
||||||
mcl_vars = {}
|
|
||||||
|
|
||||||
mcl_vars.redstone_tick = 0.1
|
|
||||||
|
|
||||||
--- GUI / inventory menu settings
|
|
||||||
mcl_vars.gui_slots = "listcolors[#9990;#FFF7;#FFF0;#000;#FFF]"
|
|
||||||
-- nonbg is added as formspec prepend in mcl_formspec_prepend
|
|
||||||
mcl_vars.gui_nonbg = mcl_vars.gui_slots ..
|
|
||||||
"style_type[image_button;border=false;bgimg=mcl_inventory_button9.png;bgimg_pressed=mcl_inventory_button9_pressed.png;bgimg_middle=2,2]"..
|
|
||||||
"style_type[button;border=false;bgimg=mcl_inventory_button9.png;bgimg_pressed=mcl_inventory_button9_pressed.png;bgimg_middle=2,2]"..
|
|
||||||
"style_type[field;textcolor=#323232]"..
|
|
||||||
"style_type[label;textcolor=#323232]"..
|
|
||||||
"style_type[textarea;textcolor=#323232]"..
|
|
||||||
"style_type[checkbox;textcolor=#323232]"
|
|
||||||
|
|
||||||
-- Background stuff must be manually added by mods (no formspec prepend)
|
|
||||||
mcl_vars.gui_bg_color = "bgcolor[#00000000]"
|
|
||||||
mcl_vars.gui_bg_img = "background9[1,1;1,1;mcl_base_textures_background9.png;true;7]"
|
|
||||||
|
|
||||||
-- Legacy
|
|
||||||
mcl_vars.inventory_header = ""
|
|
||||||
|
|
||||||
-- Tool wield size
|
|
||||||
mcl_vars.tool_wield_scale = { x = 1.8, y = 1.8, z = 1 }
|
|
||||||
|
|
||||||
-- Mapgen variables
|
|
||||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
|
||||||
local minecraft_height_limit = 256
|
|
||||||
local superflat = mg_name == "flat" and minetest.get_mapgen_setting("mcl_superflat_classic") == "true"
|
|
||||||
local singlenode = mg_name == "singlenode"
|
|
||||||
|
|
||||||
-- Calculate mapgen_edge_min/mapgen_edge_max
|
|
||||||
mcl_vars.chunksize = math.max(1, tonumber(minetest.get_mapgen_setting("chunksize")) or 5)
|
|
||||||
mcl_vars.MAP_BLOCKSIZE = math.max(1, minetest.MAP_BLOCKSIZE or 16)
|
|
||||||
mcl_vars.mapgen_limit = math.max(1, tonumber(minetest.get_mapgen_setting("mapgen_limit")) or 31000)
|
|
||||||
mcl_vars.MAX_MAP_GENERATION_LIMIT = math.max(1, minetest.MAX_MAP_GENERATION_LIMIT or 31000)
|
|
||||||
local central_chunk_offset = -math.floor(mcl_vars.chunksize / 2)
|
|
||||||
mcl_vars.central_chunk_offset_in_nodes = central_chunk_offset * mcl_vars.MAP_BLOCKSIZE
|
|
||||||
mcl_vars.chunk_size_in_nodes = mcl_vars.chunksize * mcl_vars.MAP_BLOCKSIZE
|
|
||||||
local central_chunk_min_pos = central_chunk_offset * mcl_vars.MAP_BLOCKSIZE
|
|
||||||
local central_chunk_max_pos = central_chunk_min_pos + mcl_vars.chunk_size_in_nodes - 1
|
|
||||||
local ccfmin = central_chunk_min_pos - mcl_vars.MAP_BLOCKSIZE -- Fullminp/fullmaxp of central chunk, in nodes
|
|
||||||
local ccfmax = central_chunk_max_pos + mcl_vars.MAP_BLOCKSIZE
|
|
||||||
local mapgen_limit_b = math.floor(math.min(mcl_vars.mapgen_limit, mcl_vars.MAX_MAP_GENERATION_LIMIT) / mcl_vars.MAP_BLOCKSIZE)
|
|
||||||
local mapgen_limit_min = -mapgen_limit_b * mcl_vars.MAP_BLOCKSIZE
|
|
||||||
local mapgen_limit_max = (mapgen_limit_b + 1) * mcl_vars.MAP_BLOCKSIZE - 1
|
|
||||||
local numcmin = math.max(math.floor((ccfmin - mapgen_limit_min) / mcl_vars.chunk_size_in_nodes), 0) -- Number of complete chunks from central chunk
|
|
||||||
local numcmax = math.max(math.floor((mapgen_limit_max - ccfmax) / mcl_vars.chunk_size_in_nodes), 0) -- fullminp/fullmaxp to effective mapgen limits.
|
|
||||||
mcl_vars.mapgen_edge_min = central_chunk_min_pos - numcmin * mcl_vars.chunk_size_in_nodes
|
|
||||||
mcl_vars.mapgen_edge_max = central_chunk_max_pos + numcmax * mcl_vars.chunk_size_in_nodes
|
|
||||||
|
|
||||||
local function coordinate_to_block(x)
|
|
||||||
return math.floor(x / mcl_vars.MAP_BLOCKSIZE)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function coordinate_to_chunk(x)
|
|
||||||
return math.floor((coordinate_to_block(x) - central_chunk_offset) / mcl_vars.chunksize)
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_vars.pos_to_block(pos)
|
|
||||||
return {
|
|
||||||
x = coordinate_to_block(pos.x),
|
|
||||||
y = coordinate_to_block(pos.y),
|
|
||||||
z = coordinate_to_block(pos.z)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_vars.pos_to_chunk(pos)
|
|
||||||
return {
|
|
||||||
x = coordinate_to_chunk(pos.x),
|
|
||||||
y = coordinate_to_chunk(pos.y),
|
|
||||||
z = coordinate_to_chunk(pos.z)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
local k_positive = math.ceil(mcl_vars.MAX_MAP_GENERATION_LIMIT / mcl_vars.chunk_size_in_nodes)
|
|
||||||
local k_positive_z = k_positive * 2
|
|
||||||
local k_positive_y = k_positive_z * k_positive_z
|
|
||||||
|
|
||||||
function mcl_vars.get_chunk_number(pos) -- unsigned int
|
|
||||||
local c = mcl_vars.pos_to_chunk(pos)
|
|
||||||
return
|
|
||||||
(c.y + k_positive) * k_positive_y +
|
|
||||||
(c.z + k_positive) * k_positive_z +
|
|
||||||
c.x + k_positive
|
|
||||||
end
|
|
||||||
|
|
||||||
if not superflat and not singlenode then
|
|
||||||
-- Normal mode
|
|
||||||
--[[ Realm stacking (h is for height)
|
|
||||||
- Overworld (h>=256)
|
|
||||||
- Void (h>=1000)
|
|
||||||
- Realm Barrier (h=11), to allow escaping the End
|
|
||||||
- End (h>=256)
|
|
||||||
- Void (h>=1000)
|
|
||||||
- Nether (h=128)
|
|
||||||
- Void (h>=1000)
|
|
||||||
]]
|
|
||||||
|
|
||||||
-- Overworld
|
|
||||||
mcl_vars.mg_overworld_min = -62
|
|
||||||
mcl_vars.mg_overworld_max_official = mcl_vars.mg_overworld_min + minecraft_height_limit
|
|
||||||
mcl_vars.mg_bedrock_overworld_min = mcl_vars.mg_overworld_min
|
|
||||||
mcl_vars.mg_bedrock_overworld_max = mcl_vars.mg_bedrock_overworld_min + 4
|
|
||||||
mcl_vars.mg_lava_overworld_max = mcl_vars.mg_overworld_min + 10
|
|
||||||
mcl_vars.mg_lava = true
|
|
||||||
mcl_vars.mg_bedrock_is_rough = true
|
|
||||||
|
|
||||||
elseif singlenode then
|
|
||||||
mcl_vars.mg_overworld_min = -66
|
|
||||||
mcl_vars.mg_overworld_max_official = mcl_vars.mg_overworld_min + minecraft_height_limit
|
|
||||||
mcl_vars.mg_bedrock_overworld_min = mcl_vars.mg_overworld_min
|
|
||||||
mcl_vars.mg_bedrock_overworld_max = mcl_vars.mg_bedrock_overworld_min
|
|
||||||
mcl_vars.mg_lava = false
|
|
||||||
mcl_vars.mg_lava_overworld_max = mcl_vars.mg_overworld_min
|
|
||||||
mcl_vars.mg_bedrock_is_rough = false
|
|
||||||
else
|
|
||||||
-- Classic superflat
|
|
||||||
local ground = minetest.get_mapgen_setting("mgflat_ground_level")
|
|
||||||
ground = tonumber(ground)
|
|
||||||
if not ground then
|
|
||||||
ground = 8
|
|
||||||
end
|
|
||||||
mcl_vars.mg_overworld_min = ground - 3
|
|
||||||
mcl_vars.mg_overworld_max_official = mcl_vars.mg_overworld_min + minecraft_height_limit
|
|
||||||
mcl_vars.mg_bedrock_overworld_min = mcl_vars.mg_overworld_min
|
|
||||||
mcl_vars.mg_bedrock_overworld_max = mcl_vars.mg_bedrock_overworld_min
|
|
||||||
mcl_vars.mg_lava = false
|
|
||||||
mcl_vars.mg_lava_overworld_max = mcl_vars.mg_overworld_min
|
|
||||||
mcl_vars.mg_bedrock_is_rough = false
|
|
||||||
end
|
|
||||||
|
|
||||||
mcl_vars.mg_overworld_max = mcl_vars.mapgen_edge_max
|
|
||||||
|
|
||||||
-- The Nether (around Y = -29000)
|
|
||||||
mcl_vars.mg_nether_min = -29067 -- Carefully chosen to be at a mapchunk border
|
|
||||||
mcl_vars.mg_nether_max = mcl_vars.mg_nether_min + 128
|
|
||||||
mcl_vars.mg_bedrock_nether_bottom_min = mcl_vars.mg_nether_min
|
|
||||||
mcl_vars.mg_bedrock_nether_top_max = mcl_vars.mg_nether_max
|
|
||||||
if not superflat then
|
|
||||||
mcl_vars.mg_bedrock_nether_bottom_max = mcl_vars.mg_bedrock_nether_bottom_min + 4
|
|
||||||
mcl_vars.mg_bedrock_nether_top_min = mcl_vars.mg_bedrock_nether_top_max - 4
|
|
||||||
mcl_vars.mg_lava_nether_max = mcl_vars.mg_nether_min + 31
|
|
||||||
else
|
|
||||||
-- Thin bedrock in classic superflat mapgen
|
|
||||||
mcl_vars.mg_bedrock_nether_bottom_max = mcl_vars.mg_bedrock_nether_bottom_min
|
|
||||||
mcl_vars.mg_bedrock_nether_top_min = mcl_vars.mg_bedrock_nether_top_max
|
|
||||||
mcl_vars.mg_lava_nether_max = mcl_vars.mg_nether_min + 2
|
|
||||||
end
|
|
||||||
if mg_name == "flat" then
|
|
||||||
if superflat then
|
|
||||||
mcl_vars.mg_flat_nether_floor = mcl_vars.mg_bedrock_nether_bottom_max + 4
|
|
||||||
mcl_vars.mg_flat_nether_ceiling = mcl_vars.mg_bedrock_nether_bottom_max + 52
|
|
||||||
else
|
|
||||||
mcl_vars.mg_flat_nether_floor = mcl_vars.mg_lava_nether_max + 4
|
|
||||||
mcl_vars.mg_flat_nether_ceiling = mcl_vars.mg_lava_nether_max + 52
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- The End (surface at ca. Y = -27000)
|
|
||||||
mcl_vars.mg_end_min = -27073 -- Carefully chosen to be at a mapchunk border
|
|
||||||
mcl_vars.mg_end_max_official = mcl_vars.mg_end_min + minecraft_height_limit
|
|
||||||
mcl_vars.mg_end_max = mcl_vars.mg_overworld_min - 2000
|
|
||||||
mcl_vars.mg_end_platform_pos = { x = 100, y = mcl_vars.mg_end_min + 74, z = 0 }
|
|
||||||
|
|
||||||
-- Realm barrier used to safely separate the End from the void below the Overworld
|
|
||||||
mcl_vars.mg_realm_barrier_overworld_end_max = mcl_vars.mg_end_max
|
|
||||||
mcl_vars.mg_realm_barrier_overworld_end_min = mcl_vars.mg_end_max - 11
|
|
||||||
|
|
||||||
-- Use MineClone 2-style dungeons
|
|
||||||
mcl_vars.mg_dungeons = true
|
|
||||||
|
|
||||||
-- Set default stack sizes
|
|
||||||
minetest.nodedef_default.stack_max = 64
|
|
||||||
minetest.craftitemdef_default.stack_max = 64
|
|
||||||
|
|
||||||
-- Set random seed for all other mods (Remember to make sure no other mod calls this function)
|
|
||||||
math.randomseed(os.time())
|
|
||||||
|
|
||||||
local chunks = {} -- intervals of chunks generated
|
|
||||||
function mcl_vars.add_chunk(pos)
|
|
||||||
local n = mcl_vars.get_chunk_number(pos) -- unsigned int
|
|
||||||
local prev
|
|
||||||
for i, d in pairs(chunks) do
|
|
||||||
if n <= d[2] then -- we've found it
|
|
||||||
if (n == d[2]) or (n >= d[1]) then return end -- already here
|
|
||||||
if n == d[1]-1 then -- right before:
|
|
||||||
if prev and (prev[2] == n-1) then
|
|
||||||
prev[2] = d[2]
|
|
||||||
table.remove(chunks, i)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
d[1] = n
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if prev and (prev[2] == n-1) then --join to previous
|
|
||||||
prev[2] = n
|
|
||||||
return
|
|
||||||
end
|
|
||||||
table.insert(chunks, i, {n, n}) -- insert new interval before i
|
|
||||||
return
|
|
||||||
end
|
|
||||||
prev = d
|
|
||||||
end
|
|
||||||
chunks[#chunks+1] = {n, n}
|
|
||||||
end
|
|
||||||
function mcl_vars.is_generated(pos)
|
|
||||||
local n = mcl_vars.get_chunk_number(pos) -- unsigned int
|
|
||||||
for i, d in pairs(chunks) do
|
|
||||||
if n <= d[2] then
|
|
||||||
return (n >= d[1])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- "Trivial" (actually NOT) function to just read the node and some stuff to not just return "ignore", like mt 5.4 does.
|
|
||||||
-- p: Position, if it's wrong, {name="error"} node will return.
|
|
||||||
-- force: optional (default: false) - Do the maximum to still read the node within us_timeout.
|
|
||||||
-- us_timeout: optional (default: 244 = 0.000244 s = 1/80/80/80), set it at least to 3000000 to let mapgen to finish its job.
|
|
||||||
--
|
|
||||||
-- returns node definition, eg. {name="air"}. Unfortunately still can return {name="ignore"}.
|
|
||||||
function mcl_vars.get_node(p, force, us_timeout)
|
|
||||||
-- check initial circumstances
|
|
||||||
if not p or not p.x or not p.y or not p.z then return {name="error"} end
|
|
||||||
|
|
||||||
-- try common way
|
|
||||||
local node = minetest.get_node(p)
|
|
||||||
if node.name ~= "ignore" then
|
|
||||||
return node
|
|
||||||
end
|
|
||||||
|
|
||||||
-- copy table to get sure it won't changed by other threads
|
|
||||||
local pos = {x=p.x,y=p.y,z=p.z}
|
|
||||||
|
|
||||||
-- try LVM
|
|
||||||
minetest.get_voxel_manip():read_from_map(pos, pos)
|
|
||||||
node = minetest.get_node(pos)
|
|
||||||
if node.name ~= "ignore" or not force then
|
|
||||||
return node
|
|
||||||
end
|
|
||||||
|
|
||||||
-- all ways failed - need to emerge (or forceload if generated)
|
|
||||||
local us_timeout = us_timeout or 244
|
|
||||||
if mcl_vars.is_generated(pos) then
|
|
||||||
minetest.chat_send_all("IMPOSSIBLE! Please report this to MCL2 issue tracker!")
|
|
||||||
minetest.forceload_block(pos)
|
|
||||||
else
|
|
||||||
minetest.emerge_area(pos, pos)
|
|
||||||
end
|
|
||||||
|
|
||||||
local t = minetest.get_us_time()
|
|
||||||
|
|
||||||
node = minetest.get_node(pos)
|
|
||||||
|
|
||||||
while (not node or node.name == "ignore") and (minetest.get_us_time() - t < us_timeout) do
|
|
||||||
node = minetest.get_node(pos)
|
|
||||||
end
|
|
||||||
|
|
||||||
return node
|
|
||||||
-- it still can return "ignore", LOL, even if force = true, but only after time out
|
|
||||||
end
|
|
|
@ -1,3 +0,0 @@
|
||||||
name = mcl_init
|
|
||||||
author = Wuzzy
|
|
||||||
description = Initialization mod of MineClone 2. Defines some common shared variables and sets up initial default settings which have to be set at the beginning.
|
|
|
@ -1,159 +0,0 @@
|
||||||
mcl_loot = {}
|
|
||||||
|
|
||||||
--[[
|
|
||||||
Select a number of itemstacks out of a pool of treasure definitions randomly.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
* loot_definitions: Probabilities and information about the loot to select. Syntax:
|
|
||||||
|
|
||||||
{
|
|
||||||
stacks_min = 1, -- Minimum number of item stacks to get. Default: 1
|
|
||||||
stacks_max = 3, -- Maximum number of item stacks to get. Default: 1
|
|
||||||
items = { -- Table of possible loot items. This function selects between stacks_min and stacks_max of these.
|
|
||||||
{
|
|
||||||
weight = 5, -- Likelihood of this item being selected (see below). Optional (default: 1)
|
|
||||||
|
|
||||||
itemstack = ItemStack("example:item1"), -- Itemstack to select
|
|
||||||
-- OR
|
|
||||||
itemstring = "example:item1", -- Which item to select
|
|
||||||
amount_min = 1, -- Minimum size of itemstack. Must not be larger than 6553. Optional (default: 1)
|
|
||||||
amount_max = 10, -- Maximum size of item stack. Must not be larger than item definition's stack_max or 6553. Optional (default: 1)
|
|
||||||
wear_min = 1, -- Minimum wear value. Must be at least 1. Optional (default: no wear)
|
|
||||||
wear_max = 1, -- Maxiumum wear value. Must be at least 1. Optional (default: no wear)
|
|
||||||
},
|
|
||||||
{ -- more tables like above, one table per item stack }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
* pr: PseudoRandom object used for the randomness
|
|
||||||
|
|
||||||
How weight works: The probability of a single item stack being selected is weight/total_weight, with
|
|
||||||
total_weight being the sum of all weight values in the items table. If you leave out the weight for
|
|
||||||
all items, the likelihood of each item being selected is equal.
|
|
||||||
|
|
||||||
Returns: Table of itemstrings
|
|
||||||
]]
|
|
||||||
function mcl_loot.get_loot(loot_definitions, pr)
|
|
||||||
local items = {}
|
|
||||||
|
|
||||||
local total_weight = 0
|
|
||||||
for i=1, #loot_definitions.items do
|
|
||||||
total_weight = total_weight + (loot_definitions.items[i].weight or 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
--local stacks_min = loot_definitions.stacks_min or 1
|
|
||||||
--local stacks_max = loot_definitions.stacks_max or 1
|
|
||||||
|
|
||||||
local stacks = pr:next(loot_definitions.stacks_min, loot_definitions.stacks_max)
|
|
||||||
for s=1, stacks do
|
|
||||||
local r = pr:next(1, total_weight)
|
|
||||||
|
|
||||||
local accumulated_weight = 0
|
|
||||||
local item
|
|
||||||
for i=1, #loot_definitions.items do
|
|
||||||
accumulated_weight = accumulated_weight + (loot_definitions.items[i].weight or 1)
|
|
||||||
if accumulated_weight >= r then
|
|
||||||
item = loot_definitions.items[i]
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if item then
|
|
||||||
local itemstring = item.itemstring
|
|
||||||
|
|
||||||
if itemstring then
|
|
||||||
local stack = ItemStack(itemstring)
|
|
||||||
|
|
||||||
if item.amount_min and item.amount_max then
|
|
||||||
stack:set_count(pr:next(item.amount_min, item.amount_max))
|
|
||||||
end
|
|
||||||
|
|
||||||
if item.wear_min and item.wear_max then
|
|
||||||
-- Sadly, PseudoRandom only allows very narrow ranges, so we set wear in steps of 10
|
|
||||||
local wear_min = math.floor(item.wear_min / 10)
|
|
||||||
local wear_max = math.floor(item.wear_max / 10)
|
|
||||||
|
|
||||||
stack:set_wear(pr:next(wear_min, wear_max) * 10)
|
|
||||||
end
|
|
||||||
|
|
||||||
if item.func then
|
|
||||||
item.func(stack, pr)
|
|
||||||
end
|
|
||||||
|
|
||||||
table.insert(items, stack)
|
|
||||||
else
|
|
||||||
minetest.log("error", "[mcl_loot] INTERNAL ERROR! Failed to select random loot item!")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return items
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[
|
|
||||||
Repeat mcl_loot.get_loot multiple times for various loot_definitions.
|
|
||||||
Useful for filling chests.
|
|
||||||
|
|
||||||
* multi_loot_definitions: Table of loot_definitions (see mcl_loot.get_loot)
|
|
||||||
* pr: PseudoRandom object used for the randomness
|
|
||||||
|
|
||||||
Returns: Table of itemstrings ]]
|
|
||||||
function mcl_loot.get_multi_loot(multi_loot_definitions, pr)
|
|
||||||
local items = {}
|
|
||||||
for m=1, #multi_loot_definitions do
|
|
||||||
local group = mcl_loot.get_loot(multi_loot_definitions[m], pr)
|
|
||||||
for g=1, #group do
|
|
||||||
table.insert(items, group[g])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return items
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[
|
|
||||||
Returns a table of length `max_slot` and all natural numbers between 1 and `max_slot`
|
|
||||||
in a random order.
|
|
||||||
]]
|
|
||||||
local function get_random_slots(max_slot, pr)
|
|
||||||
local slots = {}
|
|
||||||
for s=1, max_slot do
|
|
||||||
slots[s] = s
|
|
||||||
end
|
|
||||||
local slots_out = {}
|
|
||||||
while #slots > 0 do
|
|
||||||
local r = pr and pr:next(1, #slots) or math.random(1, #slots)
|
|
||||||
table.insert(slots_out, slots[r])
|
|
||||||
table.remove(slots, r)
|
|
||||||
end
|
|
||||||
return slots_out
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[
|
|
||||||
Puts items in an inventory list into random slots.
|
|
||||||
* inv: InvRef
|
|
||||||
* listname: Inventory list name
|
|
||||||
* items: table of items to add
|
|
||||||
|
|
||||||
Items will be added from start of the table to end.
|
|
||||||
If the inventory already has occupied slots, or is
|
|
||||||
too small, placement of some items might fail.
|
|
||||||
]]
|
|
||||||
function mcl_loot.fill_inventory(inv, listname, items, pr)
|
|
||||||
local size = inv:get_size(listname)
|
|
||||||
local slots = get_random_slots(size, pr)
|
|
||||||
local leftovers = {}
|
|
||||||
-- 1st pass: Add items into random slots
|
|
||||||
for i=1, math.min(#items, size) do
|
|
||||||
local item = items[i]
|
|
||||||
local slot = slots[i]
|
|
||||||
local old_item = inv:get_stack(listname, slot)
|
|
||||||
local leftover = old_item:add_item(item)
|
|
||||||
inv:set_stack(listname, slot, old_item)
|
|
||||||
if not leftover:is_empty() then
|
|
||||||
table.insert(leftovers, item)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- 2nd pass: If some items couldn't be added in first pass,
|
|
||||||
-- try again in a non-random fashion
|
|
||||||
for l=1, math.min(#leftovers, size) do
|
|
||||||
inv:add_item(listname, leftovers[l])
|
|
||||||
end
|
|
||||||
-- If there are still items left, tough luck!
|
|
||||||
end
|
|
|
@ -1,3 +0,0 @@
|
||||||
name = mcl_loot
|
|
||||||
author = Wuzzy
|
|
||||||
description = API for filling a chest with random treasures.
|
|
|
@ -1,131 +0,0 @@
|
||||||
local vector = vector
|
|
||||||
local table = table
|
|
||||||
|
|
||||||
local hash_node_position = minetest.hash_node_position
|
|
||||||
local add_particlespawner = minetest.add_particlespawner
|
|
||||||
local delete_particlespawner = minetest.delete_particlespawner
|
|
||||||
|
|
||||||
local ipairs = ipairs
|
|
||||||
|
|
||||||
mcl_particles = {}
|
|
||||||
|
|
||||||
-- Table of particlespawner IDs on a per-node hash basis
|
|
||||||
-- Keys: node position hashes
|
|
||||||
-- Values: Tables of particlespawner IDs (each node pos can have an arbitrary number of particlespawners)
|
|
||||||
local particle_nodes = {}
|
|
||||||
|
|
||||||
-- Node particles can be disabled via setting
|
|
||||||
local node_particles_allowed = minetest.settings:get("mcl_node_particles") or "none"
|
|
||||||
|
|
||||||
local levels = {
|
|
||||||
high = 3,
|
|
||||||
medium = 2,
|
|
||||||
low = 1,
|
|
||||||
none = 0,
|
|
||||||
}
|
|
||||||
|
|
||||||
allowed_level = levels[node_particles_allowed]
|
|
||||||
if not allowed_level then
|
|
||||||
allowed_level = levels["none"]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Add a particlespawner that is assigned to a given node position.
|
|
||||||
-- * pos: Node positon. MUST use integer values!
|
|
||||||
-- * particlespawner_definition: definition for minetest.add_particlespawner
|
|
||||||
-- * level: detail level of particles. "high", "medium", "low" or "none". High detail levels are for
|
|
||||||
-- CPU-demanding particles, like smoke of fire (which occurs frequently)
|
|
||||||
-- NOTE: All particlespawners are automatically removed on shutdown.
|
|
||||||
-- Returns particlespawner ID on succcess and nil on failure
|
|
||||||
function mcl_particles.add_node_particlespawner(pos, particlespawner_definition, level)
|
|
||||||
if allowed_level == 0 or levels[level] > allowed_level then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local poshash = hash_node_position(pos)
|
|
||||||
if not poshash then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local id = add_particlespawner(particlespawner_definition)
|
|
||||||
if id == -1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if not particle_nodes[poshash] then
|
|
||||||
particle_nodes[poshash] = {}
|
|
||||||
end
|
|
||||||
table.insert(particle_nodes[poshash], id)
|
|
||||||
return id
|
|
||||||
end
|
|
||||||
|
|
||||||
local add_node_particlespawner = mcl_particles.add_node_particlespawner
|
|
||||||
|
|
||||||
-- Deletes all particlespawners that are assigned to a node position.
|
|
||||||
-- If no particlespawners exist for this position, nothing happens.
|
|
||||||
-- pos: Node positon. MUST use integer values!
|
|
||||||
-- Returns true if particlespawner could be removed and false if not
|
|
||||||
function mcl_particles.delete_node_particlespawners(pos)
|
|
||||||
if allowed_level == 0 then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
local poshash = hash_node_position(pos)
|
|
||||||
local ids = particle_nodes[poshash]
|
|
||||||
if ids then
|
|
||||||
for i=1, #ids do
|
|
||||||
delete_particlespawner(ids[i])
|
|
||||||
end
|
|
||||||
particle_nodes[poshash] = nil
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 3 exptime variants because the animation is not tied to particle expiration time.
|
|
||||||
-- 3 colorized variants to imitate minecraft's
|
|
||||||
local smoke_pdef_cached = {}
|
|
||||||
|
|
||||||
function mcl_particles.spawn_smoke(pos, name, smoke_pdef_base)
|
|
||||||
local new_minpos = vector.add(pos, smoke_pdef_base.minrelpos)
|
|
||||||
local new_maxpos = vector.add(pos, smoke_pdef_base.maxrelpos)
|
|
||||||
|
|
||||||
-- populate the cache
|
|
||||||
if smoke_pdef_cached[name] then
|
|
||||||
for i, smoke_pdef in ipairs(smoke_pdef_cached[name]) do
|
|
||||||
smoke_pdef.minpos = new_minpos
|
|
||||||
smoke_pdef.maxpos = new_maxpos
|
|
||||||
add_node_particlespawner(pos, smoke_pdef, "high")
|
|
||||||
end
|
|
||||||
-- cache already populated
|
|
||||||
else
|
|
||||||
smoke_pdef_cached[name] = {}
|
|
||||||
|
|
||||||
local smoke_pdef = table.copy(smoke_pdef_base)
|
|
||||||
smoke_pdef.amount = smoke_pdef_base.amount / 9
|
|
||||||
smoke_pdef.time = 0
|
|
||||||
smoke_pdef.animation = {
|
|
||||||
type = "vertical_frames",
|
|
||||||
aspect_w = 8,
|
|
||||||
aspect_h = 8,
|
|
||||||
-- length = 3 exptime variants
|
|
||||||
}
|
|
||||||
smoke_pdef.collisiondetection = true
|
|
||||||
smoke_pdef.minpos = new_minpos
|
|
||||||
smoke_pdef.maxpos = new_maxpos
|
|
||||||
|
|
||||||
-- the last frame plays for 1/8 * N seconds, so we can take advantage of it
|
|
||||||
-- to have varying exptime for each variant.
|
|
||||||
local exptimes = { 0.175, 0.375, 1.0 }
|
|
||||||
local colorizes = { "199", "209", "243" } -- round(78%, 82%, 90% of 256) - 1
|
|
||||||
|
|
||||||
for _,exptime in ipairs(exptimes) do
|
|
||||||
for _,colorize in ipairs(colorizes) do
|
|
||||||
smoke_pdef.maxexptime = exptime * smoke_pdef_base.maxexptime
|
|
||||||
smoke_pdef.animation.length = exptime + 0.1
|
|
||||||
-- minexptime must be set such that the last frame is actully rendered,
|
|
||||||
-- even if its very short. Larger exptime -> larger range
|
|
||||||
smoke_pdef.minexptime = math.min(exptime, (7.0/8.0 * (exptime + 0.1) + 0.1))
|
|
||||||
smoke_pdef.texture = "mcl_particles_smoke_anim.png^[colorize:#000000:" ..colorize
|
|
||||||
add_node_particlespawner(pos, smoke_pdef, "high")
|
|
||||||
table.insert(smoke_pdef_cached[name], table.copy(smoke_pdef))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,3 +0,0 @@
|
||||||
name = mcl_particles
|
|
||||||
author = Wuzzy
|
|
||||||
description = Contains particle images of MineClone 2. No code.
|
|
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 126 B |
Before Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 91 B |
Before Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 145 B |
Before Width: | Height: | Size: 125 B |
Before Width: | Height: | Size: 183 B |
Before Width: | Height: | Size: 262 B |
Before Width: | Height: | Size: 126 B |
Before Width: | Height: | Size: 126 B |
Before Width: | Height: | Size: 216 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 101 B |
Before Width: | Height: | Size: 148 B |
Before Width: | Height: | Size: 154 B |
Before Width: | Height: | Size: 155 B |
Before Width: | Height: | Size: 165 B |
|
@ -1,97 +0,0 @@
|
||||||
Licenses of sounds
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
|
||||||
http://creativecommons.org/licenses/by-sa/3.0/
|
|
||||||
|
|
||||||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
|
||||||
http://creativecommons.org/licenses/by-sa/4.0/
|
|
||||||
|
|
||||||
Creative Commons Attribution 3.0 Unported (CC BY-SA 3.0)
|
|
||||||
http://creativecommons.org/licenses/by/3.0/
|
|
||||||
|
|
||||||
Glass breaking sounds (CC BY 3.0):
|
|
||||||
1: http://www.freesound.org/people/cmusounddesign/sounds/71947/
|
|
||||||
2: http://www.freesound.org/people/Tomlija/sounds/97669/
|
|
||||||
3: http://www.freesound.org/people/lsprice/sounds/88808/
|
|
||||||
|
|
||||||
default_tool_breaks.ogg by EdgardEdition (CC BY 3.0), http://www.freesound.org/people/EdgardEdition
|
|
||||||
|
|
||||||
Mito551 (sounds) (CC BY-SA 3.0):
|
|
||||||
default_dig_choppy.ogg
|
|
||||||
default_dig_cracky.ogg
|
|
||||||
default_dig_crumbly.1.ogg
|
|
||||||
default_dig_crumbly.2.ogg
|
|
||||||
default_dig_oddly_breakable_by_hand.ogg
|
|
||||||
default_dug_node.1.ogg
|
|
||||||
default_dug_node.2.ogg
|
|
||||||
default_grass_footstep.1.ogg
|
|
||||||
default_grass_footstep.2.ogg
|
|
||||||
default_grass_footstep.3.ogg
|
|
||||||
default_gravel_footstep.1.ogg
|
|
||||||
default_gravel_footstep.2.ogg
|
|
||||||
default_gravel_footstep.3.ogg
|
|
||||||
default_gravel_footstep.4.ogg
|
|
||||||
default_grass_footstep.1.ogg
|
|
||||||
default_place_node.1.ogg
|
|
||||||
default_place_node.2.ogg
|
|
||||||
default_place_node.3.ogg
|
|
||||||
default_place_node_hard.1.ogg
|
|
||||||
default_place_node_hard.2.ogg
|
|
||||||
default_hard_footstep.1.ogg
|
|
||||||
default_hard_footstep.2.ogg
|
|
||||||
default_hard_footstep.3.ogg
|
|
||||||
default_sand_footstep.1.ogg
|
|
||||||
default_sand_footstep.2.ogg
|
|
||||||
default_wood_footstep.1.ogg
|
|
||||||
default_wood_footstep.2.ogg
|
|
||||||
default_dirt_footstep.1.ogg
|
|
||||||
default_dirt_footstep.2.ogg
|
|
||||||
default_glass_footstep.ogg
|
|
||||||
|
|
||||||
Metal sounds:
|
|
||||||
default_dig_metal.ogg - yadronoff - CC-BY-3.0
|
|
||||||
- https://www.freesound.org/people/yadronoff/sounds/320397/
|
|
||||||
default_dug_metal.*.ogg - Iwan Gabovitch - qubodup - CC0
|
|
||||||
- http://opengameart.org/users/qubodup
|
|
||||||
default_metal_footstep.*.ogg - Ottomaani138 - CC0
|
|
||||||
- https://www.freesound.org/people/Ottomaani138/sounds/232692/
|
|
||||||
default_place_node_metal.*.ogg - Ogrebane - CC0
|
|
||||||
- http://opengameart.org/content/wood-and-metal-sound-effects-volume-2
|
|
||||||
|
|
||||||
AGFX (CC BY 3.0)
|
|
||||||
https://www.freesound.org/people/AGFX/packs/1253/
|
|
||||||
default_water_footstep.1.ogg
|
|
||||||
default_water_footstep.2.ogg
|
|
||||||
default_water_footstep.3.ogg
|
|
||||||
(default_water_footstep.4.ogg is silent)
|
|
||||||
|
|
||||||
blukotek (CC0 1.0)
|
|
||||||
https://www.freesound.org/people/blukotek/sounds/251660/
|
|
||||||
default_dig_snappy.ogg
|
|
||||||
|
|
||||||
sonictechtonic (CC BY 3.0)
|
|
||||||
https://www.freesound.org/people/sonictechtonic/sounds/241872/
|
|
||||||
player_damage.ogg
|
|
||||||
|
|
||||||
Voxelands project <http://www.voxelands.com/> (CC BY-SA 3.0)
|
|
||||||
mcl_sounds_place_node_water.ogg
|
|
||||||
mcl_sounds_dug_water.ogg
|
|
||||||
|
|
||||||
(Note: Artists from the Voxelands project include: sdzen, darkrose, sapier,
|
|
||||||
Tom Peter, Telaron, juskiddink)
|
|
||||||
|
|
||||||
Michel Baradari <https://opengameart.org/content/lava-splash> (CC BY 3.0)
|
|
||||||
|
|
||||||
default_place_node_lava.ogg
|
|
||||||
|
|
||||||
Adam_N (CC0 1.0):
|
|
||||||
player_falling_damage.ogg
|
|
||||||
Source: <https://www.freesound.org/people/Adam_N/sounds/346692/>
|
|
||||||
|
|
||||||
Alecia Shepherd (CC BY-SA 4.0):
|
|
||||||
mcl_sounds_cloth.ogg
|
|
||||||
Source: SnowSong sound and music pack <https://opengameart.org/content/snowsong-sound-and-music-pack>
|
|
||||||
|
|
||||||
Unknown authors (WTFPL):
|
|
||||||
pedology_snow_soft_footstep.*.ogg
|
|
|
@ -1,168 +0,0 @@
|
||||||
--
|
|
||||||
-- Sounds
|
|
||||||
--
|
|
||||||
|
|
||||||
mcl_sounds = {}
|
|
||||||
|
|
||||||
function mcl_sounds.node_sound_defaults(table)
|
|
||||||
table = table or {}
|
|
||||||
table.footstep = table.footstep or
|
|
||||||
{name="", gain=1.0}
|
|
||||||
table.dug = table.dug or
|
|
||||||
{name="default_dug_node", gain=0.25}
|
|
||||||
table.dig = table.dig or
|
|
||||||
{name="default_dig_oddly_breakable_by_hand", gain=1.0}
|
|
||||||
table.place = table.place or
|
|
||||||
{name="default_place_node_hard", gain=1.0}
|
|
||||||
return table
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_sounds.node_sound_stone_defaults(table)
|
|
||||||
table = table or {}
|
|
||||||
table.footstep = table.footstep or
|
|
||||||
{name="default_hard_footstep", gain=0.5}
|
|
||||||
table.dug = table.dug or
|
|
||||||
{name="default_hard_footstep", gain=1.0}
|
|
||||||
table.dig = table.dig or
|
|
||||||
{name="default_dig_cracky", gain=1.0}
|
|
||||||
mcl_sounds.node_sound_defaults(table)
|
|
||||||
return table
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_sounds.node_sound_metal_defaults(table)
|
|
||||||
table = table or {}
|
|
||||||
table.footstep = table.footstep or
|
|
||||||
{name="default_metal_footstep", gain=0.5}
|
|
||||||
table.dug = table.dug or
|
|
||||||
{name="default_dug_metal", gain=1.0}
|
|
||||||
table.dig = table.dig or
|
|
||||||
{name="default_dig_metal", gain=1.0}
|
|
||||||
table.place = table.place or
|
|
||||||
{name="default_place_node_metal", gain=1.0}
|
|
||||||
mcl_sounds.node_sound_defaults(table)
|
|
||||||
return table
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_sounds.node_sound_dirt_defaults(table)
|
|
||||||
table = table or {}
|
|
||||||
table.footstep = table.footstep or
|
|
||||||
{name="default_dirt_footstep", gain=1.0}
|
|
||||||
table.dug = table.dug or
|
|
||||||
{name="default_dirt_footstep", gain=1.5}
|
|
||||||
table.dig = table.dig or
|
|
||||||
{name="default_dig_crumbly", gain=1.0}
|
|
||||||
table.place = table.place or
|
|
||||||
{name="default_place_node", gain=1.0}
|
|
||||||
mcl_sounds.node_sound_defaults(table)
|
|
||||||
return table
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_sounds.node_sound_sand_defaults(table)
|
|
||||||
table = table or {}
|
|
||||||
table.footstep = table.footstep or
|
|
||||||
{name="default_sand_footstep", gain=0.5}
|
|
||||||
table.dug = table.dug or
|
|
||||||
{name="default_sand_footstep", gain=1.0}
|
|
||||||
table.dig = table.dig or
|
|
||||||
{name="default_dig_crumbly", gain=1.0}
|
|
||||||
table.place = table.place or
|
|
||||||
{name="default_place_node", gain=1.0}
|
|
||||||
mcl_sounds.node_sound_defaults(table)
|
|
||||||
return table
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_sounds.node_sound_snow_defaults(table)
|
|
||||||
table = table or {}
|
|
||||||
table.footstep = table.footstep or
|
|
||||||
{name="pedology_snow_soft_footstep", gain=0.5}
|
|
||||||
table.dug = table.dug or
|
|
||||||
{name="pedology_snow_soft_footstep", gain=1.0}
|
|
||||||
table.dig = table.dig or
|
|
||||||
{name="default_dig_crumbly", gain=1.0}
|
|
||||||
table.place = table.place or
|
|
||||||
{name="default_place_node", gain=1.0}
|
|
||||||
mcl_sounds.node_sound_defaults(table)
|
|
||||||
return table
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_sounds.node_sound_wood_defaults(table)
|
|
||||||
table = table or {}
|
|
||||||
table.footstep = table.footstep or
|
|
||||||
{name="default_wood_footstep", gain=0.5}
|
|
||||||
table.dug = table.dug or
|
|
||||||
{name="default_wood_footstep", gain=1.0}
|
|
||||||
table.dig = table.dig or
|
|
||||||
{name="default_dig_choppy", gain=1.0}
|
|
||||||
mcl_sounds.node_sound_defaults(table)
|
|
||||||
return table
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_sounds.node_sound_wool_defaults(table)
|
|
||||||
table = table or {}
|
|
||||||
table.footstep = table.footstep or
|
|
||||||
{name="mcl_sounds_cloth", gain=0.5}
|
|
||||||
table.dug = table.dug or
|
|
||||||
{name="mcl_sounds_cloth", gain=1.0}
|
|
||||||
table.dig = table.dig or
|
|
||||||
{name="mcl_sounds_cloth", gain=0.9}
|
|
||||||
table.place = table.dig or
|
|
||||||
{name="mcl_sounds_cloth", gain=1.0}
|
|
||||||
mcl_sounds.node_sound_defaults(table)
|
|
||||||
return table
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_sounds.node_sound_leaves_defaults(table)
|
|
||||||
table = table or {}
|
|
||||||
table.footstep = table.footstep or
|
|
||||||
{name="default_grass_footstep", gain=0.1325}
|
|
||||||
table.dug = table.dug or
|
|
||||||
{name="default_grass_footstep", gain=0.425}
|
|
||||||
table.dig = table.dig or
|
|
||||||
{name="default_dig_snappy", gain=0.4}
|
|
||||||
table.place = table.place or
|
|
||||||
{name="default_place_node", gain=1.0}
|
|
||||||
mcl_sounds.node_sound_defaults(table)
|
|
||||||
return table
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_sounds.node_sound_glass_defaults(table)
|
|
||||||
table = table or {}
|
|
||||||
table.footstep = table.footstep or
|
|
||||||
{name="default_glass_footstep", gain=0.5}
|
|
||||||
table.dug = table.dug or
|
|
||||||
{name="default_break_glass", gain=1.0}
|
|
||||||
table.dig = table.dig or
|
|
||||||
{name="default_dig_cracky", gain=1.0}
|
|
||||||
mcl_sounds.node_sound_defaults(table)
|
|
||||||
return table
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_sounds.node_sound_water_defaults(table)
|
|
||||||
table = table or {}
|
|
||||||
table.footstep = table.footstep or
|
|
||||||
{name = "default_water_footstep", gain = 0.2}
|
|
||||||
table.place = table.place or
|
|
||||||
{name = "mcl_sounds_place_node_water", gain = 1.0}
|
|
||||||
table.dug = table.dug or
|
|
||||||
{name = "mcl_sounds_dug_water", gain = 1.0}
|
|
||||||
mcl_sounds.node_sound_defaults(table)
|
|
||||||
return table
|
|
||||||
end
|
|
||||||
|
|
||||||
function mcl_sounds.node_sound_lava_defaults(table)
|
|
||||||
table = table or {}
|
|
||||||
-- TODO: Footstep
|
|
||||||
table.place = table.place or
|
|
||||||
{name = "default_place_node_lava", gain = 1.0}
|
|
||||||
table.dug = table.dug or
|
|
||||||
{name = "default_place_node_lava", gain = 1.0}
|
|
||||||
-- TODO: Different dug sound
|
|
||||||
mcl_sounds.node_sound_defaults(table)
|
|
||||||
return table
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Player death sound
|
|
||||||
minetest.register_on_dieplayer(function(player)
|
|
||||||
-- TODO: Add separate death sound
|
|
||||||
minetest.sound_play({name="player_damage", gain = 1.0}, {pos=player:get_pos(), max_hear_distance=16}, true)
|
|
||||||
end)
|
|
|
@ -1,3 +0,0 @@
|
||||||
name = mcl_sounds
|
|
||||||
author = Wuzzy
|
|
||||||
description = This mod contains the core sounds of MineClone 2 as well as helper function for mods to access them.
|
|