language inherit query

Freeform discussion about anything related to modding Transcendence.
Post Reply
relanat
Militia Captain
Militia Captain
Posts: 941
Joined: Tue Nov 05, 2013 9:56 am

The Stargate Easy Dock N Go mod (original mod by SIaFu) is an overwrite of the three standard stargate types in the game, Daahzen, Majellen and UnchartedMajellen, to give them one central docking point. All three stargate types use exactly the same screenDesc and actions. ATM all three have a <Language> block as shown

Code: Select all

<Language>
	<Text id="actionGate">"[G]ate"</Text>
	<Text id="actionUndock">"[U]ndock"</Text>

	<Text id="descStargate">
		"You are docked at the center of an alien stargate. These giant structures are used by the Ancient Races to move their starships across the Galaxy. Stargates are the best mode of faster-than-light travel and they are the only method known to humans."
	</Text>
</Language>
I'm looking at ways to have them all inherit (correct jargon?) the language from one lot of code. Having a base class containing this Language block and inheriting this in every stargate type is the only way I know to do this. Is there a simpler, easier, more preferred way of doing this? Recent posts in the Ministry which I don't understand suggest that there could be other ways. Specifically NMS and George here: https://ministry.kronosaur.com/record.hexm?id=73090
Attachments
StargateEasyDockNGoV2.xml
(9.04 KiB) Downloaded 156 times
Stupid code. Do what I want, not what I typed in!
giantcabbage
Militia Lieutenant
Militia Lieutenant
Posts: 104
Joined: Thu Apr 07, 2011 9:05 pm

There are two ways to reduce the amount of duplication. One is to inherit from a base class. With a station baseclass you can inherit the language, events, docking ports etc. However, you cannot currently inherit the DockScreens elements. For example:

Code: Select all

<StationType UNID="&baStarGate">
	<DockingPorts>
		<Port x="0"		y="0"/>
	</DockingPorts>

	<Language>
		<Text id="actionGate">"[G]ate"</Text>
		<Text id="actionUndock">"[U]ndock"</Text>

		<Text id="descStargate">
			"You are docked at the center of an alien stargate. These giant structures are used by the Ancient Races to move their starships across The Galaxy. Stargates are the best mode of faster-than-light travel and they are the only method known to humans."
		</Text>
	</Language>
</StationType>
However, in this case what you really want is a shared dockscreen. For example:

Code: Select all

<DockScreen UNID="&dsStargate;"
		inherit=			"&dsDockScreenBase;"
		>
	<Panes>
		<Default>
			<OnPaneInit>
				(scrSetDescTranslate gScreen 'descWelcome)
			</OnPaneInit>
			<Actions>
				<Action id="actionGate" default="1">
					(block (
						(currentStargateID (objGetStargateID gSource))
						(destinationInfo (sysGetStargateDestination currentStargateID))
						(destinationNode (@ destinationInfo 0))
						(destinationGateID (@ destinationInfo 1))
						)

						(objGateTo gPlayerShip destinationNode destinationGateID &efStargateOut;)
						(scrExitScreen gScreen 'forceUndock)
						)
				</Action>

				<Action id="actionUndock" cancel="1">
					(scrExitScreen gScreen 'forceUndock)
				</Action>
			</Actions>
		</Default>
	</Panes>
	<Language>
		<Text id="actionGate">[G]ate</Text>

		<Text id="descWelcome">
			You are docked at the center of an alien stargate. These giant structures are
			used by the Ancient Races to move their starships across the Galaxy.
			Stargates are the best mode of faster-than-light travel and they are the only method known to humans.
		</Text>
	</Language>
</DockScreen>
We don't need to define actionUndock as we're inheriting from dsDockScreenBase

Each stargate can now use the same dockscreen with dockScreen="&dsStargate;" instead of dockScreen="Main"
relanat
Militia Captain
Militia Captain
Posts: 941
Joined: Tue Nov 05, 2013 9:56 am

Excellent info. And very well explained. Thank you.
Stupid code. Do what I want, not what I typed in!
Post Reply