Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an event to localize new Item Categories #1173

Merged
merged 1 commit into from
May 21, 2023

Conversation

Iridar
Copy link
Contributor

@Iridar Iridar commented May 14, 2023

Fixes #1112

@Iridar Iridar added this to the 1.25.0 milestone May 14, 2023
@Iridar Iridar self-assigned this May 14, 2023
@github-actions
Copy link
Contributor

Pull request modifies event listener templates

Difference (click to expand)
diff --git a/target/CHL_Event_Compiletest.uc b/target/CHL_Event_Compiletest.uc
index c229218..e7b195b 100644
--- a/target/CHL_Event_Compiletest.uc
+++ b/target/CHL_Event_Compiletest.uc
@@ -217,6 +217,22 @@ static function EventListenerReturn OnGetCovertActionEvents_Settings(Object Even
 	return ELR_NoInterrupt;
 }
 
+static function EventListenerReturn OnGetLocalizedItemCategory(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
+{
+	local X2ItemTemplate ItemTemplate;
+	local XComLWTuple Tuple;
+	local string CategoryLocale;
+
+	ItemTemplate = X2ItemTemplate(EventSource);
+	Tuple = XComLWTuple(EventData);
+
+	// Your code here
+
+	Tuple.Data[0].s = CategoryLocale;
+
+	return ELR_NoInterrupt;
+}
+
 static function EventListenerReturn OnHeadquartersUnitFired(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
 {
 	local XComGameState_Unit FiredUnit;
What? (click to expand)

The Highlander documentation tool generates event listener examples from event specifications.
This comment contains the modifications that would be made to the copy-pasteable event listeners in documentation, for PR authors and reviewers to inspect for correctness, and will automatically be kept up-to-date whenever this PR is updated.

@Iridar Iridar added the ready-to-review A pull request is ready to be reviewed label May 15, 2023
@Iridar
Copy link
Contributor Author

Iridar commented May 21, 2023

In retrospect, using the event system for this is a huge overkill, especially in the presence of the Localize() function, but let's keep the event for the sake of consistency with similar implementation in `X2WeaponTemplate'.

@Iridar Iridar merged commit b69c471 into X2CommunityCore:master May 21, 2023
@Iridar Iridar deleted the 1112-localize-item-cat branch May 21, 2023 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ready-to-review A pull request is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a way to localize new item categories
2 participants