Allow merging Force fields to make larger custom shapes
Right now the force field is limited due to it only being able to cover either a square or spherical area. Also it can only be provided by a single node which means that if it is destroyed all shields are lost.
Instead, it would nice to be able to merge fields to make a one big field. The actual merger would only work if the two fields were perfectly aligned. The idea is that any surface where two fields touch would just become air.
To keep this from being abused a shared secret could be used. Anyone on the outside couldn't extend the field unless they know the key. For added security this key could be rotated with digilines.
To keep this from being abused a shared secret could be used. Anyone on the outside couldn't extend the field unless they know the key. For added security this key could be rotated with digilines.
in star trek/wars speak that would be "shield harmonics" or something like that :)
Are you aware of any 3d libraries (lua i guess) that can handle merging geometries in that way? Otherwise it would get pretty complex to get that right :thinking:
Are you sure this would need that much geometry calculations? My thought is that it might be possible to merge force fields right after creation. Basically anywhere that shields overlap would become air. This would require that the shields be perfectly lined up but I don't think that's to much to ask.
It's way more complicated than you think; for two cube force fields on a single axis it's not too hard, but anything more than that and it gets very complex very quickly, which is probably the reason it hasn't been implemented yet. https://github.com/mt-mods/technic/blob/9ed03b8b2bb9221442ae16c24ae93a1a706b282a/technic/machines/HV/forcefield.lua#L40-L45
Maybe a simpler and more versatile option could be to make the force field shapes customizable by length/width/height. Something similar was also planned for the jumpdrive mod: https://github.com/mt-mods/jumpdrive/issues/68
I would recommend against generic 3d libraries for merging, this does not really need full 3d shape merges.
Instead I would suggest simplifying it quite a lot and instead of merges rely on way simpler boundary cutters while building fields. This wont allow any shape but we don't really need any shape, these are always relatively simple shapes like spheres or boxes.
Cutter could even be positioned depending on shield generator power to give nice effect for both compatible "friendly" fields and incompatible "hostile" fields depending on their strengths.