FreeOrion

Forums for the FreeOrion project
It is currently Thu Dec 14, 2017 12:25 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Thu Aug 25, 2016 2:24 pm 
Offline
Release Manager, Design
User avatar

Joined: Wed Nov 16, 2011 12:56 pm
Posts: 4289
Location: Sol III
When tinkering around with the Planetary Starlane Drive (testing PR#869 and trying to come up with a fix for issue#917) I came across two issues. The first one is that you can build a Planetary Beacon in the same system as a planet with the PSD + corresponding focus setting, which will cause the planet to travel to the system it is already in. Not a big thing, but still shouldn't be possible. Looking at the code of the PSD focus, the reason seems obvious:
Code:
        EffectsGroup
            scope = Source
            activation = And [
                Planet
                Focus type = "FOCUS_PLANET_DRIVE"
                Or [
                WithinStarlaneJumps jumps = 1 condition = Building name = "BLD_PLANET_BEACON"
                WithinStarlaneJumps jumps = 1 condition = Contains And [
                    Ship
                    OwnedBy empire = Source.Owner
                    DesignHasPart low = 1 high = 999 name = "SP_PLANET_BEACON"
                    Turn low = LocalCandidate.ArrivedOnTurn + 1
                    ]
                ]
            ]
            effects = [
                MoveTo destination = And [
                    OwnedBy empire = Source.Owner
                    WithinStarlaneJumps jumps = 1 condition = Source
                    Contains Or [
                        And [
                            Building name = "BLD_PLANET_BEACON"
                            OwnedBy empire = Source.Owner
                        ]
                        And [
                            Ship
                            OwnedBy empire = Source.Owner
                            DesignHasPart low = 1 high = 999 name = "SP_PLANET_BEACON"
                        ]
                    ]
                ]
                GenerateSitRepMessage
                        message = "EFFECT_PLANET_DRIVE"
                        label = "EFFECT_PLANET_DRIVE_LABEL"
                    icon = "icons/building/planetary_stardrive.png"
                        parameters = [
                                tag = "planet" data = Source.ID
                                tag = "system" data = Source.SystemID
                        ]
                        empire = Source.Owner
                SetPopulation value = Value / 2
            ]
The activation condition as well as the destination condition of the MoveTo effect both check for Planetary Beacons within 1 jump or less. I assume that can be fixed by changing "jumps = 1" to "jumps = low = 1 high = 1" - does "jumps" accept that syntax?

Second issue: In the destination condition of the MoveTo effect the owner of the Planetary Beacon building is checked, but not in the activation condition. Shouldn't these two match (after all, the owner of the ship based Planetary Beacon does get checked in both conditions)?


Top
 Profile  
 
PostPosted: Thu Aug 25, 2016 3:50 pm 
Offline
Creative Contributor
User avatar

Joined: Fri Jun 28, 2013 11:45 pm
Posts: 3291
To be honest, I'd be tempted to scrap the building beacon completely, it wasn't (IIRC) intended as a permanent thing it was added as there wasn't a better way to target the location planned, the ship works better overall. In addition, it doesn't combo well if you're using the Transformer instead of the Drive building, if you use the latter it blows itself up but I could never get it to work with the former when I was messing around updating it.

And I never noticed the whole 'can move to the same place' issue, weird, no idea what Jumps will or won't accept, it ought to if it doesn't already.

_________________
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.


Top
 Profile  
 
PostPosted: Thu Aug 25, 2016 3:52 pm 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12041
Location: Munich
Vezzra wrote:
I assume that can be fixed by changing "jumps = 1" to "jumps = low = 1 high = 1" - does "jumps" accept that syntax?
I don't think anything would accept that. You probably want to add additional conditions like Not And [InSystem InSystem id = Source.SystemId] or similar.


Top
 Profile  
 
PostPosted: Thu Aug 25, 2016 8:53 pm 
Offline
Release Manager, Design
User avatar

Joined: Wed Nov 16, 2011 12:56 pm
Posts: 4289
Location: Sol III
Found another issue, the activation condition of the effectsgroup handling the potential destruction of the moved planet if no Interstellar Lighthouse is near apparently hasn't been adjusted for the Planetary Beacon ship part. It only checked for planets moved by a Planetary Beacon building.

I ended up doing a major rewrite of the thing. Fix pushed: e017c3f


Top
 Profile  
 
PostPosted: Thu Aug 25, 2016 9:05 pm 
Offline
Creative Contributor
User avatar

Joined: Fri Jun 28, 2013 11:45 pm
Posts: 3291
Vezzra wrote:
Found another issue, the activation condition of the effectsgroup handling the potential destruction of the moved planet if no Interstellar Lighthouse is near apparently hasn't been adjusted for the Planetary Beacon ship part. It only checked for planets moved by a Planetary Beacon building.

That's weird, I am certain I tested that it still blew up without one when I wrote it, must've got lost in one of the rewrties/reverts that ended up happening, good catch, thanks.
Quote:
I ended up doing a major rewrite of the thing. Fix pushed: e017c3f

Now that's a lot more elegant than my code, and easier to read for the next person that wants to mess with it. Cool.

_________________
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group