Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOAI API lack vehicle is old event #5078

Closed
DorpsGek opened this issue Feb 22, 2012 · 12 comments
Closed

NOAI API lack vehicle is old event #5078

DorpsGek opened this issue Feb 22, 2012 · 12 comments
Labels
component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) enhancement Issue would be a good enhancement; we accept Pull Requests! flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay stale Stale issues

Comments

@DorpsGek
Copy link
Member

krinn opened the ticket and wrote:

NOAI API doesn't handle , most AI plays with autorenew feature and doesn't care about the event because the autorenew will replace old vehicle for them.

But for an AI that have its own replace vehicle function or when the openttd replace function is disable, there's no way for the AI to know a vehicle is old except by checking itself all vehicles current date status.

If you play as the AI you will get the windows popup when the event occurs but the event itself isn't trigger in NOAI API.

I think a ET_VEHICLE_IS_OLD (-> http://noai.openttd.org/docs/trunk/classAIEvent.html) or something similar should exist so AI will get the event and can react to it, else the AI must handle it by browsing all its vehicles to check the age status.

Reported version: Version?
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/5078
@DorpsGek
Copy link
Member Author

DorpsGek commented Mar 9, 2012

Yexo wrote:

If someone makes a proper patch for this it'll be included.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5078#comment10948

@DorpsGek
Copy link
Member Author

DorpsGek commented Apr 8, 2012

muxy wrote:

Started to work on it.
I'll give some news later after testing.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5078#comment11068

@DorpsGek
Copy link
Member Author

muxy wrote:

Started to work on it.
I'll give some news later after testing.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5078#comment11075

@DorpsGek
Copy link
Member Author

muxy wrote:

Here some start.

This has been tested with DictatorAI 156b modified with adding some code in the events handler and removing some code in the vehicle handler
and with a newgrf who sets bus lifetime to 1 year.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/5078#comment11446

@DorpsGek
Copy link
Member Author

Yexo wrote:

Some small comments (copied from IRC so they don't get lost):
- You introduce unnecessary newlines at the start of the patch.
- It's missing documentation for ScriptEventVehicleOld


This comment was imported from FlySpray: https://bugs.openttd.org/task/5078#comment11455

@DorpsGek
Copy link
Member Author

muxy wrote:

Here is some update.

used script squirel_export.sh in src/script/api

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/5078#comment11460

@DorpsGek
Copy link
Member Author

Yexo wrote:

http://devs.openttd.org/~yexo/vehicle_old.diff Updated version with some comments fixed. However it still generates the event multiple times for the same engine, which I don't like at all.

Needs some thoughts about when to generate this event: 1 year before old age, exactly at old age or even later.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5078#comment11462

@DorpsGek
Copy link
Member Author

krinn wrote:

sorry if i'm not of any help as i have 0 time until begin/mid september as my activity is resume to a work/sleep loop

i'll have a look at it as soon as i could.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5078#comment11469

@DorpsGek
Copy link
Member Author

muxy wrote:

Here is the event list generated per vehicle according the age :

  1. One year before max_age : Vehicle is getting old
  2. When reaching max age : Vehicle is getting very old
  3. Every year after max_age : Vehicle is getting very old and need to be replaced

In my test i use a grf who is setting lifetime to 1 year, thus i dont get the first message, but only the second one. That's why it could be better to send the event in the second case : Vehicle is getting very old.

Before sending a diff file, I will wait for other advices.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5078#comment11472

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) enhancement component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) labels Apr 7, 2018
@TrueBrain TrueBrain added enhancement Issue would be a good enhancement; we accept Pull Requests! patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay and removed enhancement from FlySpray labels Apr 11, 2018
@andythenorth
Copy link
Contributor

Thanks for this. There's been no activity on this for some time, and as it stands, it doesn't look likely that it will go any further. Since OpenTTD moved to GitHub, we use pull requests rather than patches, as they are a much more productive workflow.

I'm planning to close this soon (in 7 days), as we try to keep the issue count low for OpenTTD, it helps us focus on things that are important and fun.

If you would like to continue with this patch, the best way would be to move the patch to your own GitHub fork, update it for the current OpenTTD master, and then create a pull request. For more information, please see our CONTRIBUTING.md.

We are also happy to discuss directly on the issue, or in #openttd irc, including help to get this into a pull request. Thanks for your contribution!

@andythenorth andythenorth added the stale Stale issues label Jan 11, 2019
@LordAro
Copy link
Member

LordAro commented Jan 12, 2019

I think this is a legitimate missing AI event, but patch probably needs more work as muxy says above.

@LordAro LordAro removed the stale Stale issues label Jan 12, 2019
@stale
Copy link

stale bot commented Mar 13, 2019

This issue has been automatically marked as stale because it has not had any activity in the last two months.
If you believe the issue is still relevant, please test on the latest nightly and report back.
It will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

@stale stale bot added the stale Stale issues label Mar 13, 2019
@stale stale bot closed this as completed Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) enhancement Issue would be a good enhancement; we accept Pull Requests! flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay stale Stale issues
Projects
None yet
Development

No branches or pull requests

4 participants