Page 1 of 1

Radius visualisation picture on assembling machine ?

Posted: Wed Jan 30, 2019 4:00 pm
by Perlin
Hello,

Is there a way to display a radius visualisation picture around an assembling machine, the same way mining drills does?

My mod has an assembling machine doing scripted stuff in it's radius, and I would like to display the radius before the entity is placed, or when the entity is clicked.

Thx!

Re: Radius visualisation picture on assembling machine ?

Posted: Sat Dec 19, 2020 4:56 pm
by JonnyOnSeSocks
I was looking for help with radius visualisation as well and found this post.
Maybe you also still need this.

I was able to add a visualisation area by adding the radius_visualisation_specification property to my new assembling-machine prototype like this:

Code: Select all

radius_visualisation_specification = {
    sprite = {
        filename = "__My_Mod__/graphics/entity/test-radius-visualization.png", 
        size = 960
    },
    distance = 10
}
The custom png (just a colored circle) is only needed if you don't want a square area. Otherwise you could also use the default electric-pole or mining-drill visualisation sprites from the base game.
This works fine and displays the area while placing the entity and hovering over a placed entity.

The only problem is that while placing the entity, the red and green "can/can't place" tint also gets applied to the visualisation sprite wich is not the case for all other area visualisations like for turrets or mining-drills. I have tried to add some flags to the sprite but no success sofar :(

Does anyone else know how or even if this placement tint can be deactivated for the radius_visualisation_specification sprite?

Re: Radius visualisation picture on assembling machine ?

Posted: Sat Dec 19, 2020 11:41 pm
by Silari
Mining Drills don't use radius_visualisation_specification, they use a separate radius_visualisation_picture which is unique to the MiningDrill type, which explains why they act different. I don't see anything used for turrets - I'm guessing the game draws it based on the turret's AttackParameters' range value instead.

Couldn't find anything in the Sprite type to stop the tinting - draw_as_shadow TECHNICALLY does stop the red tinting but then it's always tinted like a shadow, so not really useful. This should maybe be made into a modding interface request to have radius_visualisation_specification not be tinted if placement is invalid, to make it behave similarly to mining drills and turrets. Maybe a bool setting in case anyone would ever WANT it tinted? EDIT: It also tints if it's moved out of placement range, which neither mining drills or turrets do.


That said, thanks for posting this, as Homeworld_Redux has a LOT of buildings that rely on scripting in a radius around it, and it's nice to be able to relay those ranges to the user clearly. Already working on an update for it.