CanInstallItem Event, or Item Restriction in General

Freeform discussion about anything related to modding Transcendence.
Post Reply
robotarozum
Miner
Miner
Posts: 35
Joined: Sat Nov 30, 2013 10:05 pm

This is the very last thing I need to make my mod go, so I hope the answer is easy! :D

I have a mod ship that I want to only use specific mod weapons, while treating all other installs as in vanilla (so armor restricted by mass, etc.). All the mod weapons have the modifier TDI, so I thought I could accomplish this by doing:

Code: Select all

<Events>
		<CanInstallItem>
			(block nil
			(if
				(or
					(not(eq (itmGetCategory gItem) 4))
					(itmHasAttribute(gItem) "TDI")
				)
				(setq return True)
				(setq return "The Slasher-class only supports TDI weaponry.")
			)
			)
			return
		</CanInstallItem>
	</Events>
To my mind, this makes it so whenever an item tries to install the ship checks to see if it satisfies [not a weapon] or [includes TDI modifier], or else the item can't be installed. What actually happens is... nothing. The event code may as well not exist, as near as I can tell.

This is a relatively recent addition and I can't find any instances of it in github or xelerus, does anyone have experience with it and can point me in the right direction please? Or, is there another way to get at this functionality?
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?

Still have tons of homework to do but tossing this link to you:
http://transcendence.kronosaur.com/wiki ... nstallitem
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.
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Edit: Forget what I said before--it's not a problem with your code.

The problem appears to be a bug in the engine. It doesn't seem to be calling CanInstallItem for devices (only for armor). I can make a fix for the next release. Sorry about that.

[If it's any consolation, at least this will get you into the credits.]
robotarozum
Miner
Miner
Posts: 35
Joined: Sat Nov 30, 2013 10:05 pm

Oh, sweet! :D Until then I can just politely suggest that people use the appropriate weapons, no problemo.
Post Reply