Landing Pad questions

Landing Pad questions

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Landing Pad questions

Post by SanadaUjiosan »

I am beginning work on an aircraft repair pad for CT, and I have some questions on the finer points.

I know that most of the answers will probably be "yes, you can do it... with lua!" So I ask for either examples or strong nudging in the right direction :-)

Is it possible for certain units to be allocated to certain landing pad points? Some of you may recall me working on a factory that builds different units on different points several months ago (thanks to flozi, knorke and others for getting it working!) which is basically the exact same deal. I want aircraft to go to padA, and cruisers to go to padB.

Of course it seems that the landing pads work with a table so the code that worked for the factory did not work for this... I'm sure it is similar. The bit of code I use for the factories is:

Code: Select all

	function script.QueryBuildInfo()
		return buildSpots [bdefID] or normalpad
	end
And of course I want different animations for these different pads. The bit of code I use for this is:

Code: Select all

	function script.StartBuilding()
		Sleep (10) --otherwise GetUnitIsBuilding returns nil
		local spGetUnitIsBuilding = Spring.GetUnitIsBuilding (unitID)
		bdefID = Spring.GetUnitDefID (spGetUnitIsBuilding)
		if UnitDefs[bdefID].canFly then
			StartThread(cruiser_descend)
		else
			StartThread(normal_unit)
		end
	end
So I guess the real question is, does spring handle the repair work for landing pads differently than building? Like is there a GetUnitIsRepairing?

Thanks :)
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Landing Pad questions

Post by knorke »

Dont see a quick way like with the buildpad thing.
Like is there a GetUnitIsRepairing?
not really or in the form that would be needed. When the aircraft is approaching to land it is not yet being repaired.
I think you can not even get/set the pad from the aircraft's commandqueue because it will point to the landing pad unit but not to a piece (guess, did not test!)
I want aircraft to go to padA, and cruisers to go to padB.
The landingpad unit could consist of two units.
Then use minAirbasePower
The minimum workerTime an airbase must have to repair / refuel this aircraft.
so that cruisers can only land on padB.
But aircraft would still be able to go to padA. hm.
QueryLandingPads ( ) -> { number piece1, number piece2, ... }
Called one time for units with landing pads.
one time = maybe it is not even possible to change landingpads dynamically? (untested)
Maybe could forbid some pads by moving the pieces undergroud but if the aircraft will understand that?

Could of course luait and do the whole aircraft repair stuff in lua but oh well. Or use some nanoturret thing and limit it to what it is allowed to repair?
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Re: Landing Pad questions

Post by SanadaUjiosan »

Thank you for responding Knorke :-)

Seems doomed, especially with my weak Code Fu.

I never tried to do anything with the whole "combine 2 units to make 1" thing. Always looked a little buggy to me. Is that the case?

But even then, another problem is that Cruisers are so large and long, they are going to need a giant square field to make it look "right." Otherwise you've got a big cruisers landing perpendicular to a logically long and thin landing strip. I did not think of this before.

Maybe I should just make a normal landing pad for planes and make the cruisers unable to land with minAirbasePower.
Post Reply

Return to “Lua Scripts”