No, gateways do not need to be range-limited. But the option to allow that should exist.
Right now, gateways have unlimited range. Which is fine by me as a player, but when modding this poses problems when I try to find ways to limit the range of gateways through triggers (to make them function more like mass relays - yes I was thinking about the short-ranged omnidirectional relays). The issue has to do with this:
The three scopes available (this, root, and from; root seems to be the same as this) are all countries, which is useless because the departure and arrival systems cannot be used. Without the latter, I cannot use the distance function to check the distances, thus preventing me from being able to effectively set gateway range.
The alternative would be to use the on_action, which on the surface has enough information: this is the current fleet, from is the arrival system, and fromfrom is the departure one. But there, too, are problems:
This is less AI pathfinding-screwy, but unless the fleet drops into a hostile system or a system nearby one, the event lock is basically a slap in the wrist as it only lasts at worst half a year. Not what I prefer, but it is thus far the only solution without borking the AI.
A simple fix that would enable more coding options would be to change country_can_use's three scopes to departure system for this and root and arrival system for from. The vanilla code would become this:
This allows vanilla game to keep unlimited range bypasses while allowing modders to do interesting things, such as writing code to effectively set gateway range, like this:
This should not be a hard change... unless changing this borks several functions...
Right now, gateways have unlimited range. Which is fine by me as a player, but when modding this poses problems when I try to find ways to limit the range of gateways through triggers (to make them function more like mass relays - yes I was thinking about the short-ranged omnidirectional relays). The issue has to do with this:
Code:
country_can_use = {
custom_tooltip = {
fail_text = GATEWAY_COUNTRY_CANNOT_USE
OR = {
NOT = { exists = from }
from = {
NOR = {
has_closed_borders = root
is_hostile = root
}
}
}
}
}
The three scopes available (this, root, and from; root seems to be the same as this) are all countries, which is useless because the departure and arrival systems cannot be used. Without the latter, I cannot use the distance function to check the distances, thus preventing me from being able to effectively set gateway range.
The alternative would be to use the on_action, which on the surface has enough information: this is the current fleet, from is the arrival system, and fromfrom is the departure one. But there, too, are problems:
- The event happens after the bypass is complete. Which can seriously screw up AI pathfinding if I, say, sets the location of this to fromfrom...
- Only... that does not even seem to work! I thought it was originally a parsing error (which happens to me, a lot), but the error log says otherwise. So I have this alternative code:
Code:
fleet_event = {
id = ftl.1
hide_window = yes
is_triggered_only = yes
trigger = {
NOT = { distance = {
source = FromFrom
min_distance = 0
max_distance = 50
} }
}
immediate = {
clear_fleet_actions = this
set_event_locked = yes
fleet_event = { id = ftl.2 }
}
}
fleet_event = {
id = ftl.2
title = ftl.2.name
desc = ftl.2.desc
picture = GFX_evt_star_chart
show_sound = event_ship_bridge
location = this
is_triggered_only = yes
immediate = {
fleet_event = { id = ftl.3 days = 30 random = 150 }
}
option = {
name = UNFORTUNATE
}
}
fleet_event = {
id = ftl.3
hide_window = yes
is_triggered_only = yes
immediate = {
set_event_locked = no
}
}
A simple fix that would enable more coding options would be to change country_can_use's three scopes to departure system for this and root and arrival system for from. The vanilla code would become this:
Code:
country_can_use = {
custom_tooltip = {
fail_text = GATEWAY_COUNTRY_CANNOT_USE
OR = {
NOT = { exists = from.owner }
from.owner = {
NOR = {
has_closed_borders = root.owner
is_hostile = root.owner
}
}
}
}
}
This allows vanilla game to keep unlimited range bypasses while allowing modders to do interesting things, such as writing code to effectively set gateway range, like this:
Code:
country_can_use = {
custom_tooltip = {
fail_text = GATEWAY_COUNTRY_CANNOT_USE
OR = {
NOT = { exists = from.owner }
from.owner = {
NOR = {
has_closed_borders = root.owner
is_hostile = root.owner
}
}
}
}
custom_tooltip = {
fail_text = GATEWAY_OUT_OF_RANGE
NOT = {
distance = {
source = from
min_distance = 0
max_distance = 50
}
}
}
}
This should not be a hard change... unless changing this borks several functions...
Upvote
0