item onUpdate running on an AI ship ??

Freeform discussion about anything related to modding Transcendence.
Post Reply
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

I just encountered this problem, I might have an item on an AI ship that has onUpdate event on it. The event is running.

I'm happy with that but isn't onAIUpdate supposed to run on AI ships and onUpdate running on gPlayership only ?

or is that onUpdate runs on every spaceObject and onAIUpdate runs only on AI ships ?
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

I'm not sure about what was intended, but I noticed recently that the onUpdate event handler for an item gets fired, even when the item is, for example, in the inventory of a station.
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

I can confirm that OnUpdate on an item does indeed run when an item is on a station.
We might have to file a bug report on bug reports about onAIUpdate? :S
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
PM
Fleet Admiral
Fleet Admiral
Posts: 2570
Joined: Wed Sep 01, 2010 12:54 am

OnUpdate is OnAIUpdate except that it includes the playership. OnAIUpdate is OnUpdate except that it excludes the playership.

If this is considered a bug and gets "fixed", apiVersion will need to change to avoid breaking mods that rely on current behavior.
Download and Play in 1.9 beta 1...
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!

Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

From the sound of it, intrducing an OnPlayerUpdate event would be the backwards compatible method of clearing up the issue.
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

thanks for clearing this up guys, I don't consider it a bug, I was just confused. (I was 99% sure that OnUpdate was running only on the playership, silly me)

OnPlayerUpdate ? Eventually, but it's not needed. Just run a OnUpdate with a check like

Code: Select all

(if (eq gSource gPlayership) (run code))
to make the onUpdate code run only on the playership
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

I realized this after posting, yes. I usually apply the '(itmIsInstalled gItem)' check in the same fashion.
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
Post Reply