Page MenuHomeWildfire Games

Allow modders to let buildings spawn buildings.
Needs ReviewPublic

Authored by Freagarach on Mar 21 2020, 4:34 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Summary

Currently the spawn point of an entity is calculated using its unit motion component. This prevents modders to spawn buildings, which is not nice.
This patch let spawned entities use the "default" passability class as default and if the entity has UM, use that.

The GetUnitRadius was introduced in rP7484 and the passability class in rP9970.

Test Plan

Should have no effect on vanilla, but check out the CC spawning a house :)

Event Timeline

Freagarach created this revision.Mar 21 2020, 4:34 PM
Owners added subscribers: Restricted Owners Package, Restricted Owners Package.Mar 21 2020, 4:34 PM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/simulation2/components/CCmpFootprint.cpp
|   1| /*·Copyright·(C)·2018·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2020" year instead of "2018"
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1874/display/redirect

Freagarach added inline comments.Mar 21 2020, 5:02 PM
source/simulation2/components/CCmpFootprint.cpp
1

+2

Interesting diff. What kind of gameplay feature do you envision supporting?

Together with D2658 this could allow forests regrowing. But also things like structure add-ons (cf. Terran in Starcraft).

Nescio added a subscriber: Nescio.Apr 4 2020, 12:16 PM

Or building a farmstead will spawn fields around it?

myou5e added a subscriber: myou5e.Aug 16 2020, 5:13 PM

Together with D2658 this could allow forests regrowing. But also things like structure add-ons (cf. Terran in Starcraft).

I thought about doing this with a blacksmith added to a barracks. Another one might be turrets or siege weapons added to walls. But perhaps that would be under entity upgrade or as a garrison?

bb added a subscriber: bb.Sep 6 2020, 9:44 PM

This patch allows buildings to be build too close to other buildings, outside territory and everything else that buildRestrictions forbids. We should somehow reuse that code here too.

Out of scope/irrelevant comment:
This patch highlights an issue in the current template shema's: I have found two places where passability is defined. Namely buildrestriction and unitmotion (if there are more please let me know). These can be totally independent, which can cause problems on its own: a buildable unit with unitmotion (nothing fancy here), can be build only on land and move only in sea. Since we can't paint terrain (yet), this unit is completely unmoveable. This seems weird. On the other hand it might make sortof sense for ships, build them on the shore and use them in water. (Might need some way to transfer them into the water).