OpenTTD

Tasklist

FS#5390 - Patch -> GS + AI API Addition: OnHouseDestroyed

Attached to Project: OpenTTD
Opened by Frank (XFrankX) - Friday, 14 December 2012, 10:48 GMT
Last edited by Leif Linse (Zuu) - Friday, 13 September 2013, 22:10 GMT
Type Patch
Category Script → Goal/Game script
Status Waiting on reporter
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

This patch adds a functionality to the GameScript + AI engine called OnHouseDestroyed. It's triggered when some company destroys a house in a town.

A Forum thread has been created for this patch:

http://www.tt-forums.net/viewtopic.php?f=33&t=63629

The patch returns the ID of the company which destroyed a house, the ID of the town where the house got destroyed and the population of the house that got destroyed. This Function can be usefull in gamescripts when you want for example an anti-cheat / anti-troll function!

The Patch attached is for the latest TRUNK (14-12-2012).

Best regards,

Frank
Server Admin BTPro
http://openttd.btpro.nl
This task depends upon

Comment by Frank (XFrankX) - Friday, 14 December 2012, 11:14 GMT
Oops, Attachment didn't come through...
Comment by Charles Pigott (LordAro) - Tuesday, 25 December 2012, 22:28 GMT
1 issue i noticed:

- "script/api/game/game_event.hpp.sq" there is a strange line with some extra whitespace, which is odd, as that file is generated by a script. You did use squirrel_export.[sh|awk], right?
Comment by Leif Linse (Zuu) - Monday, 21 January 2013, 19:56 GMT
If you look at the existing Event classes, none of them include "On" in their name. Instead events in NoAI and NoGo only uses "Event" as prefix. Thus I suggest that your event is renamed to ScriptEventHouseDestroyed (instead of ScriptEventOnHouseDestroyed).

Also, guided by the design goal that AIs should have about the same information available as players, I would suggest that this event is only available to game scripts. To accomplish this you can look at for example script_goal.hpp and see how it uses "@api game" to make it GameScript only. Re-run squirrel_export.sh to re-generate the .sq files as LordAro suggested.

Loading...