Jump to content
Sign in to follow this  
Bubbet

ShipWindow getTab problems

Recommended Posts

getTab and getActiveTab both error in a player attached script (not in context of menu) and return non valid tabs in entity attached script meaning you cant do anything with them like disable them.

The exact result i was attempting to get to was disabling the hangar tab. But neither approach allowed me to do that.

Share this post


Link to post
Share on other sites
Posted (edited)

I think this only happens if an active tab was created on the C++ side (like the inventory tab).

You could try to use tab callbacks for your tabs to know when they're active:

local myTab = shipWindow:createTab("My Tab Name"%_t, "path/to/icon", "My Tab Name"%_t)
myTab.onSelectedFunction = "onMyTabSelected"
myTab.onShowFunction = "onMyTabShown"

 

Edited by Rinart73

Share this post


Link to post
Share on other sites

I suppose that makes sense, but then you've got no way to disable things like the hangar. The devs have mentioned that they cannot go back on making fighters craftable. But without being able to disable that tab i don't see a way as a modder to disable fighter production.

Share this post


Link to post
Share on other sites
Posted (edited)
Quote

But without being able to disable that tab i don't see a way as a modder to disable fighter production.

Tbh disabling the tab will only disable the UI - client-side part of it. A person with coding experience will find a way to bypass it.

How about using the following code? It should delete all squads blueprints on server side from time to time.

function DisableFighterProduction.getUpdateInterval()
	return 20
end

function DisableFighterProduction.updateServer()
	local entity = Entity()
	if entity:hasComponent(ComponentType.Hangar) then
		local hangar = Hangar()
		for i = 0, hangar.numSquads then
			hangar:setBlueprint(i, nil)
		end
	end
end

 

Edited by Rinart73

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...