Closed tvleest closed 8 years ago
I agree this solves the problem for upgrading :+1:
Don't buildings have an ID as well? I suppose that could also be used instead of the polygon. [edit: apologies for the email formatting]
Thats not how the action currently works in the SDK, it needs a multipolygon.
@EventParamData(desc = "Plan the upgrade of buildings in the given polygon in the MAQUETTE map", params = { "Stakeholder ID", "Upgrade Type ID", "Multipolygon describing the upgrade area" }) @EventIDField(links = { "STAKEHOLDERS", "UPGRADE_TYPES" }, params = { 0, 1 }) BUILDING_PLAN_UPGRADE(ClientTerms.ACTION_LOG_UPGRADE, Integer.class, Integer.class, MultiPolygon.class),
Ah, it is probably possible to upgrade only a part of a building then? That is pretty nice. It is also possible of course to create your own action that fetches the multipolygon for you, having only the buildingID as parameter.
@maxgroenenboom i don't think it is possible to get a result from an action. Correct me if I'm wrong though.
I'm not talking about getting a result from an action? What I mean is defining a new action, that then calls the original action.
@MaxGroenenboom I don't think such an action is possible, because actions are predefined in the environment. By design an agent does an action and then through perceiving the environment next cycle he can deduce what effect is action has. He can't get a response, as spiderbiggen already said.
It might be possible but i don't think that adding a new action is the easiest way to do this.
edit ... that was the wrong button
I think it is pretty easy to do this. I am now building a list of actions the PerformAction function in TygronEntity.java will look through before trying the server actions, thus making it possible to create your own actions, or even override server actions.
Sounds like that might be a better solution.
So, this isn't as easy as it should be, as the PerformAction method isn't called at all when a non-sdk action is called. Even when I add my custom action to the sdk (temporarily, just for testing), it still doesn't work...
Can you push your code to a branch so i can take a look?
Sure, you can find the branch here: https://github.com/Denpeer/tygron/tree/getRelevantAreas Brace yourself, some of it will be very ugly code, it wasn't my intention to publish this :P
Rico has found the cause of the errors, Line 87 in EisEnv.java, I am going to see if I can get it to work now.
We've added multiPolygon to our own fork, so we can at least demo something friday. If other groups are interested we could make a PR out of it. It does use powermockito though. #51 Here is a travis build log https://travis-ci.org/spiderbiggen/tygron/builds/134122390
To be able to upgrade a building we need the multipolygon describing the area of that building.
building(Id, Name, OwnerID, ConstructionYear, Categories, FunctionID, Floors, Multipolygon)
Unless someone has a better solution?