New prototype "simple-placement-proxy"

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

New prototype "simple-placement-proxy"

Post by eradicator »

(Disclaimer: This is sort of a preliminary modding-interface-request draft. Not sure if this should go in modding discussion or suggestions... moderators feel free to move :P)
What?
A new mod-only prototype (like the electric-energy-interface) that can be used by modders to make custom placement-only entities that can be used in cases where the modder needs to show additional data only during placement of an entity.
Details
Often times when i try to implement a somewhat non-standard "building" that requires for example several invisble co-entities it would be very nice to have the possibility of showing some additional data like a radius visualization to the player. Even though the "main" entity of the multi-entity "building" does not have a radius capability or similar. The simple-placement-entity would then be used as a "place_result" for the building-item and be script-replaced (or built-in replaced! :D) by the actual entity that is used in-world.

My wishlist for the functionality of such placement-entity:
  • Rotatability: Support for at least 4, if possible 8 placement directions to give the player a good idea of how the entity will be placed.
  • Radius Visualization: Ability to show an arbitrary sized square, circle, or "pixelated-circle" (a circle approximated with tiles, so it is obvious which border tiles are affected) visualization before placement that tells the player how large an area the entity will have an effect on.
  • Placement limitations (entities): Ability to specify restricted placement rules such as "can only be placed on ore/trees/rocks (of category X)" - like a mining drill but more versatile.
  • Placement limitations (tiles): Ability to specify (similar to the offshore pump) that the entity can only be placed on certain tiles or tile combinations, e.g. "can only be placed on sand", or "can only be placed if there is at least one tile of each "sand","grass" and "water" inside the collision box".
  • Placement limitation (proximity): Ability to specify a prototype name and a radius. Then limit the ability to construct additional buildings to either insider or outside that radius.
  • Replace-on-Construction (optional): When a simple-placement-entity is constructed it is automatically replaced by a different prespecified entity (i.e. the "actual" building) and on_*_built event is only raised for the "actual" entity.
  • Blueprint compatibility: When placing blueprints the above limitations and visualizations should also apply.
Examples
  • Sandpit (radius visualization+placement limitation): An assmebler prototype entity that extracts sand from the desert. Could now be enforced to be only placeable on desert tiles.
  • Forester (radius visualization): A building that replants forest in a certain radius around itself. (Though in this case it would be even nicer if the radius of already existing buildings was also shown when placing new buildings...)
  • Wind Turbine (radius limitation): Wind turbines in real life affect each other, so it should not be possible to place them within a minimum distance to each other.
  • (more good examples?)
Thoughts? Comments?
I'd like to know what other modders/devs think of this idea. Would this be useful to anybody else except me? Should it have any additional functionality (i'll update the main post if anything good pops up)? How realistically would this ever be implemented? ;P etcpp.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Post Reply

Return to “Modding discussion”