Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added PlaceBuildingInit. #15040

Merged
merged 1 commit into from Jul 28, 2018

Conversation

Projects
None yet
4 participants
@IceReaper
Copy link
Contributor

IceReaper commented Apr 11, 2018

The basical idea is to know how an actor is build / created. Not just by building it from the ui. I only added this one case, as its the only one i need currently. A crate may spawn an actor. A factory may produce an actor. A building may be placed by the player. It might spawn cause its some kind of reinforcement. The basical idea is to have an actor which may behave differently under certain circumstances, without this feature, the traits will keep triggering equaly.

Example A: Imagine we have an oil tanker vehicle. When it gets produced by a factory, it should wait for its assignment. However, in case B we have an oil derrick, and the vehicle is granted by FreeActor. It should search for the next derrick on spawn and start driving towards it. (kknd logic)

Example B: I have buildings which will build-up themself after placement. However, this would be the general case, all buildings which are spawned by script, unit deployment, or whatever other reason will start to build at this point, consuming money.

@pchote

This comment has been minimized.

Copy link
Member

pchote commented Apr 16, 2018

This feels speculatively general to me - my gut feeling is that this isn't going to get much use outside of your own use case.

I think a better approach may be to define a new IProducedActorInitModifier interface, similar to the existing IDeathActorInitModifier, and then call that from PlaceBuilding, Production and ClonesProducedUnits. This would allow arbitrary other traits to add arbitrary other info, which would be a lot more flexible.

@IceReaper

This comment has been minimized.

Copy link
Contributor Author

IceReaper commented Apr 16, 2018

Sounds good, will do!

@pchote

This comment has been minimized.

Copy link
Member

pchote commented May 20, 2018

Any progress here @IceReaper?

@IceReaper IceReaper force-pushed the IceReaper:CreationCause branch from 965ed38 to 43b94e6 Jun 18, 2018

@IceReaper

This comment has been minimized.

Copy link
Contributor Author

IceReaper commented Jun 18, 2018

Updated!

@IceReaper IceReaper force-pushed the IceReaper:CreationCause branch 2 times, most recently from a2260fb to cab02f9 Jul 22, 2018

@pchote
Copy link
Member

pchote left a comment

Ah... this wasn't what I meant with my suggestion above. My main goal was to avoid magic string constants.

A more straightforward approach might be to define new CreatedFromTransform(ActorInfo fromInfo) and CreatedFromPlaceBuilding(bool lineBuild) Init types that we add by default in these two places. This then allows other actor creation traits to reuse these or add their own.

@IceReaper IceReaper force-pushed the IceReaper:CreationCause branch 2 times, most recently from 0ee5570 to 6fd6819 Jul 26, 2018

@@ -16,6 +16,8 @@

namespace OpenRA.Mods.Common.Traits
{
public class PlaceBuildingInit : IActorInit { }

This comment has been minimized.

@pchote

pchote Jul 26, 2018

Member

Can you please add a comment explaining that this is used by third party mods to distinguish the build source?

@IceReaper IceReaper force-pushed the IceReaper:CreationCause branch from 6fd6819 to 462ab49 Jul 26, 2018

@pchote
Copy link
Member

pchote left a comment

LGTM now.

@pchote pchote changed the title Added CreationCause. Added PlaceBuildingInit. Jul 26, 2018

@IceReaper IceReaper force-pushed the IceReaper:CreationCause branch from 462ab49 to 51ff344 Jul 26, 2018

@IceReaper IceReaper force-pushed the IceReaper:CreationCause branch from 952d8ab to ae4b8c9 Jul 26, 2018

@pchote

pchote approved these changes Jul 28, 2018

@abcdefg30 abcdefg30 merged commit be2c41d into OpenRA:bleed Jul 28, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@GraionDilach
Copy link
Contributor

GraionDilach left a comment

👍

@abcdefg30

This comment has been minimized.

Copy link
Member

abcdefg30 commented Jul 28, 2018

@IceReaper IceReaper deleted the IceReaper:CreationCause branch Jul 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.