Author Topic: [DONE][Suggestion] Possibility to choose groups in addLine mapScript command  (Read 3775 times)

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
We are making rather complicated terrain with roads moved to different terrain, so we add them with mapscript like that:
Code: [Select]
    - type: addLine
      label: 100
      terrain: URBAN_ROADS
      direction: vertical
We have a lot of interesting ideas for the roads - highways, railroads, etc, but we can't mix different type of roads into one terrain. So we need one terrain for ground roads, one for highway, and if we want to make crossroads with different type of roads - railroad under the highway, we need separate terrain for any possible combination, in order to make sure that addLine command will choose blocks of only one needed type per line. So, it would be very practical for mod developing to have an option to choose groups for addLine.
« Last Edit: January 11, 2020, 11:35:28 am by Meridian »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11732
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [SUGGESTION] Possibility to choose groups in addLine mapScript command
« Reply #1 on: January 06, 2020, 08:02:14 pm »
I wholeheartedly support this idea in the name of free road/highway intersections.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9106
    • View Profile
Re: [SUGGESTION] Possibility to choose groups in addLine mapScript command
« Reply #2 on: January 07, 2020, 04:47:29 pm »
Seems to be trivial to add.
in BattlescapeGenerator::addLine()

How about you try locally and PR it when tested and working...

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [SUGGESTION] Possibility to choose groups in addLine mapScript command
« Reply #3 on: January 07, 2020, 05:24:57 pm »
I think it would be easy to add, but there's the difficulty of how it should handle an addLine with "direction: both" - should the group(s) you defined be applied to the vertical part of the line, the horizontal part of the line, or the crossing part?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9106
    • View Profile
Re: [SUGGESTION] Possibility to choose groups in addLine mapScript command
« Reply #4 on: January 07, 2020, 05:50:03 pm »
I think it would be easy to add, but there's the difficulty of how it should handle an addLine with "direction: both" - should the group(s) you defined be applied to the vertical part of the line, the horizontal part of the line, or the crossing part?

You need to send 3 parameters in such case (direction both), 1 for each group.
In other cases (direction vertical or horizontal), you need to send 2 parameters (one for direction group and one for crossing group).

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: [SUGGESTION] Possibility to choose groups in addLine mapScript command
« Reply #5 on: January 10, 2020, 02:22:54 am »
https://github.com/MeridianOXC/OpenXcom/pull/33

I hoped I will manage to make its step size moddable (not hardcoded 10) but for now no visible progress on that. sample mod for testing is attached.

btw, I noticed that lines tend to stick to lower boundaries, but it can't see if my code affects that.

Offline davide

  • Commander
  • *****
  • Posts: 565
    • View Profile
Re: [SUGGESTION] Possibility to choose groups in addLine mapScript command
« Reply #6 on: January 10, 2020, 08:52:14 am »
I remember a very old outdated thread about multi-line map design:
https://openxcom.org/forum/index.php/topic,2934.0.html

Original "Siberia" terrain from ufo2k (cross-line)



and "normandy" terrain from ufo2k (parallel ordered line)





Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: [SUGGESTION] Possibility to choose groups in addLine mapScript command
« Reply #7 on: January 10, 2020, 10:01:16 am »
For Normandy, I'd use regular addBlock as it is very limited with rects, but can use 20x20 blocks. As every line is solid defined with rects I see no big difference. But for things with several lines that should be mixed it could be handy