2020-10-28 21:59:02 +00:00
<!DOCTYPE html>
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=UTF-8" / >
< title > JGR's Patchpack - Additions to Script Specifications (AI and GameScript)< / title >
< style type = "text/css" >
td li { white-space: nowrap; text-align: left; }
th { white-space: nowrap; text-align: center; }
td, th { border: 1px solid #CCCCCC; padding: 0px 5px; }
table { border-collapse: collapse; empty-cells: show; }
.code { font-family: "Courier New", Courier, mono; color: darkgreen; }
.methodtext{ margin-left: 3em; }
2020-10-29 17:47:05 +00:00
.indent { margin-left: 1em; margin-bottom: 0.5em; }
2020-10-28 21:59:02 +00:00
dt { font-weight: bold; }
< / style >
< / head >
< body >
< h2 > Additions to AI/GS Script Specifications in JGR's Patchpack< / h2 >
< p > This document describes non-standard additions to the Official OpenTTD < a href = "https://docs.openttd.org/ai-api/" > AI< / a > and < a href = "https://docs.openttd.org/gs-api/" > GS< / a > Specifications which are present in this patchpack.
< p > These additions MAY also be present in other patchpacks. They MAY be removed or moved in future, if necessary.< / p >
< p > Scripts which use any of these features SHOULD check whether the feature is present and if not, fallback to not using it and/or emitting a clear and end-user friendly error message.< br >
Testing for the presence of methods may be done using the "in" operator.< / p >
< h3 > Date: < a href = "https://docs.openttd.org/gs-api/classGSDate.html" > GSDate Class< / a > and < a href = "https://docs.openttd.org/ai-api/classAIDate.html" > AIDate Class< / a > < / h3 >
< div class = "indent" >
< h4 > Additional Static Public Member Functions:< / h4 >
< div class = "indent" >
< div class = "code" > static int32 GetDayLengthFactor ()< / div >
2020-10-29 17:47:05 +00:00
< div class = "methodtext" > Get current day length factor.< / div >
< / div >
< div class = "indent" >
< div class = "code" > static bool IsTimeShownInMinutes ()< / div >
< div class = "methodtext" > Get whether time is shown in minutes in the game settings.< / div >
< div class = "methodtext" > This ignores the "Use client time settings instead of savegame time settings" setting.< / div >
< / div >
< div class = "indent" >
< div class = "code" > static int32 GetTicksPerMinute ()< / div >
< div class = "methodtext" > Get the ticks per minutes in the game settings.< / div >
< div class = "methodtext" > This ignores the "Use client time settings instead of savegame time settings" setting.< / div >
< / div >
< div class = "indent" >
< div class = "code" > static DateTicksScaled GetCurrentScaledDateTicks ()< / div >
< div class = "methodtext" > Get the current scaled date ticks.< / div >
< div class = "methodtext" > This increments at the same rate regardless of the day length factor.< / div >
< div class = "methodtext" > Changing the day length factor will also change this value.< / div >
< / div >
< div class = "indent" >
< div class = "code" > static int32 GetHour (DateTicksScaled ticks)< / div >
< div class = "methodtext" > Get the hour of the given scaled date ticks value.< / div >
< div class = "methodtext" > This ignores the "Use client time settings instead of savegame time settings" setting.< / div >
< / div >
< div class = "indent" >
< div class = "code" > static int32 GetMinute (DateTicksScaled ticks)< / div >
< div class = "methodtext" > Get the minute of the given scaled date ticks value.< / div >
< div class = "methodtext" > This ignores the "Use client time settings instead of savegame time settings" setting.< / div >
2020-10-28 21:59:02 +00:00
< / div >
< / div >
< h3 > Marine: < a href = "https://docs.openttd.org/gs-api/classGSMarine.html" > GSMarine Class< / a > and < a href = "https://docs.openttd.org/ai-api/classAIMarine.html" > AIMarine Class< / a > < / h3 >
< div class = "indent" >
< h4 > Additional Static Public Member Functions:< / h4 >
< div class = "indent" >
2022-01-09 23:03:12 +00:00
< div class = "code" > static bool BuildRiver (TileIndex tile)< / div >
2020-10-29 17:47:05 +00:00
< div class = "methodtext" > Builds a river on tile (subject to permissions/settings).< / div >
< div class = "methodtext" > All other details are the same as BuildCanal.< / div >
2020-10-28 21:59:02 +00:00
< / div >
< / div >
2022-01-09 23:03:12 +00:00
< h3 > Road: < a href = "https://docs.openttd.org/gs-api/classGSRoad.html" > GSRoad Class< / a > and < a href = "https://docs.openttd.org/ai-api/classAIRoad.html" > AIRoad Class< / a > < / h3 >
< div class = "indent" >
< h4 > Additional Static Public Member Functions:< / h4 >
< div class = "indent" >
< div class = "code" > static bool HasRoadTramType(TileIndex tile, RoadTramTypes road_tram_type)< / div >
< div class = "methodtext" > Check if a tile has the given road tram type.< / div >
< / div >
< div class = "indent" >
< div class = "code" > static RoadType GetRoadType(TileIndex tile, RoadTramTypes road_tram_type)< / div >
< div class = "methodtext" > Get the RoadType that is used on a tile.< / div >
< / div >
< div class = "indent" >
< div class = "code" > static bool IsCatenaryRoadType(RoadType roadtype)< / div >
< div class = "methodtext" > Checks whether the given road type uses a catenary.< / div >
< / div >
< div class = "indent" >
< div class = "code" > static bool IsNonLevelCrossingRoadType(RoadType roadtype)< / div >
< div class = "methodtext" > Checks whether the given road type disallows level crossings.< / div >
< / div >
< div class = "indent" >
< div class = "code" > static bool IsNoTownHousesRoadType(RoadType roadtype)< / div >
< div class = "methodtext" > Checks whether the given road type cannot be used by towns to build houses.< / div >
< / div >
< div class = "indent" >
< div class = "code" > static bool IsTownBuildableRoadType(RoadType roadtype)< / div >
< div class = "methodtext" > Checks whether the given road type is buildable by towns.< / div >
< / div >
< / div >
2020-10-28 21:59:02 +00:00
< / body >
< / html >