MT-CTF / capturetheflag

Capture the Flag game using the Minetest Voxel Engine
https://ctf.rubenwardy.com
83 stars 88 forks source link

Allow custom chests in map with individually defined items. #316

Open ClobberXD opened 5 years ago

ClobberXD commented 5 years ago

Currently, the map-maker doesn't allow nodes with meta as they don't work with schem placement. But this prevents map-makers from incorporating custom chests into maps with custom items that they'd like the player to find (e.g. a PUBG-style item placement system).

Not everything can be placed directly on the map, and neither can such items be strewn across the map as item entities, as they won't be exported along with the schem. To counter this, I propose using a separate file (maybe using a JSON format like mod storage?) that stores the contents of each node-inv in a comma-separated itemstring form, with pos of the chest being the key.

This file will be parsed after the schem is placed, and normal chests (tsm_chests:chest) with the specified items will be placed in the respective positions.

Example file:

{"(100,0,100)":"default:sword_steel,default:dirt 10","(200,10,-100)":"default:leaves 40,default:steel_ingot 10,default:mese_crystal 7"}

Adding support for this in the map-maker is very easy. I can work on this once I'm done with #221.

AKryukov92 commented 5 years ago

Will you mark map-specific chests somehow? I think it is good idea to show players that map-specific chest are not like common random treasures. Tthose chests also should not contains diggable materials (like diamonds or mese) because you can just place them as nodes. Though, I'm not sure that this is something that can be written in the code.

ClobberXD commented 5 years ago

Will you mark map-specific chests somehow? I think it is good idea to show players that map-specific chest are not like common random treasures.

I initially did think about using the same tsm_chests:chest for this, but you have a good point. It has to be distinguishable from the other normal chests.

Tthose chests also should not contains diggable materials (like diamonds or mese) because you can just place them as nodes.

Why though? They can be placed as nodes itself, but then one can't place a full stack of cobbles directly in the world without taking up so much more space, while providing them in chests means that the whole stack of cobbles can fit in one single inventory slot.