Skip to content

Instantly share code, notes, and snippets.

@SamuXarick
SamuXarick / railpathfinder.nut
Created July 4, 2022 14:01
How do I simplify this check?
function Rail::_GetBridgeNumSlopes(end_a, end_b, res = false)
{
local slopes = 0;
local ret = {};
ret.rawset(end_a, 0);
ret.rawset(end_b, 0);
local direction = (end_b - end_a) / AIMap.DistanceManhattan(end_a, end_b);
local slope = AITile.GetSlope(end_a);
if (!(((slope == AITile.SLOPE_NE || slope == AITile.SLOPE_STEEP_N || slope == AITile.SLOPE_STEEP_E) && direction == 1) ||
((slope == AITile.SLOPE_SE || slope == AITile.SLOPE_STEEP_S || slope == AITile.SLOPE_STEEP_E) && direction == -AIMap.GetMapSizeX()) ||
@SamuXarick
SamuXarick / gist:80b449c63b2b752cc8fa1dfd9e668596
Last active January 30, 2019 18:08
AI/GS Config GUI overhaul
==============================================================================================
Editable AI/GS Parameters in the 3 game modes
==============================================================================================
## Version of OpenTTD
2019-01-30-g8334a573
## Expected result
Main Menu:
- GS config in slot, GS instance active, alive: all parameters editable