Repository: OpenRA/OpenRAModSDK Branch: master Commit: df103939c7e4 Files: 62 Total size: 202.6 KB Directory structure: gitextract_ab7_c2tl/ ├── .editorconfig ├── .gitattributes ├── .github/ │ ├── dependabot.yml │ └── workflows/ │ ├── ci.yml │ └── packaging.yml ├── .gitignore ├── .vscode/ │ ├── extensions.json │ ├── launch.json │ └── tasks.json ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── COPYING ├── ExampleMod.sln ├── Makefile ├── OpenRA.Mods.Example/ │ ├── OpenRA.Mods.Example.csproj │ ├── Properties/ │ │ └── launchSettings.json │ └── Rendering/ │ ├── ColorPickerColorShift.cs │ └── PlayerColorShift.cs ├── README.md ├── fetch-engine.sh ├── launch-dedicated.cmd ├── launch-dedicated.sh ├── launch-game.cmd ├── launch-game.sh ├── make.cmd ├── make.ps1 ├── mod.config ├── mods/ │ └── example/ │ ├── chrome/ │ │ ├── chrome.yaml │ │ ├── ingame-observer.yaml │ │ └── layouts/ │ │ └── ingame-player.yaml │ ├── cursors/ │ │ └── default.yaml │ ├── fluent/ │ │ ├── chrome.ftl │ │ ├── mod.ftl │ │ └── rules.ftl │ ├── maps/ │ │ ├── example/ │ │ │ └── map.yaml │ │ └── shellmap/ │ │ └── map.yaml │ ├── missions/ │ │ └── example.yaml │ ├── mod.chrome.yaml │ ├── mod.content.yaml │ ├── mod.yaml │ ├── music/ │ │ └── example.yaml │ ├── notifications/ │ │ └── example.yaml │ ├── rules/ │ │ ├── example.yaml │ │ ├── mpspawn.yaml │ │ ├── palettes.yaml │ │ ├── player.yaml │ │ └── world.yaml │ ├── sequences/ │ │ ├── example.yaml │ │ ├── mapeditor.yaml │ │ └── mpspawn.yaml │ ├── tilesets/ │ │ └── example.yaml │ ├── voices/ │ │ └── example.yaml │ └── weapons/ │ └── example.yaml ├── omnisharp.json ├── packaging/ │ ├── functions.sh │ ├── linux/ │ │ └── buildpackage.sh │ ├── macos/ │ │ └── buildpackage.sh │ ├── package-all.sh │ └── windows/ │ ├── buildpackage.nsi │ └── buildpackage.sh ├── utility.cmd └── utility.sh ================================================ FILE CONTENTS ================================================ ================================================ FILE: .editorconfig ================================================ ; Top-most https://editorconfig.org/ file root = true charset=utf-8 ; Unix-style newlines [*] end_of_line = LF insert_final_newline = true trim_trailing_whitespace = true ; 4-column tab indentation [*.{cs,csproj,yaml,lua,sh,ps1}] indent_style = tab indent_size = 4 ; .NET coding conventions #### Code Style Rules #### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ # Severity Levels: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/configuration-options#severity-level # Below we enable specific rules by setting severity to warning. # Rules are disabled by setting severity to silent (to still allow use in IDE) or none (to prevent all use). # Rules are listed below with any options available. # Options are commented out if they match the defaults. ### Language and Unnecessary Rules ### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/language-rules ## 'using' directive preferences # IDE0073 Require file header #file_header_template = unset # This rule does not allow us to enforce our desired header, as it prefixes the header lines with // comments, meaning we can't apply a region. dotnet_diagnostic.IDE0073.severity = none # IDE0005 Remove unnecessary import # No options # IDE0005 is only enabled in the IDE by default. https://github.com/dotnet/roslyn/issues/41640 # To enable it for builds outside the IDE the 'GenerateDocumentationFile' property must be enabled on the build. # GenerateDocumentationFile generates additional warnings about XML docs, so disable any we don't care about. dotnet_diagnostic.CS1591.severity = none # Missing XML comment for publicly visible type or member dotnet_diagnostic.IDE0005.severity = warning # IDE0065 'using' directive placement #csharp_using_directive_placement = outside_namespace dotnet_diagnostic.IDE0065.severity = silent ## Code-block preferences # IDE0011 Add braces #csharp_prefer_braces = true # No options match the style used in OpenRA. dotnet_diagnostic.IDE0011.severity = none # IDE0063 Use simple 'using' statement #csharp_prefer_simple_using_statement = true dotnet_diagnostic.IDE0063.severity = silent # IDE0160/IDE0161 Use block-scoped namespace/Use file-scoped namespace #csharp_style_namespace_declarations = block_scoped dotnet_diagnostic.IDE0160.severity = warning dotnet_diagnostic.IDE0161.severity = warning # IDE0200 Remove unnecessary lambda expression #csharp_style_prefer_method_group_conversion = true dotnet_diagnostic.IDE0200.severity = silent # Requires C# 11 # IDE0210 Convert to top-level statements/IDE0211 Convert to 'Program.Main' style program csharp_style_prefer_top_level_statements = false dotnet_diagnostic.IDE0210.severity = warning dotnet_diagnostic.IDE0211.severity = warning # IDE0290 Use primary constructor #csharp_style_prefer_primary_constructors = true dotnet_diagnostic.IDE0200.severity = silent # Requires C# 12 # IDE0330 Prefer 'System.Threading.Lock' #csharp_prefer_system_threading_lock = true dotnet_diagnostic.IDE0330.severity = silent # Requires C# 13 ## Expression-bodied members # IDE0021 Use expression body for constructors #csharp_style_expression_bodied_constructors = false dotnet_diagnostic.IDE0021.severity = silent # IDE0022 Use expression body for methods #csharp_style_expression_bodied_methods = false dotnet_diagnostic.IDE0022.severity = silent # IDE0023/IDE0024 Use expression body for conversion operators/Use expression body for operators #csharp_style_expression_bodied_operators = false dotnet_diagnostic.IDE0023.severity = silent dotnet_diagnostic.IDE0024.severity = silent # IDE0025 Use expression body for properties #csharp_style_expression_bodied_properties = true dotnet_diagnostic.IDE0025.severity = silent # IDE0026 Use expression body for indexers #csharp_style_expression_bodied_indexers = true dotnet_diagnostic.IDE0026.severity = silent # IDE0027 Use expression body for accessors #csharp_style_expression_bodied_accessors = true dotnet_diagnostic.IDE0027.severity = warning # IDE0053 Use expression body for lambdas # This rule is buggy and not enforced for builds. ':warning' will at least enforce it in the IDE. csharp_style_expression_bodied_lambdas = when_on_single_line:warning dotnet_diagnostic.IDE0053.severity = warning # IDE0061 Use expression body for local functions csharp_style_expression_bodied_local_functions = when_on_single_line dotnet_diagnostic.IDE0061.severity = warning ## Expression-level preferences # IDE0001 Simplify name # No options dotnet_diagnostic.IDE0001.severity = warning # IDE0002 Simplify member access # No options dotnet_diagnostic.IDE0002.severity = warning # IDE0004 Remove unnecessary cast # No options dotnet_diagnostic.IDE0004.severity = warning # IDE0010 Add missing cases to switch statement # No options dotnet_diagnostic.IDE0010.severity = silent # IDE0017 Use object initializers #dotnet_style_object_initializer = true dotnet_diagnostic.IDE0017.severity = warning # IDE0028 Use collection initializers #dotnet_style_collection_initializer = true dotnet_diagnostic.IDE0028.severity = warning # IDE0029/IDE0030/IDE0270 Use coalesce expression (non-nullable types)/Use coalesce expression (nullable types)/Use coalesce expression (if null) #dotnet_style_coalesce_expression = true dotnet_diagnostic.IDE0029.severity = warning dotnet_diagnostic.IDE0030.severity = warning dotnet_diagnostic.IDE0270.severity = silent # IDE0031 Use null propagation #dotnet_style_null_propagation = true dotnet_diagnostic.IDE0031.severity = warning # IDE0032 Use auto-implemented property #dotnet_style_prefer_auto_properties = true dotnet_diagnostic.IDE0032.severity = warning # IDE0033 Use explicitly provided tuple name #dotnet_style_explicit_tuple_names = true dotnet_diagnostic.IDE0033.severity = warning # IDE0035 Remove unreachable code # No options # Duplicates compiler warning CS0162 dotnet_diagnostic.IDE0035.severity = none # IDE0037 Use inferred member name #dotnet_style_prefer_inferred_tuple_names = true #dotnet_style_prefer_inferred_anonymous_type_member_names = true dotnet_diagnostic.IDE0037.severity = silent # IDE0041 Use 'is null' check #dotnet_style_prefer_is_null_check_over_reference_equality_method = true dotnet_diagnostic.IDE0041.severity = warning # IDE0045 Use conditional expression for assignment #dotnet_style_prefer_conditional_expression_over_assignment = true dotnet_diagnostic.IDE0045.severity = silent # IDE0046 Use conditional expression for return #dotnet_style_prefer_conditional_expression_over_return = true dotnet_diagnostic.IDE0046.severity = silent # IDE0050 Convert anonymous type to tuple # No options dotnet_diagnostic.IDE0050.severity = silent # IDE0051 Remove unused private member # No options dotnet_diagnostic.IDE0051.severity = warning # IDE0052 Remove unread private member # No options dotnet_diagnostic.IDE0052.severity = warning # IDE0054/IDE0074 Use compound assignment/Use coalesce compound assignment #dotnet_style_prefer_compound_assignment = true dotnet_diagnostic.IDE0054.severity = warning dotnet_diagnostic.IDE0074.severity = warning # IDE0058 Remove unnecessary expression value #csharp_style_unused_value_expression_statement_preference = discard_variable dotnet_diagnostic.IDE0058.severity = silent # IDE0059 Remove unnecessary value assignment #csharp_style_unused_value_assignment_preference = discard_variable dotnet_diagnostic.IDE0059.severity = warning # IDE0070 Use 'System.HashCode.Combine' # No options dotnet_diagnostic.IDE0070.severity = warning # IDE0071 Simplify interpolation #dotnet_style_prefer_simplified_interpolation = true dotnet_diagnostic.IDE0071.severity = warning # IDE0075 Simplify conditional expression #dotnet_style_prefer_simplified_boolean_expressions = true dotnet_diagnostic.IDE0075.severity = warning # IDE0082 Convert 'typeof' to 'nameof' # No options dotnet_diagnostic.IDE0082.severity = warning # IDE0100 Remove unnecessary equality operator # No options dotnet_diagnostic.IDE0100.severity = warning # IDE0120 Simplify LINQ expression # No options dotnet_diagnostic.IDE0120.severity = warning # IDE0130 Namespace does not match folder structure #dotnet_style_namespace_match_folder = true # This rule doesn't appear to work (never reports violations) dotnet_diagnostic.IDE0130.severity = none # IDE0016 Use throw expression #csharp_style_throw_expression = true dotnet_diagnostic.IDE0016.severity = silent # IDE0018 Inline variable declaration #csharp_style_inlined_variable_declaration = true dotnet_diagnostic.IDE0018.severity = warning # IDE0034 Simplify 'default' expression #csharp_prefer_simple_default_expression = true dotnet_diagnostic.IDE0034.severity = warning # IDE0039 Use local function instead of lambda #csharp_style_prefer_local_over_anonymous_function = true dotnet_diagnostic.IDE0039.severity = warning # IDE0042 Deconstruct variable declaration #csharp_style_deconstructed_variable_declaration = true dotnet_diagnostic.IDE0042.severity = warning # IDE0056 Use index operator #csharp_style_prefer_index_operator = true dotnet_diagnostic.IDE0056.severity = warning # IDE0057 Use range operator #csharp_style_prefer_range_operator = true dotnet_diagnostic.IDE0057.severity = warning # IDE0072 Add missing cases to switch expression # No options dotnet_diagnostic.IDE0072.severity = silent # IDE0080 Remove unnecessary suppression operator # No options dotnet_diagnostic.IDE0080.severity = warning # IDE0090 Simplify 'new' expression #csharp_style_implicit_object_creation_when_type_is_apparent = true dotnet_diagnostic.IDE0090.severity = warning # IDE0110 Remove unnecessary discard # No options dotnet_diagnostic.IDE0110.severity = warning # IDE0150 Prefer 'null' check over type check #csharp_style_prefer_null_check_over_type_check = true dotnet_diagnostic.IDE0150.severity = warning # IDE0180 Use tuple to swap values #csharp_style_prefer_tuple_swap = true dotnet_diagnostic.IDE0180.severity = warning # IDE0220 Add explicit cast in foreach loop #dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed dotnet_diagnostic.IDE0220.severity = warning # IDE0230 Use UTF-8 string literal #csharp_style_prefer_utf8_string_literals = true dotnet_diagnostic.IDE0230.severity = silent # Requires C# 11 # IDE0240 Nullable directive is redundant # No options dotnet_diagnostic.IDE0240.severity = warning # IDE0241 Nullable directive is unnecessary # No options dotnet_diagnostic.IDE0241.severity = warning # This option applies to the collection expression rules below # .NET 8 defaults to true/when_types_exactly_match, .NET 9+ defaults to when_types_loosely_match #dotnet_style_prefer_collection_expression = true # IDE0300 Use collection expression for array # From above, uses dotnet_style_prefer_collection_expression dotnet_diagnostic.IDE0300.severity = silent # Requires C# 12 # IDE0301 Use collection expression for empty # From above, uses dotnet_style_prefer_collection_expression dotnet_diagnostic.IDE0301.severity = silent # Requires C# 12 # IDE0302 Use collection expression for stackalloc # From above, uses dotnet_style_prefer_collection_expression dotnet_diagnostic.IDE0302.severity = silent # Requires C# 12 # IDE0303 Use collection expression for 'Create()' # From above, uses dotnet_style_prefer_collection_expression dotnet_diagnostic.IDE0303.severity = silent # Requires C# 12 # IDE0304 Use collection expression for builder # From above, uses dotnet_style_prefer_collection_expression dotnet_diagnostic.IDE0304.severity = silent # Requires C# 12 # IDE0305 Use collection expression for fluent # From above, uses dotnet_style_prefer_collection_expression dotnet_diagnostic.IDE0305.severity = silent # Requires C# 12 ## Field preferences # IDE0044 Add readonly modifier #dotnet_style_readonly_field = true dotnet_diagnostic.IDE0044.severity = warning ## Language keyword vs. framework types preferences # IDE0049 Use language keywords instead of framework type names for type references #dotnet_style_predefined_type_for_locals_parameters_members = true #dotnet_style_predefined_type_for_member_access = true dotnet_diagnostic.IDE0049.severity = warning ## Modifier preferences # IDE0036 Order modifiers #csharp_preferred_modifier_order = public, private, protected, internal, file, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, required, volatile, async dotnet_diagnostic.IDE0036.severity = warning # IDE0040 Add accessibility modifiers dotnet_style_require_accessibility_modifiers = omit_if_default dotnet_diagnostic.IDE0040.severity = warning # IDE0062 Make local function static #csharp_prefer_static_local_function = true dotnet_diagnostic.IDE0062.severity = warning # IDE0064 Make struct fields writable # No options dotnet_diagnostic.IDE0064.severity = warning # IDE0250 Struct can be made 'readonly' #csharp_style_prefer_readonly_struct = true dotnet_diagnostic.IDE0250.severity = warning # IDE0251 Member can be made 'readonly' #csharp_style_prefer_readonly_struct_member = true dotnet_diagnostic.IDE0251.severity = warning # IDE0320 Make anonymous function static #csharp_prefer_static_anonymous_function = true dotnet_diagnostic.IDE0320.severity = warning ## Null-checking preferences # IDE1005 Use conditional delegate call csharp_style_conditional_delegate_call = true # true is the default, but the rule is not triggered if this is not specified. dotnet_diagnostic.IDE1005.severity = warning ## Parameter preferences # IDE0060 Remove unused parameter dotnet_code_quality_unused_parameters = non_public dotnet_diagnostic.IDE0060.severity = warning # IDE0280 Use 'nameof' # No options dotnet_diagnostic.IDE0280.severity = silent # Requires C# 11 ## Parentheses preferences # IDE0047/IDE0048 Remove unnecessary parentheses/Add parentheses for clarity dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary #dotnet_style_parentheses_in_other_binary_operators = always_for_clarity #dotnet_style_parentheses_in_other_operators = never_if_unnecessary dotnet_diagnostic.IDE0047.severity = warning dotnet_diagnostic.IDE0048.severity = warning ## Pattern-matching preferences # IDE0019 Use pattern matching to avoid 'as' followed by a 'null' check #csharp_style_pattern_matching_over_as_with_null_check = true dotnet_diagnostic.IDE0019.severity = warning # IDE0020/IDE0038 Use pattern matching to avoid 'is' check followed by a cast (with variable)/Use pattern matching to avoid 'is' check followed by a cast (without variable) #csharp_style_pattern_matching_over_is_with_cast_check = true dotnet_diagnostic.IDE0020.severity = warning dotnet_diagnostic.IDE0038.severity = warning # IDE0066 Use switch expression #csharp_style_prefer_switch_expression = true dotnet_diagnostic.IDE0066.severity = silent # IDE0078/IDE0260 Use pattern matching #csharp_style_prefer_pattern_matching = true #csharp_style_pattern_matching_over_as_with_null_check = true dotnet_diagnostic.IDE0078.severity = silent dotnet_diagnostic.IDE0260.severity = silent # IDE0083 Use pattern matching ('not' operator) #csharp_style_prefer_not_pattern = true dotnet_diagnostic.IDE0083.severity = warning # IDE0170 Simplify property pattern #csharp_style_prefer_extended_property_pattern = true dotnet_diagnostic.IDE0170.severity = silent # Requires C# 10 ## Suppression preferences # IDE0079 Remove unnecessary suppression #dotnet_remove_unnecessary_suppression_exclusions = none dotnet_diagnostic.IDE0079.severity = warning ## 'this' and 'Me' preferences # IDE0003/IDE0009 Remove 'this' or 'Me' qualification/Add 'this' or 'Me' qualification #dotnet_style_qualification_for_field = false #dotnet_style_qualification_for_property = false #dotnet_style_qualification_for_method = false #dotnet_style_qualification_for_event = false dotnet_diagnostic.IDE0003.severity = warning dotnet_diagnostic.IDE0009.severity = warning ## 'var' preferences # IDE0007/IDE0008 Use 'var' instead of explicit type/Use explicit type instead of 'var' csharp_style_var_for_built_in_types = true csharp_style_var_when_type_is_apparent = true csharp_style_var_elsewhere = true dotnet_diagnostic.IDE0007.severity = warning dotnet_diagnostic.IDE0008.severity = warning ### Miscellaneous Rules ### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/miscellaneous-rules # IDE0076 Remove invalid global 'SuppressMessageAttribute' # No options dotnet_diagnostic.IDE0076.severity = warning # IDE0077 Avoid legacy format target in global 'SuppressMessageAttribute' # No options dotnet_diagnostic.IDE0077.severity = warning ### Formatting Rules (IDE0055) ### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0055 dotnet_diagnostic.IDE0055.severity = warning #dotnet_sort_system_directives_first = true #dotnet_separate_import_directive_groups = false #csharp_new_line_before_open_brace = all #csharp_new_line_before_else = true #csharp_new_line_before_catch = true #csharp_new_line_before_finally = true #csharp_new_line_before_members_in_object_initializers = true #csharp_new_line_before_members_in_anonymous_types = true #csharp_new_line_between_query_expression_clauses = true #csharp_indent_case_contents = true #csharp_indent_switch_labels = true #csharp_indent_labels = one_less_than_current #csharp_indent_block_contents = true #csharp_indent_braces = false csharp_indent_case_contents_when_block = false #csharp_space_after_cast = false #csharp_space_after_keywords_in_control_flow_statements = true #csharp_space_between_parentheses = #csharp_space_before_colon_in_inheritance_clause = true #csharp_space_after_colon_in_inheritance_clause = true #csharp_space_around_binary_operators = before_and_after #csharp_space_between_method_declaration_parameter_list_parentheses = false #csharp_space_between_method_declaration_empty_parameter_list_parentheses = false #csharp_space_between_method_declaration_name_and_open_parenthesis = false #csharp_space_between_method_call_parameter_list_parentheses = false #csharp_space_between_method_call_empty_parameter_list_parentheses = false #csharp_space_between_method_call_name_and_opening_parenthesis = false #csharp_space_after_comma = true #csharp_space_before_comma = false #csharp_space_after_dot = false #csharp_space_before_dot = false #csharp_space_after_semicolon_in_for_statement = true #csharp_space_before_semicolon_in_for_statement = false #csharp_space_around_declaration_statements = false #csharp_space_before_open_square_brackets = false #csharp_space_between_empty_square_brackets = false #csharp_space_between_square_brackets = false #csharp_preserve_single_line_statements = true #csharp_preserve_single_line_blocks = true ### Naming Rules (IDE1006) ### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/naming-rules dotnet_diagnostic.IDE1006.severity = warning ## Naming styles dotnet_naming_style.camel_case.capitalization = camel_case dotnet_naming_style.pascal_case.capitalization = pascal_case dotnet_naming_style.i_prefix_pascal_case.capitalization = pascal_case dotnet_naming_style.i_prefix_pascal_case.required_prefix = I ## Naming Symbols dotnet_naming_symbols.const_locals.applicable_kinds = local dotnet_naming_symbols.const_locals.applicable_accessibilities = * dotnet_naming_symbols.const_locals.required_modifiers = const dotnet_naming_symbols.const_fields.applicable_kinds = field dotnet_naming_symbols.const_fields.applicable_accessibilities = * dotnet_naming_symbols.const_fields.required_modifiers = const dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field dotnet_naming_symbols.static_readonly_fields.applicable_accessibilities = * dotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, internal, protected, protected_internal, private_protected dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly dotnet_naming_symbols.private_or_protected_fields.applicable_kinds = field dotnet_naming_symbols.private_or_protected_fields.applicable_accessibilities = private, protected, private_protected dotnet_naming_symbols.interfaces.applicable_kinds = interface dotnet_naming_symbols.interfaces.applicable_accessibilities = * dotnet_naming_symbols.parameters_and_locals.applicable_kinds = parameter, local dotnet_naming_symbols.parameters_and_locals.applicable_accessibilities = * dotnet_naming_symbols.most_symbols.applicable_kinds = namespace, class, struct, enum, field, property, method, local_function, event, delegate, type_parameter dotnet_naming_symbols.most_symbols.applicable_accessibilities = * ## Naming Rules dotnet_naming_rule.const_locals_should_be_pascal_case.symbols = const_locals dotnet_naming_rule.const_locals_should_be_pascal_case.style = pascal_case dotnet_naming_rule.const_locals_should_be_pascal_case.severity = warning dotnet_naming_rule.const_fields_should_be_pascal_case.symbols = const_fields dotnet_naming_rule.const_fields_should_be_pascal_case.style = pascal_case dotnet_naming_rule.const_fields_should_be_pascal_case.severity = warning dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.symbols = static_readonly_fields dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.style = pascal_case dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.severity = warning dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = pascal_case dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = warning dotnet_naming_rule.private_or_protected_fields_should_be_camel_case.symbols = private_or_protected_fields dotnet_naming_rule.private_or_protected_fields_should_be_camel_case.style = camel_case dotnet_naming_rule.private_or_protected_fields_should_be_camel_case.severity = warning dotnet_naming_rule.interfaces_should_be_i_prefix_pascal_case.symbols = interfaces dotnet_naming_rule.interfaces_should_be_i_prefix_pascal_case.style = i_prefix_pascal_case dotnet_naming_rule.interfaces_should_be_i_prefix_pascal_case.severity = warning dotnet_naming_rule.parameters_and_locals_should_be_camel_case.symbols = parameters_and_locals dotnet_naming_rule.parameters_and_locals_should_be_camel_case.style = camel_case dotnet_naming_rule.parameters_and_locals_should_be_camel_case.severity = warning dotnet_naming_rule.most_symbols_should_be_pascal_case.symbols = most_symbols dotnet_naming_rule.most_symbols_should_be_pascal_case.style = pascal_case dotnet_naming_rule.most_symbols_should_be_pascal_case.severity = warning ### StyleCop.Analyzers ### https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/DOCUMENTATION.md # Below we enable rule categories by setting severity to warning. # We'll only list rules to disable. # Individual rules we wish to disable are typically set to none severity. # Covers SAxxxx and SXxxxx rules dotnet_analyzer_diagnostic.category-StyleCop.CSharp.DocumentationRules.severity = warning dotnet_analyzer_diagnostic.category-StyleCop.CSharp.LayoutRules.severity = warning dotnet_analyzer_diagnostic.category-StyleCop.CSharp.MaintainabilityRules.severity = warning dotnet_analyzer_diagnostic.category-StyleCop.CSharp.NamingRules.severity = warning dotnet_analyzer_diagnostic.category-StyleCop.CSharp.OrderingRules.severity = warning dotnet_analyzer_diagnostic.category-StyleCop.CSharp.ReadabilityRules.severity = warning dotnet_analyzer_diagnostic.category-StyleCop.CSharp.SpacingRules.severity = warning dotnet_analyzer_diagnostic.category-StyleCop.CSharp.SpecialRules.severity = warning # Rules that are covered by IDE0001 Simplify name dotnet_diagnostic.SA1125.severity = none # UseShorthandForNullableTypes # Rules that are covered by IDE0047 Remove unnecessary parentheses dotnet_diagnostic.SA1119.severity = none # StatementMustNotUseUnnecessaryParenthesis # Rules that are covered by IDE0055 Formatting Rules dotnet_diagnostic.SA1027.severity = none # UseTabsCorrectly # Rules that are covered by IDE1006 Naming Rules dotnet_diagnostic.SA1300.severity = none # ElementMustBeginWithUpperCaseLetter dotnet_diagnostic.SA1302.severity = none # InterfaceNamesMustBeginWithI dotnet_diagnostic.SA1303.severity = none # ConstFieldNamesMustBeginWithUpperCaseLetter dotnet_diagnostic.SA1304.severity = none # NonPrivateReadonlyFieldsMustBeginWithUpperCaseLetter dotnet_diagnostic.SA1306.severity = none # FieldNamesMustBeginWithLowerCaseLetter dotnet_diagnostic.SA1307.severity = none # AccessibleFieldsMustBeginWithUpperCaseLetter dotnet_diagnostic.SA1311.severity = none # StaticReadonlyFieldsMustBeginWithUpperCaseLetter dotnet_diagnostic.SA1312.severity = none # VariableNamesMustBeginWithLowerCaseLetter dotnet_diagnostic.SA1313.severity = none # ParameterNamesMustBeginWithLowerCaseLetter # Rules that conflict with OpenRA project style conventions dotnet_diagnostic.SA1101.severity = none # PrefixLocalCallsWithThis dotnet_diagnostic.SA1107.severity = none # CodeMustNotContainMultipleStatementsOnOneLine dotnet_diagnostic.SA1116.severity = none # SplitParametersMustStartOnLineAfterDeclaration dotnet_diagnostic.SA1117.severity = none # ParametersMustBeOnSameLineOrSeparateLines dotnet_diagnostic.SA1118.severity = none # ParameterMustNotSpanMultipleLines dotnet_diagnostic.SA1122.severity = none # UseStringEmptyForEmptyStrings dotnet_diagnostic.SA1124.severity = none # DoNotUseRegions dotnet_diagnostic.SA1127.severity = none # GenericTypeConstraintsMustBeOnOwnLine dotnet_diagnostic.SA1132.severity = none # DoNotCombineFields dotnet_diagnostic.SA1135.severity = none # UsingDirectivesMustBeQualified dotnet_diagnostic.SA1136.severity = none # EnumValuesShouldBeOnSeparateLines dotnet_diagnostic.SA1200.severity = none # UsingDirectivesMustBePlacedCorrectly dotnet_diagnostic.SA1201.severity = none # ElementsMustAppearInTheCorrectOrder dotnet_diagnostic.SA1202.severity = none # ElementsMustBeOrderedByAccess dotnet_diagnostic.SA1204.severity = none # StaticElementsMustAppearBeforeInstanceElements dotnet_diagnostic.SA1214.severity = none # ReadonlyElementsMustAppearBeforeNonReadonlyElements dotnet_diagnostic.SX1309.severity = none # FieldNamesMustBeginWithUnderscore dotnet_diagnostic.SX1309S.severity = none # StaticFieldNamesMustBeginWithUnderscore dotnet_diagnostic.SA1314.severity = none # TypeParameterNamesMustBeginWithT dotnet_diagnostic.SA1400.severity = none # AccessModifierMustBeDeclared dotnet_diagnostic.SA1401.severity = none # FieldsMustBePrivate dotnet_diagnostic.SA1402.severity = none # FileMayOnlyContainASingleType dotnet_diagnostic.SA1407.severity = none # ArithmeticExpressionsMustDeclarePrecedence dotnet_diagnostic.SA1413.severity = none # UseTrailingCommasInMultiLineInitializers dotnet_diagnostic.SA1501.severity = none # StatementMustNotBeOnSingleLine dotnet_diagnostic.SA1502.severity = none # ElementMustNotBeOnSingleLine dotnet_diagnostic.SA1503.severity = none # BracesMustNotBeOmitted dotnet_diagnostic.SA1516.severity = none # ElementsMustBeSeparatedByBlankLine dotnet_diagnostic.SA1519.severity = none # BracesMustNotBeOmittedFromMultiLineChildStatement dotnet_diagnostic.SA1520.severity = none # UseBracesConsistently dotnet_diagnostic.SA1600.severity = none # ElementsMustBeDocumented dotnet_diagnostic.SA1601.severity = none # PartialElementsMustBeDocumented dotnet_diagnostic.SA1602.severity = none # EnumerationItemsMustBeDocumented dotnet_diagnostic.SA1611.severity = none # ElementParametersShouldBeDocumented dotnet_diagnostic.SA1615.severity = none # ElementReturnValueShouldBeDocumented dotnet_diagnostic.SA1618.severity = none # GenericTypeParametersShouldBeDocumented dotnet_diagnostic.SA1623.severity = none # PropertySummaryDocumentationShouldMatchAccessors dotnet_diagnostic.SA1633.severity = none # FileMustHaveHeader dotnet_diagnostic.SA1642.severity = none # ConstructorSummaryDocumentationShouldBeginWithStandardText dotnet_diagnostic.SA1649.severity = none # FileNameMustMatchTypeName #### Code Quality Rules #### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ # Below we enable specific rules by setting severity to warning. # Rules are disabled by setting severity to silent (to still allow use in IDE) or none (to prevent all use). # Rules are listed below with any options available. # Options are commented out if they match the defaults. # Rule options that apply over multiple rules are set here. # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-quality-rule-options dotnet_code_quality.api_surface = all ### Design Rules ### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/design-warnings # Collections should implement generic interface. #dotnet_code_quality.CA1010.additional_required_generic_interfaces = dotnet_diagnostic.CA1010.severity = warning # Abstract types should not have public constructors. dotnet_diagnostic.CA1012.severity = warning # Mark attributes with 'AttributeUsageAttribute'. dotnet_diagnostic.CA1018.severity = warning # Override methods on comparable types. dotnet_diagnostic.CA1036.severity = warning # Provide ObsoleteAttribute message. dotnet_diagnostic.CA1041.severity = warning # Do not declare protected members in sealed types. dotnet_diagnostic.CA1047.severity = warning # Declare types in namespaces. dotnet_diagnostic.CA1050.severity = warning # Static holder types should be 'Static' or 'NotInheritable'. dotnet_diagnostic.CA1052.severity = warning # Do not hide base class methods. dotnet_diagnostic.CA1061.severity = warning # Exceptions should be public. dotnet_diagnostic.CA1064.severity = warning # Implement 'IEquatable' when overriding 'Equals'. dotnet_diagnostic.CA1066.severity = warning # Override 'Equals' when implementing 'IEquatable'. dotnet_diagnostic.CA1067.severity = warning # 'CancellationToken' parameters must come last. dotnet_diagnostic.CA1068.severity = warning # Do not declare event fields as virtual. dotnet_diagnostic.CA1070.severity = warning ### Documentation Rules ### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/documentation-warnings # Avoid using 'cref' tags with a prefix. dotnet_diagnostic.CA1200.severity = warning ### Globalization Rules ### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/globalization-warnings # Specify 'CultureInfo'. dotnet_diagnostic.CA1304.severity = warning # Specify 'IFormatProvider'. dotnet_diagnostic.CA1305.severity = warning # Specify 'StringComparison' for correctness. dotnet_diagnostic.CA1310.severity = warning # Specify a culture or use an invariant version. dotnet_diagnostic.CA1311.severity = suggestion # TODO: Change to warning once using .NET 7 or later. ### Portability and Interoperability Rules ### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/interoperability-warnings # Do not use 'OutAttribute' on string parameters for P/Invokes. dotnet_diagnostic.CA1417.severity = warning ### Maintainability Rules ### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/maintainability-warnings # Use 'nameof' in place of string. dotnet_diagnostic.CA1507.severity = warning # Use ArgumentNullException throw helper. dotnet_diagnostic.CA1510.severity = suggestion # TODO: Change to warning once using .NET 7 or later. # Use ArgumentException throw helper. dotnet_diagnostic.CA1511.severity = suggestion # TODO: Change to warning once using .NET 7 or later. # Use ArgumentOutOfRangeException throw helper. dotnet_diagnostic.CA1512.severity = suggestion # TODO: Change to warning once using .NET 8 or later. # Use ObjectDisposedException throw helper. dotnet_diagnostic.CA1513.severity = suggestion # TODO: Change to warning once using .NET 7 or later. # Avoid redundant length argument. dotnet_diagnostic.CA1514.severity = suggestion # TODO: Change to warning once using .NET 8 or later. ### Naming Rules ### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/naming-warnings # Do not prefix enum values with type name. dotnet_code_quality.CA1712.enum_values_prefix_trigger = AnyEnumValue dotnet_diagnostic.CA1712.severity = warning # Flags enums should have plural names. dotnet_diagnostic.CA1714.severity = warning # Only 'FlagsAttribute' enums should have plural names. dotnet_diagnostic.CA1717.severity = warning ### Performance Rules ### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/performance-warnings # Use Literals Where Appropriate. #dotnet_code_quality.CA1802.required_modifiers = static dotnet_diagnostic.CA1802.severity = warning # Remove empty finalizers. dotnet_diagnostic.CA1821.severity = warning # Mark members as static. dotnet_code_quality.CA1822.api_surface = private,internal dotnet_diagnostic.CA1822.severity = warning # Avoid unused private fields. dotnet_diagnostic.CA1823.severity = warning # Avoid zero-length array allocations. dotnet_diagnostic.CA1825.severity = warning # Use property instead of Linq Enumerable method. #dotnet_code_quality.CA1826.exclude_ordefault_methods = false dotnet_diagnostic.CA1826.severity = warning # Do not use Count/LongCount when Any can be used. dotnet_diagnostic.CA1827.severity = warning # Do not use CountAsync/LongCountAsync when AnyAsync can be used. dotnet_diagnostic.CA1828.severity = warning # Use Length/Count property instead of Enumerable.Count method. dotnet_diagnostic.CA1829.severity = warning # Prefer strongly-typed Append and Insert method overloads on StringBuilder. dotnet_diagnostic.CA1830.severity = warning # Use AsSpan instead of Range-based indexers for string when appropriate. dotnet_diagnostic.CA1831.severity = warning # Use AsSpan or AsMemory instead of Range-based indexers for getting ReadOnlySpan or ReadOnlyMemory portion of an array. dotnet_diagnostic.CA1832.severity = warning # Use AsSpan or AsMemory instead of Range-based indexers for getting Span or Memory portion of an array. dotnet_diagnostic.CA1833.severity = warning # Use StringBuilder.Append(char) for single character strings. dotnet_diagnostic.CA1834.severity = warning # Prefer the memory-based overloads of ReadAsync/WriteAsync methods in stream-based classes. dotnet_diagnostic.CA1835.severity = warning # Prefer IsEmpty over Count when available. dotnet_diagnostic.CA1836.severity = warning # Use Environment.ProcessId instead of Process.GetCurrentProcess().Id. dotnet_diagnostic.CA1837.severity = warning # Avoid StringBuilder parameters for P/Invokes. dotnet_diagnostic.CA1838.severity = warning # Use Environment.ProcessPath instead of Process.GetCurrentProcess().MainModule.FileName. dotnet_diagnostic.CA1839.severity = warning # Use Environment.CurrentManagedThreadId instead of Thread.CurrentThread.ManagedThreadId. dotnet_diagnostic.CA1840.severity = warning # Prefer Dictionary Contains methods. dotnet_diagnostic.CA1841.severity = warning # Do not use 'WhenAll' with a single task. dotnet_diagnostic.CA1842.severity = warning # Do not use 'WaitAll' with a single task. dotnet_diagnostic.CA1843.severity = warning # Provide memory-based overrides of async methods when subclassing 'Stream'. dotnet_diagnostic.CA1844.severity = warning # Use span-based 'string.Concat'. (Not available on mono) dotnet_diagnostic.CA1845.severity = none # Prefer AsSpan over Substring. dotnet_diagnostic.CA1846.severity = warning # Use string.Contains(char) instead of string.Contains(string) with single characters. dotnet_diagnostic.CA1847.severity = warning # Call async methods when in an async method. dotnet_diagnostic.CA1849.severity = suggestion # TODO: Change to warning once using .NET 7 or later. # Prefer static HashData method over ComputeHash. (Not available on mono) dotnet_diagnostic.CA1850.severity = none # TODO: Change to warning once using .NET 7 or later AND once supported by mono. # Possible multiple enumerations of IEnumerable collection. #dotnet_code_quality.CA1851.enumeration_methods = dotnet_code_quality.CA1851.linq_chain_methods = M:OpenRA.Traits.IRenderModifier.Modify* dotnet_code_quality.CA1851.assume_method_enumerates_parameters = true dotnet_diagnostic.CA1851.severity = suggestion # TODO: Change to warning once using .NET 7 or later. # Seal internal types. dotnet_diagnostic.CA1852.severity = suggestion # TODO: Change to warning once using .NET 7 or later. # Unnecessary call to 'Dictionary.ContainsKey(key)'. dotnet_diagnostic.CA1853.severity = suggestion # TODO: Change to warning once using .NET 7 or later. # Prefer the IDictionary.TryGetValue(TKey, out TValue) method. dotnet_diagnostic.CA1854.severity = suggestion # TODO: Change to warning once using .NET 7 or later. # Use Span.Clear() instead of Span.Fill(). dotnet_diagnostic.CA1855.severity = suggestion # TODO: Change to warning once using .NET 7 or later. # Incorrect usage of ConstantExpected attribute. dotnet_diagnostic.CA1856.severity = suggestion # TODO: Change to warning once using .NET 7 or later. # The parameter expects a constant for optimal performance. dotnet_diagnostic.CA1857.severity = suggestion # TODO: Change to warning once using .NET 7 or later. # Use StartsWith instead of IndexOf. dotnet_diagnostic.CA1858.severity = warning # Avoid using 'Enumerable.Any()' extension method. dotnet_diagnostic.CA1860.severity = warning # Use the 'StringComparison' method overloads to perform case-insensitive string comparisons. dotnet_diagnostic.CA1862.severity = warning # Use 'CompositeFormat'. dotnet_diagnostic.CA1863.severity = suggestion # TODO: Change to warning once using .NET 7 or later. # Prefer the 'IDictionary.TryAdd(TKey, TValue)' method. dotnet_diagnostic.CA1864.severity = suggestion # TODO: Change to warning once using .NET 8 or later. # Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char. dotnet_diagnostic.CA1865.severity = suggestion # TODO: Change to warning once using .NET 8 or later. dotnet_diagnostic.CA1866.severity = suggestion # TODO: Change to warning once using .NET 8 or later. dotnet_diagnostic.CA1867.severity = suggestion # TODO: Change to warning once using .NET 8 or later. # Unnecessary call to 'Contains' for sets. dotnet_diagnostic.CA1868.severity = suggestion # TODO: Change to warning once using .NET 8 or later. # Cache and reuse 'JsonSerializerOptions' instances. dotnet_diagnostic.CA1869.severity = suggestion # TODO: Change to warning once using .NET 8 or later. # Use a cached 'SearchValues' instance. dotnet_diagnostic.CA1870.severity = suggestion # TODO: Change to warning once using .NET 8 or later. # Do not pass a nullable struct to 'ArgumentNullException.ThrowIfNull'. dotnet_diagnostic.CA1871.severity = warning # Prefer 'Convert.ToHexString' and 'Convert.ToHexStringLower' over call chains based on 'BitConverter.ToString'. dotnet_diagnostic.CA1872.severity = warning ### Reliability Rules ### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/reliability-warnings # Do not assign property within its setter. dotnet_diagnostic.CA2011.severity = warning # Use ValueTasks correctly. dotnet_diagnostic.CA2012.severity = warning # Do not use ReferenceEquals with value types. dotnet_diagnostic.CA2013.severity = warning # Do not use stackalloc in loops. dotnet_diagnostic.CA2014.severity = warning # Forward the CancellationToken parameter to methods that take one. dotnet_diagnostic.CA2016.severity = warning # The 'count' argument to Buffer.BlockCopy should specify the number of bytes to copy. dotnet_diagnostic.CA2018.severity = warning # ThreadStatic fields should not use inline initialization. dotnet_diagnostic.CA2019.severity = suggestion # TODO: Change to warning once using .NET 7 or later. # Don't call Enumerable.Cast or Enumerable.OfType with incompatible types. dotnet_diagnostic.CA2021.severity = warning # Avoid inexact read with Stream.Read. dotnet_diagnostic.CA2022.severity = warning ### Security Rules ### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/security-warnings # Do Not Use Broken Cryptographic Algorithms. dotnet_diagnostic.CA5351.severity = warning ### Usage Rules ### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/usage-warnings # Call GC.SuppressFinalize correctly. dotnet_diagnostic.CA1816.severity = warning # Rethrow to preserve stack details. dotnet_diagnostic.CA2200.severity = warning # Initialize value type static fields inline. dotnet_diagnostic.CA2207.severity = warning # Instantiate argument exceptions correctly. dotnet_diagnostic.CA2208.severity = warning # Non-constant fields should not be visible. dotnet_diagnostic.CA2211.severity = silent # Dispose methods should call base class dispose. dotnet_diagnostic.CA2215.severity = warning # Disposable types should declare finalizer. dotnet_diagnostic.CA2216.severity = warning # Override GetHashCode on overriding Equals. dotnet_diagnostic.CA2218.severity = warning # Overload operator equals on overriding ValueType.Equals. dotnet_diagnostic.CA2231.severity = warning # Provide correct arguments to formatting methods. #dotnet_code_quality.CA2241.additional_string_formatting_methods = #dotnet_code_quality.CA2241.try_determine_additional_string_formatting_methods_automatically = false dotnet_diagnostic.CA2241.severity = warning # Test for NaN correctly. dotnet_diagnostic.CA2242.severity = warning # Attribute string literals should parse correctly. dotnet_diagnostic.CA2243.severity = warning # Do not duplicate indexed element initializations. dotnet_diagnostic.CA2244.severity = warning # Do not assign a property to itself. dotnet_diagnostic.CA2245.severity = warning # Argument passed to TaskCompletionSource constructor should be TaskCreationOptions enum instead of TaskContinuationOptions enum. dotnet_diagnostic.CA2247.severity = warning # Provide correct enum argument to Enum.HasFlag. dotnet_diagnostic.CA2248.severity = warning # Consider using String.Contains instead of String.IndexOf. dotnet_diagnostic.CA2249.severity = warning # Use ThrowIfCancellationRequested. dotnet_diagnostic.CA2250.severity = warning # Use String.Equals over String.Compare. dotnet_diagnostic.CA2251.severity = warning # Ensure ThreadStatic is only used with static fields. dotnet_diagnostic.CA2259.severity = suggestion # TODO: Change to warning once using .NET 7 or later. # Prefer generic overload when type is known. dotnet_diagnostic.CA2263.severity = none # TODO: Change to warning once mono is dropped. # Do not pass a non-nullable value to 'ArgumentNullException.ThrowIfNull'. dotnet_diagnostic.CA2264.severity = warning # Do not compare 'Span' to 'null' or 'default'. dotnet_diagnostic.CA2265.severity = warning ### Roslynator.Analyzers ### https://josefpihrt.github.io/docs/roslynator/analyzers # We disable the rule category by setting severity to none. # Below we enable specific rules by setting severity to warning. # Rules are listed below with any options available. # Options are commented out if they match the defaults. dotnet_analyzer_diagnostic.category-roslynator.severity = none # A line is too long. dotnet_diagnostic.RCS0056.severity = warning roslynator_max_line_length = 160 #140 #roslynator_tab_length = 4 # Remove redundant 'sealed' modifier. dotnet_diagnostic.RCS1034.severity = warning # Remove argument list from attribute. dotnet_diagnostic.RCS1039.severity = warning # Remove empty initializer. dotnet_diagnostic.RCS1041.severity = warning # Remove enum default underlying type. dotnet_diagnostic.RCS1042.severity = warning # Remove 'partial' modifier from type with a single part. dotnet_diagnostic.RCS1043.severity = warning # Use lambda expression instead of anonymous method. dotnet_diagnostic.RCS1048.severity = warning # Simplify boolean comparison. dotnet_diagnostic.RCS1049.severity = warning # Use compound assignment. dotnet_diagnostic.RCS1058.severity = warning # Avoid locking on publicly accessible instance. dotnet_diagnostic.RCS1059.severity = warning # Merge 'if' with nested 'if'. dotnet_diagnostic.RCS1061.severity = warning # Remove empty 'finally' clause. dotnet_diagnostic.RCS1066.severity = warning # Simplify logical negation. dotnet_diagnostic.RCS1068.severity = warning # Remove redundant base constructor call. dotnet_diagnostic.RCS1071.severity = warning # Remove empty namespace declaration. dotnet_diagnostic.RCS1072.severity = warning # Remove redundant constructor. dotnet_diagnostic.RCS1074.severity = warning # Optimize LINQ method call. dotnet_diagnostic.RCS1077.severity = warning # Use 'Count' property instead of 'Any' method. dotnet_diagnostic.RCS1080.severity = warning # Use coalesce expression instead of conditional expression. dotnet_diagnostic.RCS1084.severity = warning # Use --/++ operator instead of assignment. dotnet_diagnostic.RCS1089.severity = warning # Remove empty region. dotnet_diagnostic.RCS1091.severity = warning # Default label should be the last label in a switch section. dotnet_diagnostic.RCS1099.severity = warning # Unnecessary interpolation. dotnet_diagnostic.RCS1105.severity = warning # Remove redundant 'ToCharArray' call. dotnet_diagnostic.RCS1107.severity = warning # Add 'static' modifier to all partial class declarations. dotnet_diagnostic.RCS1108.severity = warning # Combine 'Enumerable.Where' method chain. dotnet_diagnostic.RCS1112.severity = warning # Use 'string.IsNullOrEmpty' method. dotnet_diagnostic.RCS1113.severity = warning # Mark local variable as const. dotnet_diagnostic.RCS1118.severity = warning # Bitwise operation on enum without Flags attribute. dotnet_diagnostic.RCS1130.severity = warning # Remove redundant overriding member. dotnet_diagnostic.RCS1132.severity = warning # Remove redundant Dispose/Close call. dotnet_diagnostic.RCS1133.severity = warning # Remove redundant statement. dotnet_diagnostic.RCS1134.severity = warning # Merge switch sections with equivalent content. dotnet_diagnostic.RCS1136.severity = warning # Simplify coalesce expression. dotnet_diagnostic.RCS1143.severity = warning # Remove redundant cast. dotnet_diagnostic.RCS1151.severity = warning # Use StringComparison when comparing strings. dotnet_diagnostic.RCS1155.severity = warning # Use EventHandler. dotnet_diagnostic.RCS1159.severity = warning # Unused type parameter. dotnet_diagnostic.RCS1164.severity = warning # Use read-only auto-implemented property. dotnet_diagnostic.RCS1170.severity = warning # Use 'is' operator instead of 'as' operator. dotnet_diagnostic.RCS1172.severity = warning # Unused 'this' parameter. dotnet_diagnostic.RCS1175.severity = warning # Unnecessary assignment. dotnet_diagnostic.RCS1179.severity = warning # Use constant instead of field. dotnet_diagnostic.RCS1187.severity = warning # Join string expressions. dotnet_diagnostic.RCS1190.severity = warning # Declare enum value as combination of names. dotnet_diagnostic.RCS1191.severity = warning # Unnecessary usage of verbatim string literal. dotnet_diagnostic.RCS1192.severity = warning # Overriding member should not change 'params' modifier. dotnet_diagnostic.RCS1193.severity = warning # Use ^ operator. dotnet_diagnostic.RCS1195.severity = warning # Unnecessary null check. dotnet_diagnostic.RCS1199.severity = warning # Use EventArgs.Empty. dotnet_diagnostic.RCS1204.severity = warning # Order named arguments according to the order of parameters. dotnet_diagnostic.RCS1205.severity = warning # Order type parameter constraints. dotnet_diagnostic.RCS1209.severity = warning # Unnecessary interpolated string. dotnet_diagnostic.RCS1214.severity = warning # Expression is always equal to 'true'. dotnet_diagnostic.RCS1215.severity = warning # Unnecessary unsafe context. dotnet_diagnostic.RCS1216.severity = warning # Simplify code branching. dotnet_diagnostic.RCS1218.severity = warning # Use pattern matching instead of combination of 'is' operator and cast operator. dotnet_diagnostic.RCS1220.severity = warning # Make class sealed. dotnet_diagnostic.RCS1225.severity = warning # Add paragraph to documentation comment. dotnet_diagnostic.RCS1226.severity = warning # Validate arguments correctly. dotnet_diagnostic.RCS1227.severity = warning # Unnecessary explicit use of enumerator. dotnet_diagnostic.RCS1230.severity = warning # Use short-circuiting operator. dotnet_diagnostic.RCS1233.severity = warning # Optimize method call. dotnet_diagnostic.RCS1235.severity = warning # Use exception filter. dotnet_diagnostic.RCS1236.severity = warning # Use 'for' statement instead of 'while' statement. dotnet_diagnostic.RCS1239.severity = warning # Use element access. dotnet_diagnostic.RCS1246.severity = warning ================================================ FILE: .gitattributes ================================================ # Enforce LF normalization on Windows *.yaml eol=lf *.lua eol=lf *.cs eol=lf *.csproj eol=lf *.sln eol=lf * text=lf # Custom for Visual Studio *.cs diff=csharp ================================================ FILE: .github/dependabot.yml ================================================ version: 2 updates: - package-ecosystem: github-actions directory: "/" schedule: interval: daily ================================================ FILE: .github/workflows/ci.yml ================================================ name: Continuous Integration on: push: pull_request: permissions: contents: read # to fetch code (actions/checkout) jobs: linux: name: Linux (.NET 6.0) runs-on: ubuntu-22.04 steps: - name: Remove System .NET run: sudo apt-get remove -y dotnet* - name: Clone Repository uses: actions/checkout@v6 - name: Install .NET 6.0 uses: actions/setup-dotnet@v5 with: dotnet-version: '6.0.x' - name: Prepare Environment run: | . mod.config; awk '/\r$$/ { exit(1); }' mod.config || (printf "Invalid mod.config format. File must be saved using unix-style (LF, not CRLF or CR) line endings.\n"; exit 1); - name: Check Code run: | make check make check-packaging-scripts - name: Check Mod run: | sudo apt-get install lua5.1 make check-scripts make TREAT_WARNINGS_AS_ERRORS=true test linux-mono: name: Linux (mono) runs-on: ubuntu-22.04 steps: - name: Clone Repository uses: actions/checkout@v6 - name: Prepare Environment run: | . mod.config; awk '/\r$$/ { exit(1); }' mod.config || (printf "Invalid mod.config format. File must be saved using unix-style (LF, not CRLF or CR) line endings.\n"; exit 1); - name: Check Code run: | # check-packaging-scripts does not depend on .net/mono, so is not needed here mono --version make RUNTIME=mono check - name: Check Mod run: | # check-scripts does not depend on .net/mono, so is not needed here make RUNTIME=mono TREAT_WARNINGS_AS_ERRORS=true test windows: name: Windows (.NET 6.0) runs-on: windows-2022 steps: - name: Clone Repository uses: actions/checkout@v6 - name: Install .NET 6.0 uses: actions/setup-dotnet@v5 with: dotnet-version: '6.0.x' - name: Check Code shell: powershell run: | # Work around runtime failures on the GH Actions runner dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org .\make.ps1 check - name: Check Mods run: | choco install lua --version 5.1.5.52 $ENV:Path = $ENV:Path + ";C:\Program Files (x86)\Lua\5.1\" $ENV:TREAT_WARNINGS_AS_ERRORS = "true" .\make.ps1 check-scripts .\make.ps1 test ================================================ FILE: .github/workflows/packaging.yml ================================================ name: Release Packaging on: push: tags: - '*' permissions: contents: write # for release creation (svenstaro/upload-release-action) jobs: linux: name: Linux AppImages runs-on: ubuntu-22.04 steps: - name: Clone Repository uses: actions/checkout@v6 - name: Install .NET 6.0 uses: actions/setup-dotnet@v5 with: dotnet-version: '6.0.x' - name: Prepare Environment run: echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_ENV} - name: Package AppImage run: | make engine mkdir -p build/linux sudo apt-get install -y desktop-file-utils ./packaging/linux/buildpackage.sh "${GIT_TAG}" "${PWD}/build/linux" - name: Upload Packages env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} shell: bash run: | gh release upload ${{ github.ref_name }} build/linux/* macos: name: macOS Disk Image runs-on: macos-13 steps: - name: Clone Repository uses: actions/checkout@v6 - name: Install .NET 6.0 uses: actions/setup-dotnet@v5 with: dotnet-version: '6.0.x' - name: Prepare Environment run: echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_ENV} - name: Package Disk Image env: MACOS_DEVELOPER_IDENTITY: ${{ secrets.MACOS_DEVELOPER_IDENTITY }} MACOS_DEVELOPER_CERTIFICATE_BASE64: ${{ secrets.MACOS_DEVELOPER_CERTIFICATE_BASE64 }} MACOS_DEVELOPER_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_DEVELOPER_CERTIFICATE_PASSWORD }} MACOS_DEVELOPER_USERNAME: ${{ secrets.MACOS_DEVELOPER_USERNAME }} MACOS_DEVELOPER_PASSWORD: ${{ secrets.MACOS_DEVELOPER_PASSWORD }} run: | make engine mkdir -p build/macos ./packaging/macos/buildpackage.sh "${GIT_TAG}" "${PWD}/build/macos" - name: Upload Package env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} shell: bash run: | gh release upload ${{ github.ref_name }} build/macos/* windows: name: Windows Installers runs-on: ubuntu-22.04 steps: - name: Clone Repository uses: actions/checkout@v6 - name: Install .NET 6.0 uses: actions/setup-dotnet@v5 with: dotnet-version: '6.0.x' - name: Prepare Environment run: | echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_ENV} sudo apt-get update sudo apt-get install nsis wine64 - name: Package Installers run: | make engine mkdir -p build/windows ./packaging/windows/buildpackage.sh "${GIT_TAG}" "${PWD}/build/windows" - name: Upload Packages env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} shell: bash run: | gh release upload ${{ github.ref_name }} build/windows/* ================================================ FILE: .gitignore ================================================ user.config engine # Visual Studio Release bin obj *.ncb *.vcproj* *.suo *.user *.sln.cache *.manifest *.CodeAnalysisLog.xml *.lastcodeanalysissucceeded _ReSharper.*/ /.vs # Visual Studio Code /.vscode/settings.json # backup files by various editors *~ *.orig \#* .*.sw? # Monodevelop *.pidb *.userprefs # Mac OS X .DS_Store # SublimeText *.sublime-project *.sublime-workspace # NUnit /TestResult.xml /lib/ # Support directory /Support # IntelliJ files .idea ================================================ FILE: .vscode/extensions.json ================================================ { "recommendations": [ "EditorConfig.EditorConfig", "ms-dotnettools.csharp", "openra.oraide-vscode", "openra.vscode-openra-lua", "macabeus.vscode-fluent", ] } ================================================ FILE: .vscode/launch.json ================================================ { "version": "0.2.0", "configurations": [ { "name": "Launch (Example)", "type": "coreclr", "request": "launch", "program": "${workspaceRoot}/engine/bin/OpenRA.dll", "args": [ "Game.Mod=example", "Engine.EngineDir=${workspaceRoot}/engine", "Engine.ModSearchPaths=${workspaceRoot}/mods, ${workspaceRoot}/engine/mods", "Debug.DisplayDeveloperSettings=true", ], "preLaunchTask": "build", }, { "name": "Launch Utility", "type": "coreclr", "request": "launch", "program": "${workspaceRoot}/engine/bin/OpenRA.Utility.dll", "args": ["example", "--check-yaml"], "env": { "ENGINE_DIR": "${workspaceRoot}/engine", "MOD_SEARCH_PATHS": "${workspaceRoot}/mods, ${workspaceRoot}/engine/mods" }, "preLaunchTask": "build", }, ], } ================================================ FILE: .vscode/tasks.json ================================================ { "version": "2.0.0", "tasks": [ { "label": "build", "command": "make", "args": ["all", "CONFIGURATION=Debug"], "windows": { "command": "make.cmd" } }, { "label": "Run Utility", "command": "dotnet ${workspaceRoot}/engine/bin/OpenRA.Utility.dll ${input:modId} ${input:command}", "type": "shell", "options": { "env": { "ENGINE_DIR": "${workspaceRoot}/engine", "MOD_SEARCH_PATHS": "${workspaceRoot}/mods,${workspaceRoot}/engine/mods" } } } ], "inputs": [ { "id": "modId", "description": "ID of the mod to run", "default": "all", "type": "promptString" }, { "id": "command", "description": "Name of the command + parameters", "default": "", "type": "promptString" }, ] } ================================================ FILE: CODE_OF_CONDUCT.md ================================================ # Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by private-messaging a project team member (users with a + in front of their name) via our IRC channel (#openra on Libera – [webchat](https://web.libera.chat/#openra)). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [https://contributor-covenant.org/version/1/4][version] [homepage]: https://contributor-covenant.org [version]: https://contributor-covenant.org/version/1/4/ ================================================ FILE: CONTRIBUTING.md ================================================ # OpenRA Mod SDK Contributing Guidelines Thank you for your interest in OpenRA, OpenRA modding, and the OpenRA Mod SDK. OpenRA is an open source project, and our community members – you – are the driving force behind it. There are many ways to contribute, from writing tutorials or blog posts, improving the documentation, submitting bug reports and feature requests or writing code which can be incorporated into OpenRA, the Mod SDK, or our other sub-projects. Please note that this repository is specifically for the scripts and infrastructure used to develop and build mods; bugs and feature requests against OpenRA itself should be directed to [the main OpenRA/OpenRA repository](https://github.com/OpenRA/OpenRA). If you do come across a bug with the Mod SDK, or would like to request a new feature, then please take a look at the issue tracker first to see if it has already been reported. When developing new features, it is important to make sure that they work on all our supported platforms. Right now, this means Windows >= 7 (with PowerShell >= 3), macOS >= 10.7, and Linux. We would like to also support *BSD, but do not currently have a means to test this. Some issues to be aware of include: * Use https://www.shellcheck.net/ to confirm POSIX compatibility of *.sh scripts. * Avoid non-standard gnu extensions to common Unix tools (e.g. the `-f` flag from GNU `readlink`) While your pull-request is in review it will be helpful if you join IRC to discuss the changes. See also the in-depth guide on [contributing](https://github.com/OpenRA/OpenRA/wiki/Contributing) on the main OpenRA project wiki. Most of the content on this page also applies to the Mod SDK. ================================================ FILE: COPYING ================================================ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ================================================ FILE: ExampleMod.sln ================================================ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Mods.Example", "OpenRA.Mods.Example\OpenRA.Mods.Example.csproj", "{4E5B38F7-4E99-4C92-BB39-9100CC7F3829}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Game", "engine\OpenRA.Game\OpenRA.Game.csproj", "{0DFB103F-2962-400F-8C6D-E2C28CCBA633}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Mods.Common", "engine\OpenRA.Mods.Common\OpenRA.Mods.Common.csproj", "{FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU Release-x86|Any CPU = Release-x86|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Debug|Any CPU.Build.0 = Debug|Any CPU {4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Release|Any CPU.ActiveCfg = Release|Any CPU {4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Release|Any CPU.Build.0 = Release|Any CPU {4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Release-x86|Any CPU.ActiveCfg = Release|Any CPU {4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Release-x86|Any CPU.Build.0 = Release|Any CPU {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug|Any CPU.Build.0 = Debug|Any CPU {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release|Any CPU.ActiveCfg = Release|Any CPU {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release|Any CPU.Build.0 = Release|Any CPU {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release-x86|Any CPU.ActiveCfg = Release-x86|Any CPU {0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release-x86|Any CPU.Build.0 = Release-x86|Any CPU {FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Debug|Any CPU.Build.0 = Debug|Any CPU {FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Release|Any CPU.ActiveCfg = Release|Any CPU {FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Release|Any CPU.Build.0 = Release|Any CPU {FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Release-x86|Any CPU.ActiveCfg = Release|Any CPU {FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Release-x86|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal ================================================ FILE: Makefile ================================================ ############################# INSTRUCTIONS ############################# # # to compile, run: # make # # to compile using Mono (version 6.12 or greater) instead of .NET 6, run: # make RUNTIME=mono # # to compile using system libraries for native dependencies, run: # make [RUNTIME=net6] TARGETPLATFORM=unix-generic # # to remove the files created by compiling, run: # make clean # # to set the mods version, run: # make version [VERSION="custom-version"] # # to check lua scripts for syntax errors, run: # make check-scripts # # to check the engine and your mod dlls for StyleCop violations, run: # make [RUNTIME=net6] check # # to check your mod yaml for errors, run: # make [RUNTIME=net6] [TREAT_WARNINGS_AS_ERRORS=false] test # # the following are internal sdk helpers that are not intended to be run directly: # make check-variables # make check-sdk-scripts # make check-packaging-scripts .PHONY: check-sdk-scripts check-packaging-scripts check-variables engine all clean version check-scripts check test .DEFAULT_GOAL := all PYTHON = $(shell command -v python3 2> /dev/null) ifeq ($(PYTHON),) PYTHON = $(shell command -v python 2> /dev/null) endif ifeq ($(PYTHON),) $(error "The OpenRA mod SDK requires python.") endif VERSION = $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || echo git-`git rev-parse --short HEAD`) MOD_ID = $(shell cat user.config mod.config 2> /dev/null | awk -F= '/MOD_ID/ { print $$2; exit }') ENGINE_DIRECTORY = $(shell cat user.config mod.config 2> /dev/null | awk -F= '/ENGINE_DIRECTORY/ { print $$2; exit }') MOD_SEARCH_PATHS = "$(shell $(PYTHON) -c "import os; print(os.path.realpath('.'))")/mods,./mods" MANIFEST_PATH = "mods/$(MOD_ID)/mod.yaml" HAS_LUAC = $(shell command -v luac 2> /dev/null) LUA_FILES = $(shell find mods/*/maps/* -iname '*.lua' 2> /dev/null) MOD_SOLUTION_FILES = $(shell find . -maxdepth 1 -iname '*.sln' 2> /dev/null) MSBUILD = msbuild -verbosity:m -nologo DOTNET = dotnet RUNTIME ?= net6 CONFIGURATION ?= Release DOTNET_RID = $(shell ${DOTNET} --info | grep RID: | cut -w -f3) ARCH_X64 = $(shell echo ${DOTNET_RID} | grep x64) ifndef TARGETPLATFORM UNAME_S := $(shell uname -s) UNAME_M := $(shell uname -m) ifeq ($(UNAME_S),Darwin) ifeq ($(ARCH_X64),) TARGETPLATFORM = osx-arm64 else TARGETPLATFORM = osx-x64 endif else ifeq ($(UNAME_M),x86_64) TARGETPLATFORM = linux-x64 else ifeq ($(UNAME_M),aarch64) TARGETPLATFORM = linux-arm64 else TARGETPLATFORM = unix-generic endif endif endif endif check-sdk-scripts: @awk '/\r$$/ { exit(1); }' mod.config || (printf "Invalid mod.config format: file must be saved using unix-style (CR, not CRLF) line endings.\n"; exit 1) @if [ ! -x "fetch-engine.sh" ] || [ ! -x "launch-dedicated.sh" ] || [ ! -x "launch-game.sh" ] || [ ! -x "utility.sh" ]; then \ echo "Required SDK scripts are not executable:"; \ if [ ! -x "fetch-engine.sh" ]; then \ echo " fetch-engine.sh"; \ fi; \ if [ ! -x "launch-dedicated.sh" ]; then \ echo " launch-dedicated.sh"; \ fi; \ if [ ! -x "launch-game.sh" ]; then \ echo " launch-game.sh"; \ fi; \ if [ ! -x "utility.sh" ]; then \ echo " utility.sh"; \ fi; \ echo "Repair their permissions and try again."; \ echo "If you are using git you can repair these permissions by running"; \ echo " git update-index --chmod=+x *.sh"; \ echo "and commiting the changed files to your repository."; \ exit 1; \ fi check-packaging-scripts: @if [ ! -x "packaging/package-all.sh" ] || [ ! -x "packaging/linux/buildpackage.sh" ] || [ ! -x "packaging/macos/buildpackage.sh" ] || [ ! -x "packaging/windows/buildpackage.sh" ]; then \ echo "Required SDK scripts are not executable:"; \ if [ ! -x "packaging/package-all.sh" ]; then \ echo " packaging/package-all.sh"; \ fi; \ if [ ! -x "packaging/linux/buildpackage.sh" ]; then \ echo " packaging/linux/buildpackage.sh"; \ fi; \ if [ ! -x "packaging/macos/buildpackage.sh" ]; then \ echo " packaging/macos/buildpackage.sh"; \ fi; \ if [ ! -x "packaging/windows/buildpackage.sh" ]; then \ echo " packaging/windows/buildpackage.sh"; \ fi; \ echo "Repair their permissions and try again."; \ echo "If you are using git you can repair these permissions by running"; \ echo " git update-index --chmod=+x *.sh"; \ echo "in the directories containing the affected files"; \ echo "and commiting the changed files to your repository."; \ exit 1; \ fi check-variables: @if [ -z "$(MOD_ID)" ] || [ -z "$(ENGINE_DIRECTORY)" ]; then \ echo "Required mod.config variables are missing:"; \ if [ -z "$(MOD_ID)" ]; then \ echo " MOD_ID"; \ fi; \ if [ -z "$(ENGINE_DIRECTORY)" ]; then \ echo " ENGINE_DIRECTORY"; \ fi; \ echo "Repair your mod.config (or user.config) and try again."; \ exit 1; \ fi engine: check-variables check-sdk-scripts @./fetch-engine.sh || (printf "Unable to continue without engine files\n"; exit 1) @cd $(ENGINE_DIRECTORY) && make RUNTIME=$(RUNTIME) TARGETPLATFORM=$(TARGETPLATFORM) all all: engine ifeq ($(RUNTIME), mono) @command -v $(MSBUILD) >/dev/null || (echo "OpenRA requires the '$(MSBUILD)' tool provided by Mono >= 6.12."; exit 1) ifneq ("$(MOD_SOLUTION_FILES)","") @find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:Build -restore -p:Configuration=${CONFIGURATION} -p:TargetPlatform=$(TARGETPLATFORM) -p:Mono=true \; endif else @find . -maxdepth 1 -name '*.sln' -exec $(DOTNET) build -c ${CONFIGURATION} -p:TargetPlatform=$(TARGETPLATFORM) \; endif clean: engine ifneq ("$(MOD_SOLUTION_FILES)","") ifeq ($(RUNTIME), mono) @find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:clean \; else @find . -maxdepth 1 -name '*.sln' -exec $(DOTNET) clean \; endif endif @cd $(ENGINE_DIRECTORY) && make clean version: check-variables @sh -c '. $(ENGINE_DIRECTORY)/packaging/functions.sh; set_mod_version $(VERSION) $(MANIFEST_PATH)' @printf "Version changed to $(VERSION).\n" check-scripts: check-variables ifeq ("$(HAS_LUAC)","") @printf "'luac' not found.\n" && exit 1 endif @echo @echo "Checking for Lua syntax errors..." ifneq ("$(LUA_FILES)","") @luac -p $(LUA_FILES) endif check: engine ifneq ("$(MOD_SOLUTION_FILES)","") @echo "Compiling in Debug mode..." ifeq ($(RUNTIME), mono) @$(MSBUILD) -t:clean\;build -restore -p:Configuration=Debug -warnaserror -p:TargetPlatform=$(TARGETPLATFORM) else @$(DOTNET) clean -c Debug --nologo --verbosity minimal @$(DOTNET) build -c Debug -nologo -warnaserror -p:TargetPlatform=$(TARGETPLATFORM) endif endif @echo "Checking for explicit interface violations..." @./utility.sh --check-explicit-interfaces @echo "Checking for incorrect conditional trait interface overrides..." @./utility.sh --check-conditional-trait-interface-overrides test: all @echo "Testing $(MOD_ID) mod MiniYAML..." @./utility.sh --check-yaml ================================================ FILE: OpenRA.Mods.Example/OpenRA.Mods.Example.csproj ================================================ ../engine False False Always ================================================ FILE: OpenRA.Mods.Example/Properties/launchSettings.json ================================================ { "profiles": { "OpenRA.Mods.Example": { "commandName": "Executable", "executablePath": "..\\..\\engine\\bin\\OpenRA.exe", "commandLineArgs": "Game.Mod=example Engine.EngineDir=..\\..\\engine Engine.LaunchPath=..\\..\\engine\\bin Engine.ModSearchPaths=..\\..\\mods,..\\..\\engine\\mods Debug.DisplayDeveloperSettings=true" }, "Utility": { "commandName": "Executable", "executablePath": "..\\..\\engine\\bin\\OpenRA.Utility.exe", "commandLineArgs": "example --check-yaml", "environmentVariables": { "ENGINE_DIR": "..\\..\\engine", "MOD_SEARCH_PATHS": "..\\..\\mods,..\\..\\engine\\mods" } } } } ================================================ FILE: OpenRA.Mods.Example/Rendering/ColorPickerColorShift.cs ================================================ #region Copyright & License Information /* * Copyright (c) The OpenRA Developers and Contributors * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. For more * information, see COPYING. */ #endregion using OpenRA.Graphics; using OpenRA.Mods.Common.Traits; using OpenRA.Primitives; using OpenRA.Traits; namespace OpenRA.Mods.Example.Rendering { [TraitLocation(SystemActors.World | SystemActors.EditorWorld)] [Desc("Create a color picker palette from another palette.")] public class ColorPickerColorShiftInfo : TraitInfo { [PaletteReference] [FieldLoader.Require] [Desc("The name of the palette to base off.")] public readonly string BasePalette = ""; [Desc("Hues between this and MaxHue will be shifted.")] public readonly float MinHue = 0.83f; [Desc("Hues between MinHue and this will be shifted.")] public readonly float MaxHue = 0.84f; [Desc("Hue reference for the color shift.")] public readonly float ReferenceHue = 0.835f; [Desc("Saturation reference for the color shift.")] public readonly float ReferenceSaturation = 1; [Desc("Value reference for the color shift.")] public readonly float ReferenceValue = 0.95f; public override object Create(ActorInitializer init) { return new ColorPickerColorShift(this); } } public class ColorPickerColorShift : ILoadsPalettes, ITickRender { readonly ColorPickerColorShiftInfo info; Color color; Color preferredColor; public ColorPickerColorShift(ColorPickerColorShiftInfo info) { // All users need to use the same TraitInfo instance, chosen as the default mod rules var colorManager = Game.ModData.DefaultRules.Actors[SystemActors.World].TraitInfo(); colorManager.OnColorPickerColorUpdate += c => preferredColor = c; preferredColor = Game.Settings.Player.Color; this.info = info; } void ILoadsPalettes.LoadPalettes(WorldRenderer worldRenderer) { color = preferredColor; var (r, g, b) = color.ToLinear(); var (hue, saturation, value) = Color.RgbToHsv(r, g, b); worldRenderer.SetPaletteColorShift( info.BasePalette, hue - info.ReferenceHue, saturation - info.ReferenceSaturation, value / info.ReferenceValue, info.MinHue, info.MaxHue); } void ITickRender.TickRender(WorldRenderer worldRenderer, Actor self) { if (color == preferredColor) return; color = preferredColor; var (r, g, b) = color.ToLinear(); var (hue, saturation, value) = Color.RgbToHsv(r, g, b); worldRenderer.SetPaletteColorShift( info.BasePalette, hue - info.ReferenceHue, saturation - info.ReferenceSaturation, value / info.ReferenceValue, info.MinHue, info.MaxHue); } } } ================================================ FILE: OpenRA.Mods.Example/Rendering/PlayerColorShift.cs ================================================ #region Copyright & License Information /* * Copyright (c) The OpenRA Developers and Contributors * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. For more * information, see COPYING. */ #endregion using OpenRA.Graphics; using OpenRA.Primitives; using OpenRA.Traits; namespace OpenRA.Mods.Example.Rendering { [TraitLocation(SystemActors.World | SystemActors.EditorWorld)] [Desc("Add color shifts to player palettes. Use to add RGBA compatibility to PlayerColorPalette.")] public class PlayerColorShiftInfo : TraitInfo { [PaletteReference(true)] [FieldLoader.Require] [Desc("The name of the palette to base off.")] public readonly string BasePalette = ""; [Desc("Hues between this and MaxHue will be shifted.")] public readonly float MinHue = 0.83f; [Desc("Hues between MinHue and this will be shifted.")] public readonly float MaxHue = 0.84f; [Desc("Hue reference for the color shift.")] public readonly float ReferenceHue = 0.835f; [Desc("Saturation reference for the color shift.")] public readonly float ReferenceSaturation = 1; [Desc("Value reference for the color shift.")] public readonly float ReferenceValue = 0.95f; public override object Create(ActorInitializer init) { return new PlayerColorShift(this); } } public class PlayerColorShift : ILoadsPlayerPalettes { readonly PlayerColorShiftInfo info; public PlayerColorShift(PlayerColorShiftInfo info) { this.info = info; } void ILoadsPlayerPalettes.LoadPlayerPalettes(WorldRenderer worldRenderer, string playerName, Color color, bool replaceExisting) { var (r, g, b) = color.ToLinear(); var (hue, saturation, value) = Color.RgbToHsv(r, g, b); worldRenderer.SetPaletteColorShift( info.BasePalette + playerName, hue - info.ReferenceHue, saturation - info.ReferenceSaturation, value / info.ReferenceValue, info.MinHue, info.MaxHue); } } } ================================================ FILE: README.md ================================================ This repository contains a bare development environment for creating a new mod/game on the [OpenRA](https://github.com/OpenRA/OpenRA) engine. These scripts and support files wrap and automatically manage a copy of the OpenRA game engine and common files during development, and generates Windows installers, macOS .app bundles, and Linux [AppImages](https://appimage.org/) for distribution. The key scripts in this SDK are: | Windows | Linux / macOS | Purpose | --------------------- | ------------------------ | ------------- | | make.cmd | Makefile | Compiles your project and fetches dependencies (including the OpenRA engine). | launch-game.cmd | launch-game.sh | Launches your project from the SDK directory. | launch-server.cmd | launch-server.sh | Launches a dedicated server for your project from the SDK directory. | utility.cmd | utility.sh | Launches the OpenRA Utility for your project. | <not available> | packaging/package-all.sh | Generates release installers for your project. To launch your project from the development environment you must first compile the project by running `make.cmd` (Windows), or opening a terminal in the SDK directory and running `make` (Linux / macOS). You can then run `launch-game.cmd` (Windows) or `launch-game.sh` (Linux / macOS) to run your game. The `example` mod included in this repository provides the bare minimum structure to launch to the in-game main menu for the sole purpose of demonstrating the SDK. See [Getting Started](https://github.com/OpenRA/OpenRAModTemplate/wiki/Getting-Started) on the Wiki for instructions on how to adapt this template for your own projects. For common questions, please see the [FAQ](https://github.com/OpenRA/OpenRAModSDK/wiki/FAQ). See [Updating to a new SDK or Engine version](https://github.com/OpenRA/OpenRAModSDK/wiki/Updating-to-a-new-SDK-or-Engine-version) for a guide on updating your mod a newer OpenRA release. The OpenRA engine and SDK scripts are made available under the [GPLv3](https://github.com/OpenRA/OpenRA/blob/bleed/COPYING) license, and any executable code developed by a mod and loaded by the engine (i.e. custom mod DLLs, lua scripts) must be released under a compatible license. Your mod data files (artwork, sound files, yaml, etc) are not part of your mod's source code, so you are free to distribute these assets under different terms (e.g. allowing redistribution in unmodified form, but not for use in other works). ================================================ FILE: fetch-engine.sh ================================================ #!/bin/sh # Helper script used to check and update engine dependencies # This should not be called manually command -v curl >/dev/null 2>&1 || command -v wget > /dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK requires curl or wget."; exit 1; } if command -v python3 >/dev/null 2>&1; then PYTHON="python3" else command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK requires python."; exit 1; } PYTHON="python" fi require_variables() { missing="" for i in "$@"; do eval check="\$$i" [ -z "${check}" ] && missing="${missing} ${i}\n" done if [ ! -z "${missing}" ]; then echo "Required mod.config variables are missing:\n${missing}Repair your mod.config (or user.config) and try again." exit 1 fi } TEMPLATE_LAUNCHER=$(${PYTHON} -c "import os; print(os.path.realpath('$0'))") TEMPLATE_ROOT=$(dirname "${TEMPLATE_LAUNCHER}") # shellcheck source=mod.config . "${TEMPLATE_ROOT}/mod.config" if [ -f "${TEMPLATE_ROOT}/user.config" ]; then # shellcheck source=user.config . "${TEMPLATE_ROOT}/user.config" fi require_variables "MOD_ID" "ENGINE_VERSION" "ENGINE_DIRECTORY" CURRENT_ENGINE_VERSION=$(cat "${ENGINE_DIRECTORY}/VERSION" 2> /dev/null) if [ -f "${ENGINE_DIRECTORY}/VERSION" ] && [ "${CURRENT_ENGINE_VERSION}" = "${ENGINE_VERSION}" ]; then exit 0 fi if [ "${AUTOMATIC_ENGINE_MANAGEMENT}" = "True" ]; then require_variables "AUTOMATIC_ENGINE_SOURCE" "AUTOMATIC_ENGINE_EXTRACT_DIRECTORY" "AUTOMATIC_ENGINE_TEMP_ARCHIVE_NAME" echo "OpenRA engine version ${ENGINE_VERSION} is required." if [ -d "${ENGINE_DIRECTORY}" ]; then if [ "${CURRENT_ENGINE_VERSION}" != "" ]; then echo "Deleting engine version ${CURRENT_ENGINE_VERSION}." else echo "Deleting existing engine (unknown version)." fi rm -rf "${ENGINE_DIRECTORY}" fi echo "Downloading engine..." if command -v curl > /dev/null 2>&1; then curl -s -L -o "${AUTOMATIC_ENGINE_TEMP_ARCHIVE_NAME}" -O "${AUTOMATIC_ENGINE_SOURCE}" || exit 3 else wget -cq "${AUTOMATIC_ENGINE_SOURCE}" -O "${AUTOMATIC_ENGINE_TEMP_ARCHIVE_NAME}" || exit 3 fi # Github zipballs package code with a top level directory named based on the refspec # Extract to a temporary directory and then move the subdir to our target location REFNAME=$(unzip -qql "${AUTOMATIC_ENGINE_TEMP_ARCHIVE_NAME}" | head -n1 | tr -s ' ' | cut -d' ' -f5-) rm -rf "${AUTOMATIC_ENGINE_EXTRACT_DIRECTORY}" mkdir "${AUTOMATIC_ENGINE_EXTRACT_DIRECTORY}" unzip -qq -d "${AUTOMATIC_ENGINE_EXTRACT_DIRECTORY}" "${AUTOMATIC_ENGINE_TEMP_ARCHIVE_NAME}" mv "${AUTOMATIC_ENGINE_EXTRACT_DIRECTORY}/${REFNAME}" "${ENGINE_DIRECTORY}" rmdir "${AUTOMATIC_ENGINE_EXTRACT_DIRECTORY}" rm "${AUTOMATIC_ENGINE_TEMP_ARCHIVE_NAME}" # HACK: Remove bogus lint check that the Example mod can't possibly pass # because to do so it would need to define a lot of excess things surrounding resources. rm ${ENGINE_DIRECTORY}/OpenRA.Mods.Common/Lint/CheckFluentReferences.cs echo "Compiling engine..." cd "${ENGINE_DIRECTORY}" || exit 1 make version VERSION="${ENGINE_VERSION}" exit 0 fi echo "Automatic engine management is disabled." echo "Please manually update the engine to version ${ENGINE_VERSION}." exit 1 ================================================ FILE: launch-dedicated.cmd ================================================ :: example launch script, see https://github.com/OpenRA/OpenRA/wiki/Dedicated-Server for details @echo on set Name="Dedicated Server" set Map="" set ListenPort=1234 set AdvertiseOnline=True set Password="" set RecordReplays=False set RequireAuthentication=False set ProfileIDBlacklist="" set ProfileIDWhitelist="" set EnableSingleplayer=False set EnableSyncReports=False set EnableGeoIP=True set EnableLintChecks=True set ShareAnonymizedIPs=True set FloodLimitJoinCooldown=5000 @echo off setlocal EnableDelayedExpansion title %Name% FOR /F "tokens=1,2 delims==" %%A IN (mod.config) DO (set %%A=%%B) if exist user.config (FOR /F "tokens=1,2 delims==" %%A IN (user.config) DO (set %%A=%%B)) set MOD_SEARCH_PATHS=%~dp0mods,./mods if "!MOD_ID!" == "" goto badconfig if "!ENGINE_VERSION!" == "" goto badconfig if "!ENGINE_DIRECTORY!" == "" goto badconfig if not exist %ENGINE_DIRECTORY%\bin\OpenRA.exe goto noengine >nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine cd %ENGINE_DIRECTORY% :loop bin\OpenRA.Server.exe Game.Mod=%MOD_ID% Engine.EngineDir=".." Server.Name=%Name% Server.Map=%Map% Server.ListenPort=%ListenPort% Server.AdvertiseOnline=%AdvertiseOnline% Server.EnableSingleplayer=%EnableSingleplayer% Server.Password=%Password% Server.RequireAuthentication=%RequireAuthentication% Server.RecordReplays=%RecordReplays% Server.ProfileIDBlacklist=%ProfileIDBlacklist% Server.ProfileIDWhitelist=%ProfileIDWhitelist% Server.EnableSyncReports=%EnableSyncReports% Server.EnableGeoIP=%EnableGeoIP% Server.ShareAnonymizedIPs=%ShareAnonymizedIPs% Server.EnableLintChecks=%EnableLintChecks% Engine.SupportDir=%SupportDir% Server.FloodLimitJoinCooldown=%FloodLimitJoinCooldown% goto loop :noengine echo Required engine files not found. echo Run `make all` in the mod directory to fetch and build the required files, then try again. pause exit /b :badconfig echo Required mod.config variables are missing. echo Ensure that MOD_ID ENGINE_VERSION and ENGINE_DIRECTORY are echo defined in your mod.config (or user.config) and try again. pause exit /b ================================================ FILE: launch-dedicated.sh ================================================ #!/bin/sh # Usage: # $ ./launch-dedicated.sh # Launch a dedicated server with default settings # $ Mod="" ./launch-dedicated.sh # Launch a dedicated server with default settings but override the Mod # Read the file to see which settings you can override set -e if ! command -v mono >/dev/null 2>&1; then command -v dotnet >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK requires dotnet or mono."; exit 1; } fi if command -v python3 >/dev/null 2>&1; then PYTHON="python3" else command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK requires python."; exit 1; } PYTHON="python" fi require_variables() { missing="" for i in "$@"; do eval check="\$$i" [ -z "${check}" ] && missing="${missing} ${i}\n" done if [ ! -z "${missing}" ]; then echo "Required mod.config variables are missing:\n${missing}Repair your mod.config (or user.config) and try again." exit 1 fi } TEMPLATE_LAUNCHER=$(${PYTHON} -c "import os; print(os.path.realpath('$0'))") TEMPLATE_ROOT=$(dirname "${TEMPLATE_LAUNCHER}") MOD_SEARCH_PATHS="${TEMPLATE_ROOT}/mods,./mods" # shellcheck source=mod.config . "${TEMPLATE_ROOT}/mod.config" if [ -f "${TEMPLATE_ROOT}/user.config" ]; then # shellcheck source=user.config . "${TEMPLATE_ROOT}/user.config" fi require_variables "MOD_ID" "ENGINE_VERSION" "ENGINE_DIRECTORY" if command -v mono >/dev/null 2>&1 && [ "$(grep -c .NETCoreApp,Version= ${ENGINE_DIRECTORY}/bin/OpenRA.Server.dll)" = "0" ]; then RUNTIME_LAUNCHER="mono --debug" else RUNTIME_LAUNCHER="dotnet" fi NAME="${Name:-"Dedicated Server"}" LAUNCH_MOD="${Mod:-"${MOD_ID}"}" MAP="${Map:-""}" LISTEN_PORT="${ListenPort:-"1234"}" ADVERTISE_ONLINE="${AdvertiseOnline:-"True"}" PASSWORD="${Password:-""}" RECORD_REPLAYS="${RecordReplays:-"False"}" REQUIRE_AUTHENTICATION="${RequireAuthentication:-"False"}" PROFILE_ID_BLACKLIST="${ProfileIDBlacklist:-""}" PROFILE_ID_WHITELIST="${ProfileIDWhitelist:-""}" ENABLE_SINGLE_PLAYER="${EnableSingleplayer:-"False"}" ENABLE_SYNC_REPORTS="${EnableSyncReports:-"False"}" ENABLE_GEOIP="${EnableGeoIP:-"True"}" ENABLE_LINT_CHECKS="${EnableLintChecks:-"True"}" SHARE_ANONYMISED_IPS="${ShareAnonymizedIPs:-"True"}" FLOOD_LIMIT_JOIN_COOLDOWN="${FloodLimitJoinCooldown:-"5000"}" SUPPORT_DIR="${SupportDir:-""}" cd "${TEMPLATE_ROOT}" if [ ! -f "${ENGINE_DIRECTORY}/bin/OpenRA.Server.dll" ] || [ "$(cat "${ENGINE_DIRECTORY}/VERSION")" != "${ENGINE_VERSION}" ]; then echo "Required engine files not found." echo "Run \`make\` in the mod directory to fetch and build the required files, then try again."; exit 1 fi cd "${ENGINE_DIRECTORY}" while true; do MOD_SEARCH_PATHS="${MOD_SEARCH_PATHS}" \ ${RUNTIME_LAUNCHER} bin/OpenRA.Server.dll Engine.EngineDir=".." Game.Mod="${LAUNCH_MOD}" \ Server.Name="${NAME}" \ Server.Map="${MAP}" \ Server.ListenPort="${LISTEN_PORT}" \ Server.AdvertiseOnline="${ADVERTISE_ONLINE}" \ Server.Password="${PASSWORD}" \ Server.RecordReplays="${RECORD_REPLAYS}" \ Server.RequireAuthentication="${REQUIRE_AUTHENTICATION}" \ Server.ProfileIDBlacklist="${PROFILE_ID_BLACKLIST}" \ Server.ProfileIDWhitelist="${PROFILE_ID_WHITELIST}" \ Server.EnableSingleplayer="${ENABLE_SINGLE_PLAYER}" \ Server.EnableSyncReports="${ENABLE_SYNC_REPORTS}" \ Server.EnableGeoIP="${ENABLE_GEOIP}" \ Server.EnableLintChecks="${ENABLE_LINT_CHECKS}" \ Server.ShareAnonymizedIPs="${SHARE_ANONYMISED_IPS}" \ Server.FloodLimitJoinCooldown="${FLOOD_LIMIT_JOIN_COOLDOWN}" \ Engine.SupportDir="${SUPPORT_DIR}" done ================================================ FILE: launch-game.cmd ================================================ @echo off setlocal EnableDelayedExpansion title OpenRA FOR /F "tokens=1,2 delims==" %%A IN (mod.config) DO (set %%A=%%B) if exist user.config (FOR /F "tokens=1,2 delims==" %%A IN (user.config) DO (set %%A=%%B)) set TEMPLATE_LAUNCHER=%0 set MOD_SEARCH_PATHS=%~dp0mods,./mods if "!MOD_ID!" == "" goto badconfig if "!ENGINE_VERSION!" == "" goto badconfig if "!ENGINE_DIRECTORY!" == "" goto badconfig set TEMPLATE_DIR=%CD% if not exist %ENGINE_DIRECTORY%\bin\OpenRA.exe goto noengine >nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine cd %ENGINE_DIRECTORY% bin\OpenRA.exe Game.Mod=%MOD_ID% Engine.EngineDir=".." Engine.LaunchPath="%TEMPLATE_LAUNCHER%" Engine.ModSearchPaths="%MOD_SEARCH_PATHS%" "%*" set ERROR=%errorlevel% cd %TEMPLATE_DIR% if %ERROR% neq 0 goto crashdialog exit /b :noengine echo Required engine files not found. echo Run `make all` in the mod directory to fetch and build the required files, then try again. pause exit /b :badconfig echo Required mod.config variables are missing. echo Ensure that MOD_ID ENGINE_VERSION and ENGINE_DIRECTORY are echo defined in your mod.config (or user.config) and try again. pause exit /b :crashdialog echo ---------------------------------------- echo OpenRA has encountered a fatal error. echo * Log Files are available in Documents\OpenRA\Logs echo * FAQ is available at https://github.com/OpenRA/OpenRA/wiki/FAQ echo ---------------------------------------- pause ================================================ FILE: launch-game.sh ================================================ #!/bin/sh set -e if ! command -v mono >/dev/null 2>&1; then command -v dotnet >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK requires dotnet or mono."; exit 1; } fi if command -v python3 >/dev/null 2>&1; then PYTHON="python3" else command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK requires python."; exit 1; } PYTHON="python" fi require_variables() { missing="" for i in "$@"; do eval check="\$$i" [ -z "${check}" ] && missing="${missing} ${i}\n" done if [ ! -z "${missing}" ]; then echo "Required mod.config variables are missing:\n${missing}Repair your mod.config (or user.config) and try again." exit 1 fi } TEMPLATE_LAUNCHER=$(${PYTHON} -c "import os; print(os.path.realpath('$0'))") TEMPLATE_ROOT=$(dirname "${TEMPLATE_LAUNCHER}") MOD_SEARCH_PATHS="${TEMPLATE_ROOT}/mods,./mods" # shellcheck source=mod.config . "${TEMPLATE_ROOT}/mod.config" if [ -f "${TEMPLATE_ROOT}/user.config" ]; then # shellcheck source=user.config . "${TEMPLATE_ROOT}/user.config" fi require_variables "MOD_ID" "ENGINE_VERSION" "ENGINE_DIRECTORY" cd "${TEMPLATE_ROOT}" if [ ! -f "${ENGINE_DIRECTORY}/bin/OpenRA.dll" ] || [ "$(cat "${ENGINE_DIRECTORY}/VERSION")" != "${ENGINE_VERSION}" ]; then echo "Required engine files not found." echo "Run \`make\` in the mod directory to fetch and build the required files, then try again."; exit 1 fi if command -v mono >/dev/null 2>&1 && [ "$(grep -c .NETCoreApp,Version= ${ENGINE_DIRECTORY}/bin/OpenRA.dll)" = "0" ]; then RUNTIME_LAUNCHER="mono --debug" else RUNTIME_LAUNCHER="dotnet" fi cd "${ENGINE_DIRECTORY}" ${RUNTIME_LAUNCHER} bin/OpenRA.dll Game.Mod="${MOD_ID}" Engine.EngineDir=".." Engine.LaunchPath="${TEMPLATE_LAUNCHER}" Engine.ModSearchPaths="${MOD_SEARCH_PATHS}" "$@" ================================================ FILE: make.cmd ================================================ @powershell -NoProfile -ExecutionPolicy Bypass -File make.ps1 %* ================================================ FILE: make.ps1 ================================================ ####### The starting point for the script is the bottom ####### ############################################################### ########################## FUNCTIONS ########################## ############################################################### function All-Command { If (!(Test-Path "*.sln")) { Write-Host "No custom solution file found. Aborting." -ForegroundColor Red return } if ((CheckForDotnet) -eq 1) { return } Write-Host "Building $modID in" $configuration "configuration..." -ForegroundColor Cyan dotnet build -c $configuration --nologo -p:TargetPlatform=win-x64 if ($lastexitcode -ne 0) { Write-Host "Build failed. If just the development tools failed to build, try installing Visual Studio. You may also still be able to run the game." -ForegroundColor Red } else { Write-Host "Build succeeded." -ForegroundColor Green } } function Clean-Command { If (!(Test-Path "*.sln")) { Write-Host "No custom solution file found - nothing to clean. Aborting." -ForegroundColor Red return } if ((CheckForDotnet) -eq 1) { return } Write-Host "Cleaning $modID..." -ForegroundColor Cyan dotnet clean /nologo Remove-Item ./*/obj -Recurse -ErrorAction Ignore Remove-Item env:ENGINE_DIRECTORY/bin -Recurse -ErrorAction Ignore Remove-Item env:ENGINE_DIRECTORY/*/obj -Recurse -ErrorAction Ignore Write-Host "Clean complete." -ForegroundColor Green } function Version-Command { if ($command.Length -gt 1) { $version = $command[1] } elseif (Get-Command 'git' -ErrorAction SilentlyContinue) { $gitRepo = git rev-parse --is-inside-work-tree if ($gitRepo) { $version = git name-rev --name-only --tags --no-undefined HEAD 2>$null if ($version -eq $null) { $version = "git-" + (git rev-parse --short HEAD) } } else { Write-Host "Not a git repository. The version will remain unchanged." -ForegroundColor Red } } else { Write-Host "Unable to locate Git. The version will remain unchanged." -ForegroundColor Red } if ($version -ne $null) { $mod = "mods/" + $modID + "/mod.yaml" $replacement = (gc $mod) -Replace "Version:.*", ("Version: {0}" -f $version) sc $mod $replacement $prefix = $(gc $mod) | Where { $_.ToString().EndsWith(": User") } if ($prefix -and $prefix.LastIndexOf("/") -ne -1) { $prefix = $prefix.Substring(0, $prefix.LastIndexOf("/")) } $replacement = (gc $mod) -Replace ".*: User", ("{0}/{1}: User" -f $prefix, $version) sc $mod $replacement Write-Host ("Version strings set to '{0}'." -f $version) } } function Test-Command { if ((CheckForUtility) -eq 1) { return } Write-Host "Testing $modID mod MiniYAML..." -ForegroundColor Cyan InvokeCommand "$utilityPath $modID --check-yaml" } function Check-Command { If (!(Test-Path "*.sln")) { Write-Host "No custom solution file found. Skipping static code checks." -ForegroundColor Cyan return } Write-Host "Compiling $modID in Debug configuration..." -ForegroundColor Cyan dotnet clean -c Debug --nologo --verbosity minimal dotnet build -c Debug --nologo -warnaserror -p:TargetPlatform=win-x64 if ($lastexitcode -ne 0) { Write-Host "Build failed." -ForegroundColor Red } if ((CheckForUtility) -eq 0) { Write-Host "Checking $modID for explicit interface violations..." -ForegroundColor Cyan InvokeCommand "$utilityPath $modID --check-explicit-interfaces" Write-Host "Checking $modID for incorrect conditional trait interface overrides..." -ForegroundColor Cyan InvokeCommand "$utilityPath $modID --check-conditional-trait-interface-overrides" } } function Check-Scripts-Command { if ((Get-Command "luac.exe" -ErrorAction SilentlyContinue) -ne $null) { Write-Host "Testing Lua scripts..." -ForegroundColor Cyan foreach ($script in ls "mods/*/maps/*/*.lua") { luac -p $script } Write-Host "Check completed!" -ForegroundColor Green } else { Write-Host "luac.exe could not be found. Please install Lua." -ForegroundColor Red } } function CheckForUtility { if (Test-Path $utilityPath) { return 0 } Write-Host "OpenRA.Utility.exe could not be found. Build the project first using the `"all`" command." -ForegroundColor Red return 1 } function CheckForDotnet { if ((Get-Command "dotnet" -ErrorAction SilentlyContinue) -eq $null) { Write-Host "The 'dotnet' tool is required to compile OpenRA. Please install the .NET 6.0 SDK and try again. https://dotnet.microsoft.com/download/dotnet/6.0" -ForegroundColor Red return 1 } return 0 } function WaitForInput { Write-Host "Press enter to continue." while ($true) { if ([System.Console]::KeyAvailable) { exit } Start-Sleep -Milliseconds 50 } } function ReadConfigLine($line, $name) { $prefix = $name + '=' if ($line.StartsWith($prefix)) { [Environment]::SetEnvironmentVariable($name, $line.Replace($prefix, '').Replace('"', '')) } } function ParseConfigFile($fileName) { $names = @("MOD_ID", "ENGINE_VERSION", "AUTOMATIC_ENGINE_MANAGEMENT", "AUTOMATIC_ENGINE_SOURCE", "AUTOMATIC_ENGINE_EXTRACT_DIRECTORY", "AUTOMATIC_ENGINE_TEMP_ARCHIVE_NAME", "ENGINE_DIRECTORY") $reader = [System.IO.File]::OpenText($fileName) while($null -ne ($line = $reader.ReadLine())) { foreach ($name in $names) { ReadConfigLine $line $name } } $reader.Close() $missing = @() foreach ($name in $names) { if (!([System.Environment]::GetEnvironmentVariable($name))) { $missing += $name } } if ($missing) { Write-Host "Required mod.config variables are missing:" foreach ($m in $missing) { Write-Host " $m" } Write-Host "Repair your mod.config (or user.config) and try again." WaitForInput exit } } function InvokeCommand { param($expression) # $? is the return value of the called expression # Invoke-Expression itself will always succeed, even if the invoked expression fails # So temporarily store the return value in $success $expression += '; $success = $?' Invoke-Expression $expression if ($success -eq $False) { exit 1 } } ############################################################### ############################ Main ############################# ############################################################### if ($PSVersionTable.PSVersion.Major -clt 3) { Write-Host "The makefile requires PowerShell version 3 or higher." -ForegroundColor Red Write-Host "Please download and install the latest Windows Management Framework version from Microsoft." -ForegroundColor Red WaitForInput } if ($args.Length -eq 0) { Write-Host "Command list:" Write-Host "" Write-Host " all Builds the game, its development tools and the mod dlls." Write-Host " version Sets the version strings for all mods to the latest" Write-Host " version for the current Git branch." Write-Host " clean Removes all built and copied files." Write-Host " from the mods and the engine directories." Write-Host " test Tests the mod's MiniYAML for errors." Write-Host " check Checks .cs files for StyleCop violations." Write-Host " check-scripts Checks .lua files for syntax errors." Write-Host "" $command = (Read-Host "Enter command").Split(' ', 2) } else { $command = $args } # Set the working directory for our IO methods $templateDir = $pwd.Path [System.IO.Directory]::SetCurrentDirectory($templateDir) # Load the environment variables from the config file # and get the mod ID from the local environment variable ParseConfigFile "mod.config" if (Test-Path "user.config") { ParseConfigFile "user.config" } $modID = $env:MOD_ID $env:MOD_SEARCH_PATHS = "./mods,$env:ENGINE_DIRECTORY/mods" $env:ENGINE_DIR = ".." # Set to potentially be used by the Utility and different than $env:ENGINE_DIRECTORY, which is for the script. # Fetch the engine if required if ($command -eq "all" -or $command -eq "clean" -or $command -eq "check") { $versionFile = $env:ENGINE_DIRECTORY + "/VERSION" $currentEngine = "" if (Test-Path $versionFile) { $reader = [System.IO.File]::OpenText($versionFile) $currentEngine = $reader.ReadLine() $reader.Close() } if ($currentEngine -ne "" -and $currentEngine -eq $env:ENGINE_VERSION) { cd $env:ENGINE_DIRECTORY Invoke-Expression ".\make.cmd $command" Write-Host "" cd $templateDir } elseif ($env:AUTOMATIC_ENGINE_MANAGEMENT -ne "True") { Write-Host "Automatic engine management is disabled." Write-Host "Please manually update the engine to version $env:ENGINE_VERSION." WaitForInput } else { Write-Host "OpenRA engine version $env:ENGINE_VERSION is required." if (Test-Path $env:ENGINE_DIRECTORY) { if ($currentEngine -ne "") { Write-Host "Deleting engine version $currentEngine." } else { Write-Host "Deleting existing engine (unknown version)." } rm $env:ENGINE_DIRECTORY -r } Write-Host "Downloading engine..." if (Test-Path $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY) { rm $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY -r } $url = $env:AUTOMATIC_ENGINE_SOURCE $url = $url.Replace("$", "").Replace("{ENGINE_VERSION}", $env:ENGINE_VERSION) mkdir $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY > $null $dlPath = Join-Path $pwd (Split-Path -leaf $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY) $dlPath = Join-Path $dlPath (Split-Path -leaf $env:AUTOMATIC_ENGINE_TEMP_ARCHIVE_NAME) $client = new-object System.Net.WebClient [Net.ServicePointManager]::SecurityProtocol = 'Tls12' $client.DownloadFile($url, $dlPath) Add-Type -assembly "system.io.compression.filesystem" [io.compression.zipfile]::ExtractToDirectory($dlPath, $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY) rm $dlPath $extractedDir = Get-ChildItem $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY -Recurse | ?{ $_.PSIsContainer } | Select-Object -First 1 Move-Item $extractedDir.FullName -Destination $templateDir Rename-Item $extractedDir.Name (Split-Path -leaf $env:ENGINE_DIRECTORY) rm $env:AUTOMATIC_ENGINE_EXTRACT_DIRECTORY -r # HACK: Remove bogus lint check that the Example mod can't possibly pass # because to do so it would need to define a lot of excess things surrounding resources. rm $env:ENGINE_DIRECTORY/OpenRA.Mods.Common/Lint/CheckFluentReferences.cs cd $env:ENGINE_DIRECTORY Invoke-Expression ".\make.cmd version $env:ENGINE_VERSION" Invoke-Expression ".\make.cmd $command" Write-Host "" cd $templateDir } } $utilityPath = $env:ENGINE_DIRECTORY + "/bin/OpenRA.Utility.exe" $configuration = "Release" if ($args.Contains("CONFIGURATION=Debug")) { $configuration = "Debug" } $execute = $command if ($command.Length -gt 1) { $execute = $command[0] } switch ($execute) { "all" { All-Command } "version" { Version-Command } "clean" { Clean-Command } "test" { Test-Command } "check" { Check-Command } "check-scripts" { Check-Scripts-Command } Default { Write-Host ("Invalid command '{0}'" -f $command) } } # In case the script was called without any parameters we keep the window open if ($args.Length -eq 0) { WaitForInput } ================================================ FILE: mod.config ================================================ ############################################################################## # Core Configuration # # Basic settings that should be changed by all projects. ############################################################################## # The id of the mod packaged by this project. # This must exist as a directory in the mods directory and should not contain spaces. MOD_ID="example" # The OpenRA engine version to use for this project. ENGINE_VERSION="release-20250330" ############################################################################## # Packaging # # Settings controlling the creation of installers. ############################################################################## # The prefix used for the installer filenames. # - Windows installers will be named as {PACKAGING_INSTALLER_NAME}-{TAG}.exe # - macOS installers will be named as {PACKAGING_INSTALLER_NAME}-{TAG}.dmg # - Linux .appimages will be named as {PACKAGING_INSTALLER_NAME}-${TAG}.AppImage PACKAGING_INSTALLER_NAME="ExampleMod" # The human-readable name for this project. # This is used in: # - Crash dialogs (all platforms) # - macOS .app bundle name # - macOS menu bar # - macOS "About" window # - macOS disk image title # - Windows installer # - Windows start menu # - Windows desktop shortcut # - Windows "Programs and Features" list # - Linux launcher shortcut PACKAGING_DISPLAY_NAME="Example Mod" # The URL for the project homepage. # This is used in: # - Windows "Add/Remove Programs" list PACKAGING_WEBSITE_URL="https://openra.net" # The URL that is displayed in the crash dialog. PACKAGING_FAQ_URL="https://wiki.openra.net/FAQ" # The human-readable project authors. # This is used in: # - Windows "Add/Remove Programs" list PACKAGING_AUTHORS="Example Mod authors" # If your mod depends on OpenRA.Mods.Cnc.dll from the engine set # this to "True" to package the dll in your installers. # Accepts values "True" or "False". PACKAGING_COPY_CNC_DLL="False" # If your mod depends on OpenRA.Mods.D2k.dll from the engine set # this to "True" to package the dll in your installers. # Accepts values "True" or "False". PACKAGING_COPY_D2K_DLL="False" # If you wish to enable Discord integration, register an # application at https://discord.com/developers/applications # and define the client id here and in your mod.yaml PACKAGING_DISCORD_APPID="" # The macOS disk image icon positions, matched to the background artwork PACKAGING_OSX_DMG_MOD_ICON_POSITION="190, 210" PACKAGING_OSX_DMG_APPLICATION_ICON_POSITION="410, 210" PACKAGING_OSX_DMG_HIDDEN_ICON_POSITION="190, 350" # Filename to use for the launcher executable on Windows. PACKAGING_WINDOWS_LAUNCHER_NAME="ExampleMod" # The name of the Windows Program Files directory to install the project files to. PACKAGING_WINDOWS_INSTALL_DIR_NAME="OpenRA Example Mod" # The key prefix used for Windows registry metadata. # This should not contain spaces or special characters. PACKAGING_WINDOWS_REGISTRY_KEY="OpenRAExampleMod" # Path to the file containing the text to show in the Windows installer license dialog PACKAGING_WINDOWS_LICENSE_FILE="./COPYING" # Space delimited list of additional files/directories to copy from the engine directory # when packaging your mod. e.g. "./mods/common-content" PACKAGING_COPY_ENGINE_FILES="" # Overwrite the version in mod.yaml with the tag used for the SDK release # Accepts values "True" or "False". PACKAGING_OVERWRITE_MOD_VERSION="True" ############################################################################## # Advanced Configuration # # Most projects will not need to modify these ############################################################################## # Automatic engine managment will treat the OpenRA engine files like a read-only dependency. # Disable this if you would like to modify or manager your own engine files. AUTOMATIC_ENGINE_MANAGEMENT="True" # The URL to download the engine files from when AUTOMATIC_ENGINE_MANAGEMENT is enabled. AUTOMATIC_ENGINE_SOURCE="https://github.com/OpenRA/OpenRA/archive/${ENGINE_VERSION}.zip" # Temporary file/directory names used by automatic engine management. # Paths outside the SDK directory are not officially supported. AUTOMATIC_ENGINE_EXTRACT_DIRECTORY="./engine_temp" AUTOMATIC_ENGINE_TEMP_ARCHIVE_NAME="engine.zip" ENGINE_DIRECTORY="./engine" ================================================ FILE: mods/example/chrome/chrome.yaml ================================================ ^Dialog: Image: chrome/assets/dialog.png ^Glyphs: Image: chrome/assets/glyphs.png ^LoadScreen: Image: chrome/assets/loadscreen.png observer-scrollpanel-button: Inherits: ^Dialog PanelRegion: 769, 257, 2, 2, 122, 122, 2, 2 observer-scrollpanel-button-hover: Inherits: observer-scrollpanel-button observer-scrollpanel-button-pressed: Inherits: ^Dialog PanelRegion: 897, 257, 2, 2, 122, 122, 2, 2 observer-scrollpanel-button-disabled: Inherits: ^Dialog PanelRegion: 769, 385, 2, 2, 122, 122, 2, 2 observer-scrollheader: Inherits: observer-scrollpanel-button-disabled observer-scrollheader-highlighted: Inherits: observer-scrollpanel-button-disabled observer-scrollitem: observer-scrollitem-hover: Inherits: observer-scrollpanel-button observer-scrollitem-pressed: Inherits: observer-scrollpanel-button observer-scrollitem-highlighted: Inherits: observer-scrollpanel-button-pressed # Used for the main menu frame dialog: Inherits: ^Dialog Regions: background: 1, 1, 480, 480 border-r: 492, 1, 9, 190 border-l: 483, 1, 9, 190 border-b: 1, 492, 189, 9 border-t: 1, 483, 189, 9 corner-tl: 192, 483, 9, 9 corner-tr: 201, 483, 9, 9 corner-bl: 192, 492, 9, 9 corner-br: 201, 492, 9, 9 # Used for Music and Map selection (normal button) dialog2: Inherits: button # It's a Container, used in various places, like Hotkeys, ColorPicker, Asset Browser frames (looks like a pressed button) dialog3: Inherits: button-pressed # Used for tooltips and the video player dialog4: Inherits: ^Dialog PanelRegion: 512, 387, 6, 6, 52, 52, 6, 6 # completely black tile dialog5: Inherits: ^Dialog PanelRegion: 580, 388, 0, 0, 62, 62, 0, 0 PanelSides: Center lobby-bits: Inherits: ^Glyphs Regions: spawn-claimed: 68, 119, 22, 22 spawn-unclaimed: 91, 119, 22, 22 spawn-disabled: 114, 119, 22, 22 admin: 170, 0, 6, 5 colorpicker: 68, 119, 22, 22 huepicker: 136, 0, 7, 15 kick: 153, 0, 11, 11 protected: 0, 17, 12, 13 protected-disabled: 17, 17, 12, 13 authentication: 34, 17, 12, 13 authentication-disabled: 51, 17, 12, 13 admin-registered: 0, 51, 16, 16 admin-anonymous: 34, 51, 16, 16 player-registered: 17, 51, 16, 16 player-anonymous: 51, 51, 16, 16 reload-icon: Inherits: ^Glyphs Regions: enabled: 0, 34, 16, 16 disabled-0: 17, 34, 16, 16 disabled-1: 34, 34, 16, 16 disabled-2: 51, 34, 16, 16 disabled-3: 68, 34, 16, 16 disabled-4: 85, 34, 16, 16 disabled-5: 102, 34, 16, 16 disabled-6: 119, 34, 16, 16 disabled-7: 136, 34, 16, 16 disabled-8: 153, 34, 16, 16 disabled-9: 170, 34, 16, 16 disabled-10: 187, 34, 16, 16 disabled-11: 204, 34, 16, 16 strategic: Inherits: ^Glyphs Regions: unowned: 68, 119, 22, 22 critical_unowned: 137, 119, 22, 22 enemy_owned: 160, 119, 22, 22 player_owned: 160, 142, 22, 22 flags: Inherits: ^Glyphs Regions: example: 226, 241, 30, 15 Random: 226, 241, 30, 15 spectator: 226, 241, 30, 15 music: Inherits: ^Glyphs Regions: pause: 0, 0, 16, 16 stop: 17, 0, 16, 16 play: 34, 0, 16, 16 next: 51, 0, 16, 16 prev: 68, 0, 16, 16 fastforward: 85, 0, 16, 16 progressbar-bg: Inherits: button-pressed progressbar-thumb: Inherits: button button: Inherits: ^Dialog PanelRegion: 513, 1, 2, 2, 122, 122, 2, 2 # 5% lighter than a normal button (mouseover) button-hover: Inherits: ^Dialog PanelRegion: 513, 129, 2, 2, 122, 122, 2, 2 button-pressed: Inherits: ^Dialog PanelRegion: 641, 1, 2, 2, 122, 122, 2, 2 # 50% grey (disabled button) button-disabled: Inherits: ^Dialog PanelRegion: 513, 257, 2, 2, 122, 122, 2, 2 button-highlighted: Inherits: ^Dialog PanelRegion: 769, 129, 2, 2, 122, 122, 2, 2 button-highlighted-hover: Inherits: button-highlighted button-highlighted-pressed: Inherits: ^Dialog PanelRegion: 897, 129, 2, 2, 122, 122, 2, 2 button-highlighted-disabled: Inherits: button-highlighted newsbutton: Inherits: button newsbutton-hover: Inherits: button newsbutton-highlighted: Inherits: ^Dialog PanelRegion: 769, 1, 2, 2, 122, 122, 2, 2 newsbutton-highlighted-hover: Inherits: newsbutton-highlighted newsbutton-highlighted-pressed: Inherits: button-pressed newsbutton-pressed: Inherits: button-pressed textfield: Inherits: button-pressed textfield-hover: Inherits: checkbox-hover textfield-disabled: Inherits: checkbox-disabled textfield-focused: Inherits: button-pressed scrollpanel-bg: Inherits: button-pressed scrollpanel-button: Inherits: button scrollpanel-button-hover: Inherits: button-hover scrollpanel-button-pressed: Inherits: button-pressed scrollpanel-button-disabled: Inherits: button slider: Inherits: ^Dialog Regions: tick: 513, 2, 2, 4 slider-track: Inherits: button slider-thumb: Inherits: button slider-thumb-hover: Inherits: button-hover slider-thumb-pressed: Inherits: button-pressed slider-thumb-disabled: Inherits: button-disabled checkbox: Inherits: button-pressed checkmark-tick: Inherits: ^Glyphs Regions: checked: 187, 0, 16, 16 checked-pressed: 204, 0, 16, 16 unchecked: 0, 0, 0, 0 unchecked-pressed: 204, 0, 16, 16 checkmark-tick-highlighted: Inherits: checkmark-tick checkmark-cross: Inherits: ^Glyphs Regions: checked: 221, 0, 16, 16 checked-pressed: 238, 0, 16, 16 unchecked: 0, 0, 0, 0 unchecked-pressed: 238, 0, 16, 16 checkmark-cross-highlighted: Inherits: checkmark-cross checkmark-mute: Inherits: ^Glyphs Regions: unchecked: 0, 170, 16, 16 unchecked-pressed: 17, 170, 16, 16 checked: 17, 170, 16, 16 checked-pressed: 0, 170, 16, 16 checkmark-mute-highlighted: Inherits: checkmark-mute checkbox-hover: Inherits: ^Dialog PanelRegion: 641, 129, 2, 2, 122, 122, 2, 2 checkbox-pressed: Inherits: checkbox-hover checkbox-disabled: Inherits: ^Dialog PanelRegion: 641, 257, 2, 2, 122, 122, 2, 2 checkbox-highlighted: Inherits: ^Dialog PanelRegion: 897, 1, 2, 2, 122, 122, 2, 2 checkbox-highlighted-hover: Inherits: checkbox-highlighted checkbox-highlighted-pressed: Inherits: checkbox-highlighted checkbox-highlighted-disabled: Inherits: checkbox-disabled checkbox-toggle: checkbox-toggle-hover: Inherits: button checkbox-toggle-pressed: Inherits: checkbox-pressed checkbox-toggle-highlighted: checkbox-toggle-highlighted-hover: Inherits: button-highlighted checkbox-toggle-highlighted-pressed: Inherits: checkbox-highlighted-pressed scrollitem: scrollitem-hover: Inherits: button scrollitem-pressed: Inherits: button scrollitem-highlighted: Inherits: button-pressed scrollitem-nohover: scrollitem-nohover-highlighted: scrollheader: Inherits: button scrollheader-highlighted: Inherits: button logos: Inherits: ^LoadScreen Regions: logo: 0, 0, 256, 256 loadscreen-stripe: Inherits: ^LoadScreen PanelRegion: 258, 0, 0, 0, 253, 256, 0, 0 PanelSides: Center mainmenu-border: Inherits: ^Dialog PanelRegion: 650, 389, 39, 39, 38, 38, 39, 39 PanelSides: Edges scrollpanel-decorations: Inherits: ^Glyphs Regions: down: 68, 17, 16, 16 down-disabled: 85, 17, 16, 16 up: 102, 17, 16, 16 up-disabled: 119, 17, 16, 16 right: 136, 17, 16, 16 right-disabled: 153, 17, 16, 16 left: 170, 17, 16, 16 left-disabled: 187, 17, 16, 16 dropdown-decorations: Inherits: ^Glyphs Regions: marker: 68, 17, 16, 16 marker-disabled: 85, 17, 16, 16 dropdown-separators: Inherits: ^Dialog Regions: separator: 513, 2, 1, 19 separator-hover: 513, 130, 1, 19 separator-pressed: 766, 2, 1, 19 separator-disabled: 513, 258, 1, 19 observer-separator: 769, 258, 1, 19 separator: Inherits: button editor: Inherits: ^Glyphs Regions: select: 34, 187, 16, 16 tiles: 0, 187, 16, 16 overlays: 17, 187, 16, 16 actors: 34, 68, 16, 16 tools: 136, 68, 16, 16 history: 136, 51, 16, 16 erase: 50, 187, 16, 16 ================================================ FILE: mods/example/chrome/ingame-observer.yaml ================================================ Container@OBSERVER_WIDGETS: Logic: MenuButtonsChromeLogic, LoadIngameChatLogic Children: Container@CHAT_ROOT: LogicKeyListener@OBSERVER_KEY_LISTENER: Container@MUTE_INDICATOR: Logic: MuteIndicatorLogic X: WINDOW_WIDTH - WIDTH - 260 Y: 5 Width: 200 Height: 25 Children: Image@ICON: X: PARENT_WIDTH - WIDTH Y: 1 Width: 24 Height: 24 ImageCollection: sidebar-bits ImageName: indicator-muted Label@LABEL: Width: PARENT_WIDTH - 30 Height: 25 Align: Right Text: label-mute-indicator Contrast: true MenuButton@OPTIONS_BUTTON: X: 5 Y: 5 Width: 160 Height: 25 Text: button-observer-widgets-options Font: Bold Key: escape DisableWorldSounds: true Container@GAME_TIMER_BLOCK: Logic: GameTimerLogic X: (WINDOW_WIDTH - WIDTH) / 2 Width: 100 Height: 55 Children: LabelWithTooltip@GAME_TIMER: Width: PARENT_WIDTH Height: 30 Align: Center Font: Title Contrast: true TooltipContainer: TOOLTIP_CONTAINER TooltipTemplate: SIMPLE_TOOLTIP Label@GAME_TIMER_STATUS: Y: 32 Width: PARENT_WIDTH Height: 15 Align: Center Font: Bold Contrast: true Background@RADAR_BG: X: WINDOW_WIDTH - 255 Y: 5 Width: 250 Height: 250 Children: Radar@INGAME_RADAR: X: 10 Y: 10 Width: PARENT_WIDTH - 19 Height: PARENT_HEIGHT - 19 WorldInteractionController: INTERACTION_CONTROLLER VideoPlayer@PLAYER: X: 10 Y: 10 Width: PARENT_WIDTH - 20 Height: PARENT_HEIGHT - 20 Skippable: false Background@OBSERVER_CONTROL_BG: X: WINDOW_WIDTH - 255 Y: 260 Width: 250 Height: 55 Children: DropDownButton@SHROUD_SELECTOR: Logic: ObserverShroudSelectorLogic CombinedViewKey: ObserverCombinedView WorldViewKey: ObserverWorldView X: 15 Y: 15 Width: 220 Height: 25 Font: Bold Children: LogicKeyListener@SHROUD_KEYHANDLER: Image@FLAG: Width: 23 Height: 23 X: 2 Y: 5 Label@LABEL: X: 34 Width: PARENT_WIDTH Height: 25 Shadow: True Label@NOFLAG_LABEL: X: 5 Width: PARENT_WIDTH Height: 25 Shadow: True Container@REPLAY_PLAYER: Logic: ReplayControlBarLogic Y: 39 Width: 160 Height: 35 Visible: false Children: Button@BUTTON_PAUSE: X: 15 Y: 10 Width: 26 Height: 26 Key: Pause TooltipText: button-replay-player-pause-tooltip TooltipContainer: TOOLTIP_CONTAINER IgnoreChildMouseOver: true Children: Image@IMAGE_PAUSE: X: 5 Y: 5 ImageCollection: music ImageName: pause Button@BUTTON_PLAY: X: 15 Y: 10 Width: 26 Height: 26 Key: Pause TooltipText: button-replay-player-play-tooltip TooltipContainer: TOOLTIP_CONTAINER IgnoreChildMouseOver: true Children: Image@IMAGE_PLAY: X: 5 Y: 5 ImageCollection: music ImageName: play Button@BUTTON_SLOW: X: 55 Y: 13 Width: 36 Height: 20 Key: ReplaySpeedSlow TooltipText: button-replay-player-slow.tooltip TooltipContainer: TOOLTIP_CONTAINER Text: button-replay-player-slow.label Font: TinyBold Button@BUTTON_REGULAR: X: 55 + 45 Y: 13 Width: 38 Height: 20 Key: ReplaySpeedRegular TooltipText: button-replay-player-regular.tooltip TooltipContainer: TOOLTIP_CONTAINER Text: button-replay-player-regular.label Font: TinyBold Button@BUTTON_FAST: X: 55 + 45 * 2 Y: 13 Width: 38 Height: 20 Key: ReplaySpeedFast TooltipText: button-replay-player-fast.tooltip TooltipContainer: TOOLTIP_CONTAINER Text: button-replay-player-fast.label Font: TinyBold Button@BUTTON_MAXIMUM: X: 55 + 45 * 3 Y: 13 Width: 38 Height: 20 Key: ReplaySpeedMax TooltipText: button-replay-player-maximum.tooltip TooltipContainer: TOOLTIP_CONTAINER Text: button-replay-player-maximum.label Font: TinyBold ================================================ FILE: mods/example/chrome/layouts/ingame-player.yaml ================================================ Container@PLAYER_WIDGETS: Logic: MenuButtonsChromeLogic Children: LogicTicker@SIDEBAR_TICKER: MenuButton@OPTIONS_BUTTON: Key: escape ================================================ FILE: mods/example/cursors/default.yaml ================================================ Cursors: cursors/assets/default.png: default: Start: 0 ================================================ FILE: mods/example/fluent/chrome.ftl ================================================ ## Shroud checkbox-fog-of-war = .label = Fog of War .description = Line of sight is required to view enemy forces checkbox-explored-map = .label = Explored Map .description = Initial map shroud is revealed ## DeveloperMode checkbox-debug-menu = .label = Debug Menu .description = Enables cheats and developer commands ## MapStartingLocations checkbox-separate-team-spawns = .label = Separate Team Spawns .description = Players without assigned spawn points will start as far as possible from enemy players ## SpawnStartingUnits dropdown-starting-units = .label = Starting Units .description = The units that players start the game with ## World options-starting-units = .unlabeled = Unlabeled ## ingame-observer.yaml label-mute-indicator = Audio Muted button-observer-widgets-options = Options (Esc) button-replay-player-pause-tooltip = Pause button-replay-player-play-tooltip = Play button-replay-player-slow = .tooltip = Slow speed .label = 50% button-replay-player-regular = .tooltip = Regular speed .label = 100% button-replay-player-fast = .tooltip = Fast speed .label = 200% button-replay-player-maximum = .tooltip = Maximum speed .label = MAX ================================================ FILE: mods/example/fluent/mod.ftl ================================================ ## Metadata mod-title = Example mod mod-windowtitle = Example # To silence "Warning: Missing key `loadscreen-loading` in mod ftl files required by `LogoStripeLoadScreen.Loading`" # Because https://github.com/OpenRA/OpenRA/issues/20693 wasn't fixed. loadscreen-loading = . ================================================ FILE: mods/example/fluent/rules.ftl ================================================ ## world.yaml faction-random = .name = Random .description = Random Faction A random faction will be chosen when the game starts. faction-example = .name = Example .description = Example Faction Provide your own faction description here. ================================================ FILE: mods/example/maps/example/map.yaml ================================================ MapFormat: 12 RequiresMod: example Title: Example Map Author: Example Author Tileset: EXAMPLE MapSize: 34,34 Bounds: 1,1,32,32 Visibility: Lobby Categories: Maps Players: PlayerReference@Neutral: Name: Neutral OwnsWorld: True NonCombatant: True Faction: Random PlayerReference@Creeps: Name: Creeps NonCombatant: True Faction: Random PlayerReference@Multi0: Name: Multi0 Playable: True Faction: Random Enemies: Creeps Actors: Actor0: mpspawn Owner: Multi0 Location: 16,16 ================================================ FILE: mods/example/maps/shellmap/map.yaml ================================================ MapFormat: 12 RequiresMod: example Title: Example Shellmap Author: Example Author Tileset: EXAMPLE MapSize: 34,34 Bounds: 1,1,32,32 Visibility: Shellmap Categories: Maps Players: PlayerReference@Neutral: Name: Neutral OwnsWorld: True NonCombatant: True Faction: Random PlayerReference@Creeps: Name: Creeps NonCombatant: True Faction: Random Actors: ================================================ FILE: mods/example/missions/example.yaml ================================================ ================================================ FILE: mods/example/mod.chrome.yaml ================================================ Chrome: example|chrome/chrome.yaml ChromeLayout: common|chrome/assetbrowser.yaml common|chrome/color-picker.yaml common|chrome/confirmation-dialogs.yaml common|chrome/connection.yaml common|chrome/credits.yaml common|chrome/dropdowns.yaml common|chrome/editor.yaml common|chrome/gamesave-browser.yaml common|chrome/gamesave-loading.yaml common|chrome/ingame.yaml common|chrome/ingame-chat.yaml common|chrome/ingame-debug.yaml common|chrome/ingame-debuginfo.yaml common|chrome/ingame-fmvplayer.yaml common|chrome/ingame-info.yaml common|chrome/ingame-infobriefing.yaml common|chrome/ingame-infochat.yaml common|chrome/ingame-info-lobby-options.yaml common|chrome/ingame-infoobjectives.yaml common|chrome/ingame-infoscripterror.yaml common|chrome/ingame-infostats.yaml common|chrome/ingame-menu.yaml common|chrome/ingame-perf.yaml example|chrome/ingame-observer.yaml example|chrome/layouts/ingame-player.yaml common|chrome/ingame-transients.yaml common|chrome/lobby.yaml common|chrome/lobby-kickdialogs.yaml common|chrome/lobby-mappreview.yaml common|chrome/lobby-music.yaml common|chrome/lobby-options.yaml common|chrome/lobby-players.yaml common|chrome/lobby-servers.yaml common|chrome/mainmenu.yaml common|chrome/mainmenu-prompts.yaml common|chrome/map-chooser.yaml common|chrome/missionbrowser.yaml common|chrome/multiplayer-browser.yaml common|chrome/multiplayer-browserpanels.yaml common|chrome/multiplayer-createserver.yaml common|chrome/multiplayer-directconnect.yaml common|chrome/musicplayer.yaml common|chrome/playerprofile.yaml common|chrome/replaybrowser.yaml common|chrome/settings.yaml common|chrome/settings-advanced.yaml common|chrome/settings-audio.yaml common|chrome/settings-display.yaml common|chrome/settings-hotkeys.yaml common|chrome/settings-input.yaml common|chrome/text-notifications.yaml common|chrome/tooltips.yaml ChromeMetrics: common|metrics.yaml Fonts: Tiny: Font: common|FreeSans.ttf Size: 10 Ascender: 8 TinyBold: Font: common|FreeSansBold.ttf Size: 10 Ascender: 8 Small: Font: common|FreeSans.ttf Size: 12 Ascender: 9 Regular: Font: common|FreeSans.ttf Size: 14 Ascender: 11 Bold: Font: common|FreeSansBold.ttf Size: 14 Ascender: 11 MediumBold: Font: common|FreeSansBold.ttf Size: 18 Ascender: 14 BigBold: Font: common|FreeSansBold.ttf Size: 24 Ascender: 18 Title: Font: common|FreeSansBold.ttf Size: 32 Ascender: 24 Hotkeys: common|hotkeys/chat.yaml common|hotkeys/control-groups.yaml common|hotkeys/editor.yaml common|hotkeys/game.yaml common|hotkeys/observer.yaml common|hotkeys/production-common.yaml common|hotkeys/supportpowers.yaml common|hotkeys/viewport.yaml FluentMessages: common|fluent/common.ftl common|fluent/chrome.ftl common|fluent/hotkeys.ftl common|fluent/rules.ftl example|fluent/mod.ftl example|fluent/chrome.ftl example|fluent/rules.ftl AllowUnusedFluentMessagesInExternalPackages: true ================================================ FILE: mods/example/mod.content.yaml ================================================ Cursors: example|cursors/default.yaml Missions: example|missions/example.yaml Music: example|music/example.yaml Notifications: example|notifications/example.yaml Rules: example|rules/example.yaml example|rules/mpspawn.yaml example|rules/palettes.yaml example|rules/player.yaml example|rules/world.yaml Sequences: example|sequences/example.yaml example|sequences/mapeditor.yaml example|sequences/mpspawn.yaml TileSets: example|tilesets/example.yaml Voices: example|voices/example.yaml Weapons: example|weapons/example.yaml ================================================ FILE: mods/example/mod.yaml ================================================ Metadata: Title: mod-title Version: {DEV_VERSION} WindowTitle: mod-windowtitle FileSystem: DefaultFileSystem Packages: ^EngineDir $example: example ^EngineDir|mods/common: common MapFolders: example|maps: System Assemblies: OpenRA.Mods.Common.dll, OpenRA.Mods.Example.dll AssetBrowser: AudioExtensions: .wav SpriteExtensions: .png VideoExtensions: SupportsMapsFrom: Example LoadScreen: BlankLoadScreen ServerTraits: LobbyCommands SkirmishLogic PlayerPinger MasterServerPinger LobbySettingsNotification MapGrid: TileSize: 32, 32 Type: Rectangular SpriteFormats: PngSheet SoundFormats: Wav TerrainFormat: DefaultTerrain SpriteSequenceFormat: DefaultSpriteSequence DefaultOrderGenerator: UnitOrderGenerator GameSpeeds: DefaultSpeed: default Speeds: slowest: Name: options-game-speed.slowest Timestep: 80 OrderLatency: 2 slower: Name: options-game-speed.slower Timestep: 50 OrderLatency: 3 default: Name: options-game-speed.normal Timestep: 40 OrderLatency: 3 fast: Name: options-game-speed.fast Timestep: 35 OrderLatency: 4 faster: Name: options-game-speed.faster Timestep: 30 OrderLatency: 4 fastest: Name: options-game-speed.fastest Timestep: 20 OrderLatency: 6 Include: mod.content.yaml Include: mod.chrome.yaml ================================================ FILE: mods/example/music/example.yaml ================================================ ================================================ FILE: mods/example/notifications/example.yaml ================================================ Sounds: Notifications: ChatLine: ClickDisabledSound: ClickSound: ================================================ FILE: mods/example/rules/example.yaml ================================================ example: AlwaysVisible: BodyOrientation: HitShape: Immobile: MapEditorData: Categories: Actors QuantizeFacingsFromSequence: RenderSprites: WithSpriteBody: example.colorpicker: Inherits: example RenderSprites: Image: example Palette: colorpicker -MapEditorData: ================================================ FILE: mods/example/rules/mpspawn.yaml ================================================ mpspawn: AlwaysVisible: Immobile: OccupiesSpace: false MapEditorData: Categories: System RenderSpritesEditorOnly: WithSpriteBody: ================================================ FILE: mods/example/rules/palettes.yaml ================================================ ^palettes: PaletteFromGrayscale@greyscale: Name: greyscale PlayerColorPalette@player: BasePalette: greyscale PlayerColorShift: BasePalette: player ColorPickerPalette@colorpicker: Name: colorpicker BasePalette: greyscale AllowModifiers: false ColorPickerColorShift: BasePalette: colorpicker ================================================ FILE: mods/example/rules/player.yaml ================================================ ^baseplayer: AlwaysVisible: Shroud: player: Inherits: ^baseplayer DeveloperMode: editorplayer: Inherits: ^baseplayer ================================================ FILE: mods/example/rules/world.yaml ================================================ ^baseworld: Inherits: ^palettes ActorMap: AlwaysVisible: ControlGroups: Faction@Random: InternalName: Random Name: faction-random.name RandomFactionMembers: example Description: faction-random.description Faction@example: InternalName: example Name: faction-example.name Description: faction-example.description LoadWidgetAtGameStart: MusicPlaylist: ScreenMap: Selection: TerrainRenderer: world: Inherits: ^baseworld ColorPickerManager: PreviewActor: example.colorpicker CreateMapPlayers: CustomTerrainDebugOverlay: DebugVisualizations: MapStartingLocations: SpawnMapActors: SpawnStartingUnits: StartingUnits@Example: BaseActor: example Factions: example ClassName: options-starting-units.unlabeled editorworld: Inherits: ^baseworld BuildableTerrainOverlay: AllowedTerrainTypes: Palette: EditorActionManager: EditorActorLayer: EditorCursorLayer: MarkerLayerOverlay: TerrainGeometryOverlay: ================================================ FILE: mods/example/sequences/example.yaml ================================================ example: idle: Filename: sequences/assets/example.png ================================================ FILE: mods/example/sequences/mapeditor.yaml ================================================ overlay: build-invalid: Filename: sequences/assets/mapeditor.png Start: 1 editor-overlay: Defaults: Filename: sequences/assets/mapeditor.png copy: paste: Start: 1 ================================================ FILE: mods/example/sequences/mpspawn.yaml ================================================ mpspawn: idle: Filename: sequences/assets/mpspawn.png ================================================ FILE: mods/example/tilesets/example.yaml ================================================ General: Name: Example Id: EXAMPLE EditorTemplateOrder: Terrain Palette: Terrain: TerrainType@Clear: Type: Clear Templates: Template@255: Id: 255 Images: tilesets/example/example.png Size: 1,1 Categories: Terrain Tiles: 0: Clear ================================================ FILE: mods/example/voices/example.yaml ================================================ ================================================ FILE: mods/example/weapons/example.yaml ================================================ ================================================ FILE: omnisharp.json ================================================ { "RoslynExtensionsOptions": { "enableAnalyzersSupport": true } } ================================================ FILE: packaging/functions.sh ================================================ #!/bin/sh # Helper functions for packaging and installing projects using the OpenRA Mod SDK #### # This file must stay /bin/sh and POSIX compliant for macOS and BSD portability. # Copy-paste the entire script into https://shellcheck.net to check. #### # Compile and publish any mod assemblies to the target directory # Arguments: # SRC_PATH: Path to the root SDK directory # DEST_PATH: Path to the root of the install destination (will be created if necessary) # TARGETPLATFORM: Platform type (win-x86, win-x64, osx-x64, osx-arm64, linux-x64, linux-arm64, unix-generic) # RUNTIME: Runtime type (net6, mono) # ENGINE_PATH: Path to the engine root directory install_mod_assemblies() { SRC_PATH="${1}" DEST_PATH="${2}" TARGETPLATFORM="${3}" RUNTIME="${4}" ENGINE_PATH="${5}" ORIG_PWD=$(pwd) cd "${SRC_PATH}" || exit 1 if [ "${RUNTIME}" = "mono" ]; then echo "Building assemblies" rm -rf "${ENGINE_PATH:?}/bin" find . -maxdepth 1 -name '*.sln' -exec msbuild -verbosity:m -nologo -t:Build -restore -p:Configuration=Release -p:TargetPlatform="${TARGETPLATFORM}" -p:Mono=true \; cd "${ORIG_PWD}" || exit 1 for LIB in "${ENGINE_PATH}/bin/"*.dll "${ENGINE_PATH}/bin/"*.dll.config; do install -m644 "${LIB}" "${DEST_PATH}" done if [ "${TARGETPLATFORM}" = "linux-x64" ] || [ "${TARGETPLATFORM}" = "linux-arm64" ]; then for LIB in "${ENGINE_PATH}/bin/"*.so; do install -m755 "${LIB}" "${DEST_PATH}" done fi if [ "${TARGETPLATFORM}" = "osx-x64" ] || [ "${TARGETPLATFORM}" = "osx-arm64" ]; then for LIB in "${ENGINE_PATH}/bin/"*.dylib; do install -m755 "${LIB}" "${DEST_PATH}" done fi else find . -maxdepth 1 -name '*.sln' -exec dotnet publish -c Release -p:TargetPlatform="${TARGETPLATFORM}" -r "${TARGETPLATFORM}" -p:PublishDir="${DEST_PATH}" --self-contained true \; cd "${ORIG_PWD}" || exit 1 fi } ================================================ FILE: packaging/linux/buildpackage.sh ================================================ #!/bin/bash # OpenRA packaging script for Linux (AppImage) set -e command -v make >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK Linux packaging requires make."; exit 1; } command -v python3 >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK Linux packaging requires python 3."; exit 1; } command -v curl >/dev/null 2>&1 || command -v wget > /dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK Linux packaging requires curl or wget."; exit 1; } require_variables() { missing="" for i in "$@"; do eval check="\$$i" [ -z "${check}" ] && missing="${missing} ${i}\n" done if [ -n "${missing}" ]; then printf "Required mod.config variables are missing:\n%sRepair your mod.config (or user.config) and try again.\n" "${missing}" exit 1 fi } if [ $# -eq "0" ]; then echo "Usage: $(basename "$0") version [outputdir]" exit 1 fi PACKAGING_DIR=$(python3 -c "import os; print(os.path.dirname(os.path.realpath('$0')))") TEMPLATE_ROOT="${PACKAGING_DIR}/../../" ARTWORK_DIR="${PACKAGING_DIR}/../artwork/" # shellcheck source=mod.config . "${TEMPLATE_ROOT}/mod.config" if [ -f "${TEMPLATE_ROOT}/user.config" ]; then # shellcheck source=user.config . "${TEMPLATE_ROOT}/user.config" fi require_variables "MOD_ID" "ENGINE_DIRECTORY" "PACKAGING_DISPLAY_NAME" "PACKAGING_INSTALLER_NAME" "PACKAGING_COPY_CNC_DLL" "PACKAGING_COPY_D2K_DLL" \ "PACKAGING_FAQ_URL" "PACKAGING_OVERWRITE_MOD_VERSION" TAG="$1" if [ $# -eq "1" ]; then OUTPUTDIR=$(python3 -c "import os; print(os.path.realpath('.'))") else OUTPUTDIR=$(python3 -c "import os; print(os.path.realpath('$2'))") fi APPDIR="${PACKAGING_DIR}/${PACKAGING_INSTALLER_NAME}.appdir" # Set the working dir to the location of this script cd "${PACKAGING_DIR}" if [ ! -f "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/Makefile" ]; then echo "Required engine files not found." echo "Run \`make\` in the mod directory to fetch and build the required files, then try again."; exit 1 fi . "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/functions.sh" . "${TEMPLATE_ROOT}/packaging/functions.sh" if [ ! -d "${OUTPUTDIR}" ]; then echo "Output directory '${OUTPUTDIR}' does not exist."; exit 1 fi echo "Building core files" install_assemblies "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${APPDIR}/usr/lib/openra" "linux-x64" "net6" "True" "${PACKAGING_COPY_CNC_DLL}" "${PACKAGING_COPY_D2K_DLL}" install_data "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${APPDIR}/usr/lib/openra" for f in ${PACKAGING_COPY_ENGINE_FILES}; do mkdir -p "${APPDIR}/usr/lib/openra/$(dirname "${f}")" cp -r "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/${f}" "${APPDIR}/usr/lib/openra/${f}" done echo "Building mod files" install_mod_assemblies "${TEMPLATE_ROOT}" "${APPDIR}/usr/lib/openra" "linux-x64" "net6" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" cp -Lr "${TEMPLATE_ROOT}/mods/"* "${APPDIR}/usr/lib/openra/mods" set_engine_version "${ENGINE_VERSION}" "${APPDIR}/usr/lib/openra" if [ "${PACKAGING_OVERWRITE_MOD_VERSION}" == "True" ]; then set_mod_version "${TAG}" "${APPDIR}/usr/lib/openra/mods/${MOD_ID}/mod.yaml" else MOD_VERSION=$(grep 'Version:' "${APPDIR}/usr/lib/openra/mods/${MOD_ID}/mod.yaml" | awk '{print $2}') echo "Mod version ${MOD_VERSION} will remain unchanged."; fi # Add native libraries echo "Downloading appimagetool" if command -v curl >/dev/null 2>&1; then curl -s -L -O https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage || exit 3 else wget -cq https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage || exit 3 fi echo "Building AppImage" # Add launcher and icons sed "s/{MODID}/${MOD_ID}/g" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/linux/AppRun.in" | sed "s/{MODNAME}/${PACKAGING_DISPLAY_NAME}/g" > "${APPDIR}/AppRun" chmod 0755 "${APPDIR}/AppRun" if [ -n "${PACKAGING_DISCORD_APPID}" ]; then sed "s/{DISCORDAPPID}/${PACKAGING_DISCORD_APPID}/g" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/linux/openra.desktop.discord.in" > temp.desktop.in sed "s/{DISCORDAPPID}/${PACKAGING_DISCORD_APPID}/g" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/linux/openra-mimeinfo.xml.discord.in" > temp.xml.in else cp "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/linux/openra.desktop.in" temp.desktop.in cp "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/linux/openra-mimeinfo.xml.in" temp.xml.in fi mkdir -p "${APPDIR}/usr/share/applications" chmod 0755 temp.desktop.in sed "s/{MODID}/${MOD_ID}/g" temp.desktop.in | sed "s/{MODNAME}/${PACKAGING_DISPLAY_NAME}/g" | sed "s/{TAG}/${TAG}/g" > "${APPDIR}/usr/share/applications/openra-${MOD_ID}.desktop" cp "${APPDIR}/usr/share/applications/openra-${MOD_ID}.desktop" "${APPDIR}/openra-${MOD_ID}.desktop" rm temp.desktop.in mkdir -p "${APPDIR}/usr/share/mime/packages" chmod 0644 temp.xml.in sed "s/{MODID}/${MOD_ID}/g" temp.xml.in | sed "s/{TAG}/${TAG}/g" > "${APPDIR}/usr/share/mime/packages/openra-${MOD_ID}.xml" rm temp.xml.in if [ -f "${ARTWORK_DIR}/icon_scalable.svg" ]; then install -Dm644 "${ARTWORK_DIR}/icon_scalable.svg" "${APPDIR}/usr/share/icons/hicolor/scalable/apps/openra-${MOD_ID}.svg" fi for i in 16x16 32x32 48x48 64x64 128x128 256x256 512x512 1024x1024; do if [ -f "${ARTWORK_DIR}/icon_${i}.png" ]; then install -Dm644 "${ARTWORK_DIR}/icon_${i}.png" "${APPDIR}/usr/share/icons/hicolor/${i}/apps/openra-${MOD_ID}.png" install -m644 "${ARTWORK_DIR}/icon_${i}.png" "${APPDIR}/openra-${MOD_ID}.png" fi done install -d "${APPDIR}/usr/bin" sed "s/{MODID}/${MOD_ID}/g" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/linux/openra.appimage.in" | sed "s/{TAG}/${TAG}/g" | sed "s/{MODNAME}/${PACKAGING_DISPLAY_NAME}/g" | sed "s/{MODINSTALLERNAME}/${PACKAGING_INSTALLER_NAME}/g" | sed "s|{MODFAQURL}|${PACKAGING_FAQ_URL}|g" > "${APPDIR}/usr/bin/openra-${MOD_ID}" chmod 0755 "${APPDIR}/usr/bin/openra-${MOD_ID}" sed "s/{MODID}/${MOD_ID}/g" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/linux/openra-server.appimage.in" > "${APPDIR}/usr/bin/openra-${MOD_ID}-server" chmod 0755 "${APPDIR}/usr/bin/openra-${MOD_ID}-server" sed "s/{MODID}/${MOD_ID}/g" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/linux/openra-utility.appimage.in" > "${APPDIR}/usr/bin/openra-${MOD_ID}-utility" chmod 0755 "${APPDIR}/usr/bin/openra-${MOD_ID}-utility" install -m 0755 "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/linux/gtk-dialog.py" "${APPDIR}/usr/bin/gtk-dialog.py" chmod a+x appimagetool-x86_64.AppImage ARCH=x86_64 ./appimagetool-x86_64.AppImage "${APPDIR}" "${OUTPUTDIR}/${PACKAGING_INSTALLER_NAME}-${TAG}-x86_64.AppImage" # Clean up rm -rf appimagetool-x86_64.AppImage "${PACKAGING_APPIMAGE_DEPENDENCIES_TEMP_ARCHIVE_NAME}" "${APPDIR}" ================================================ FILE: packaging/macos/buildpackage.sh ================================================ #!/bin/bash # OpenRA Mod SDK packaging script for macOS # # The application bundles will be signed if the following environment variables are defined: # MACOS_DEVELOPER_IDENTITY: The alphanumeric identifier listed in the certificate name ("Developer ID Application: ()") # or as Team ID in your Apple Developer account Membership Details. # If the identity is not already in the default keychain, specify the following environment variables to import it: # MACOS_DEVELOPER_CERTIFICATE_BASE64: base64 content of the exported .p12 developer ID certificate. # Generate using `base64 certificate.p12 | pbcopy` # MACOS_DEVELOPER_CERTIFICATE_PASSWORD: password to unlock the MACOS_DEVELOPER_CERTIFICATE_BASE64 certificate # # The applicaton bundles will be notarized if the following environment variables are defined: # MACOS_DEVELOPER_USERNAME: Email address for the developer account # MACOS_DEVELOPER_PASSWORD: App-specific password for the developer account # set -o errexit -o pipefail || exit $? if [[ "$OSTYPE" != "darwin"* ]]; then echo >&2 "macOS packaging requires a macOS host" exit 1 fi command -v make >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK macOS packaging requires make."; exit 1; } command -v python3 >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK macOS packaging requires python 3."; exit 1; } command -v clang >/dev/null 2>&1 || { echo >&2 "macOS packaging requires clang."; exit 1; } require_variables() { missing="" for i in "$@"; do eval check="\$$i" [ -z "${check}" ] && missing="${missing} ${i}\n" done if [ -n "${missing}" ]; then printf "Required mod.config variables are missing:\n%sRepair your mod.config (or user.config) and try again.\n" "${missing}" exit 1 fi } if [ $# -ne "2" ]; then echo "Usage: $(basename "$0") tag outputdir" exit 1 fi PACKAGING_DIR=$(python3 -c "import os; print(os.path.dirname(os.path.realpath('$0')))") TEMPLATE_ROOT="${PACKAGING_DIR}/../../" ARTWORK_DIR="${PACKAGING_DIR}/../artwork/" # shellcheck source=mod.config . "${TEMPLATE_ROOT}/mod.config" if [ -f "${TEMPLATE_ROOT}/user.config" ]; then # shellcheck source=user.config . "${TEMPLATE_ROOT}/user.config" fi require_variables "MOD_ID" "ENGINE_DIRECTORY" "PACKAGING_DISPLAY_NAME" "PACKAGING_INSTALLER_NAME" "PACKAGING_COPY_CNC_DLL" "PACKAGING_COPY_D2K_DLL" \ "PACKAGING_OSX_DMG_MOD_ICON_POSITION" "PACKAGING_OSX_DMG_APPLICATION_ICON_POSITION" "PACKAGING_OSX_DMG_HIDDEN_ICON_POSITION" \ "PACKAGING_FAQ_URL" "PACKAGING_OVERWRITE_MOD_VERSION" if [ ! -f "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/Makefile" ]; then echo "Required engine files not found." echo "Run \`make\` in the mod directory to fetch and build the required files, then try again."; exit 1 fi . "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/functions.sh" . "${TEMPLATE_ROOT}/packaging/functions.sh" # Import code signing certificate if [ -n "${MACOS_DEVELOPER_CERTIFICATE_BASE64}" ] && [ -n "${MACOS_DEVELOPER_CERTIFICATE_PASSWORD}" ] && [ -n "${MACOS_DEVELOPER_IDENTITY}" ]; then echo "Importing signing certificate" echo "${MACOS_DEVELOPER_CERTIFICATE_BASE64}" | base64 --decode > build.p12 security create-keychain -p build build.keychain security default-keychain -s build.keychain security unlock-keychain -p build build.keychain security import build.p12 -k build.keychain -P "${MACOS_DEVELOPER_CERTIFICATE_PASSWORD}" -T /usr/bin/codesign >/dev/null 2>&1 security set-key-partition-list -S apple-tool:,apple: -s -k build build.keychain >/dev/null 2>&1 rm -fr build.p12 fi TAG="$1" if [ $# -eq "1" ]; then OUTPUTDIR=$(python3 -c "import os; print(os.path.realpath('.'))") else OUTPUTDIR=$(python3 -c "import os; print(os.path.realpath('$2'))") fi if [ ! -d "${OUTPUTDIR}" ]; then echo "Output directory '${OUTPUTDIR}' does not exist."; exit 1 fi BUILTDIR="${PACKAGING_DIR}/build" PACKAGING_OSX_APP_NAME="OpenRA - ${PACKAGING_DISPLAY_NAME}.app" # Set the working dir to the location of this script cd "${PACKAGING_DIR}" modify_plist() { sed "s|$1|$2|g" "$3" > "$3.tmp" && mv "$3.tmp" "$3" } LAUNCHER_DIR="${BUILTDIR}/${PACKAGING_OSX_APP_NAME}" LAUNCHER_CONTENTS_DIR="${LAUNCHER_DIR}/Contents" LAUNCHER_ASSEMBLY_DIR="${LAUNCHER_CONTENTS_DIR}/MacOS" LAUNCHER_RESOURCES_DIR="${LAUNCHER_CONTENTS_DIR}/Resources" echo "Building launcher" mkdir -p "${LAUNCHER_RESOURCES_DIR}" mkdir -p "${LAUNCHER_ASSEMBLY_DIR}/x86_64" mkdir -p "${LAUNCHER_ASSEMBLY_DIR}/arm64" mkdir -p "${LAUNCHER_ASSEMBLY_DIR}/mono" echo "APPL????" > "${LAUNCHER_CONTENTS_DIR}/PkgInfo" cp "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/Info.plist.in" "${LAUNCHER_CONTENTS_DIR}/Info.plist" modify_plist "{DEV_VERSION}" "${TAG}" "${LAUNCHER_CONTENTS_DIR}/Info.plist" modify_plist "{FAQ_URL}" "${PACKAGING_FAQ_URL}" "${LAUNCHER_CONTENTS_DIR}/Info.plist" modify_plist "{MOD_ID}" "${MOD_ID}" "${LAUNCHER_CONTENTS_DIR}/Info.plist" modify_plist "{MINIMUM_SYSTEM_VERSION}" "10.11" "${LAUNCHER_CONTENTS_DIR}/Info.plist" modify_plist "{MOD_NAME}" "${PACKAGING_DISPLAY_NAME}" "${LAUNCHER_CONTENTS_DIR}/Info.plist" modify_plist "{JOIN_SERVER_URL_SCHEME}" "openra-${MOD_ID}-${TAG}" "${LAUNCHER_CONTENTS_DIR}/Info.plist" if [ -n "${DISCORD_APPID}" ]; then modify_plist "{DISCORD_URL_SCHEME}" "discord-${DISCORD_APPID}" "${LAUNCHER_CONTENTS_DIR}/Info.plist" else modify_plist "{DISCORD_URL_SCHEME}" "" "${LAUNCHER_CONTENTS_DIR}/Info.plist" fi # Compile universal (x86_64 + arm64) Launcher and arch-specific apphosts clang "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/apphost.c" -o "${LAUNCHER_ASSEMBLY_DIR}/apphost-x86_64" -framework AppKit -target x86_64-apple-macos10.15 clang "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/apphost.c" -o "${LAUNCHER_ASSEMBLY_DIR}/apphost-arm64" -framework AppKit -target arm64-apple-macos10.15 clang "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/apphost-mono.c" -o "${LAUNCHER_ASSEMBLY_DIR}/apphost-mono" -framework AppKit -target x86_64-apple-macos10.11 clang "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/checkmono.c" -o "${LAUNCHER_ASSEMBLY_DIR}/checkmono" -framework AppKit -target x86_64-apple-macos10.11 clang "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/launcher.m" -o "${LAUNCHER_ASSEMBLY_DIR}/Launcher-x86_64" -framework AppKit -target x86_64-apple-macos10.11 clang "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/launcher.m" -o "${LAUNCHER_ASSEMBLY_DIR}/Launcher-arm64" -framework AppKit -target arm64-apple-macos10.15 lipo -create -output "${LAUNCHER_ASSEMBLY_DIR}/Launcher" "${LAUNCHER_ASSEMBLY_DIR}/Launcher-x86_64" "${LAUNCHER_ASSEMBLY_DIR}/Launcher-arm64" rm "${LAUNCHER_ASSEMBLY_DIR}/Launcher-x86_64" "${LAUNCHER_ASSEMBLY_DIR}/Launcher-arm64" install_assemblies "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${LAUNCHER_ASSEMBLY_DIR}/x86_64" "osx-x64" "net6" "True" "${PACKAGING_COPY_CNC_DLL}" "${PACKAGING_COPY_D2K_DLL}" install_assemblies "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${LAUNCHER_ASSEMBLY_DIR}/arm64" "osx-arm64" "net6" "True" "${PACKAGING_COPY_CNC_DLL}" "${PACKAGING_COPY_D2K_DLL}" install_assemblies "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${LAUNCHER_ASSEMBLY_DIR}/mono" "osx-x64" "mono" "True" "${PACKAGING_COPY_CNC_DLL}" "${PACKAGING_COPY_D2K_DLL}" install_data "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${LAUNCHER_RESOURCES_DIR}" for f in ${PACKAGING_COPY_ENGINE_FILES}; do mkdir -p "${LAUNCHER_RESOURCES_DIR}/$(dirname "${f}")" cp -r "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/${f}" "${LAUNCHER_RESOURCES_DIR}/${f}" done echo "Building mod files" install_mod_assemblies "${TEMPLATE_ROOT}" "${LAUNCHER_ASSEMBLY_DIR}/x86_64" "osx-x64" "net6" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" install_mod_assemblies "${TEMPLATE_ROOT}" "${LAUNCHER_ASSEMBLY_DIR}/arm64" "osx-arm64" "net6" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" install_mod_assemblies "${TEMPLATE_ROOT}" "${LAUNCHER_ASSEMBLY_DIR}/mono" "osx-x64" "mono" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" cp -LR "${TEMPLATE_ROOT}mods/"* "${LAUNCHER_RESOURCES_DIR}/mods" set_engine_version "${ENGINE_VERSION}" "${LAUNCHER_RESOURCES_DIR}" if [ "${PACKAGING_OVERWRITE_MOD_VERSION}" == "True" ]; then set_mod_version "${TAG}" "${LAUNCHER_RESOURCES_DIR}/mods/${MOD_ID}/mod.yaml" else MOD_VERSION=$(grep 'Version:' "${LAUNCHER_RESOURCES_DIR}/mods/${MOD_ID}/mod.yaml" | awk '{print $2}') echo "Mod version ${MOD_VERSION} will remain unchanged."; fi # Assemble multi-resolution icon mkdir "${BUILTDIR}/mod.iconset" cp "${ARTWORK_DIR}/icon_16x16.png" "${BUILTDIR}/mod.iconset/icon_16x16.png" cp "${ARTWORK_DIR}/icon_32x32.png" "${BUILTDIR}/mod.iconset/icon_16x16@2.png" cp "${ARTWORK_DIR}/icon_32x32.png" "${BUILTDIR}/mod.iconset/icon_32x32.png" cp "${ARTWORK_DIR}/icon_64x64.png" "${BUILTDIR}/mod.iconset/icon_32x32@2x.png" cp "${ARTWORK_DIR}/icon_128x128.png" "${BUILTDIR}/mod.iconset/icon_128x128.png" cp "${ARTWORK_DIR}/icon_256x256.png" "${BUILTDIR}/mod.iconset/icon_128x128@2x.png" cp "${ARTWORK_DIR}/icon_256x256.png" "${BUILTDIR}/mod.iconset/icon_256x256.png" cp "${ARTWORK_DIR}/icon_512x512.png" "${BUILTDIR}/mod.iconset/icon_256x256@2x.png" iconutil --convert icns "${BUILTDIR}/mod.iconset" -o "${LAUNCHER_RESOURCES_DIR}/${MOD_ID}.icns" rm -rf "${BUILTDIR}/mod.iconset" # Sign binaries with developer certificate if [ -n "${MACOS_DEVELOPER_IDENTITY}" ]; then codesign -s "${MACOS_DEVELOPER_IDENTITY}" --timestamp --options runtime -f --entitlements "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/macos/entitlements.plist" --deep "${LAUNCHER_DIR}" fi echo "Packaging disk image" hdiutil create "build.dmg" -format UDRW -volname "${PACKAGING_DISPLAY_NAME}" -fs HFS+ -srcfolder "${BUILTDIR}" DMG_DEVICE=$(hdiutil attach -readwrite -noverify -noautoopen "${PACKAGING_DIR}/build.dmg" | egrep '^/dev/' | sed 1q | awk '{print $1}') sleep 2 # Background image is created from source svg in artsrc repository mkdir "/Volumes/${PACKAGING_DISPLAY_NAME}/.background/" tiffutil -cathidpicheck "${ARTWORK_DIR}/macos-background.png" "${ARTWORK_DIR}/macos-background-2x.png" -out "/Volumes/${PACKAGING_DISPLAY_NAME}/.background/background.tiff" cp "${LAUNCHER_DIR}/Contents/Resources/${MOD_ID}.icns" "/Volumes/${PACKAGING_DISPLAY_NAME}/.VolumeIcon.icns" echo ' tell application "Finder" tell disk "'${PACKAGING_DISPLAY_NAME}'" open set current view of container window to icon view set toolbar visible of container window to false set statusbar visible of container window to false set the bounds of container window to {400, 100, 1000, 550} set theViewOptions to the icon view options of container window set arrangement of theViewOptions to not arranged set icon size of theViewOptions to 72 set background picture of theViewOptions to file ".background:background.tiff" make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"} set position of item "'${PACKAGING_OSX_APP_NAME}'" of container window to {'${PACKAGING_OSX_DMG_MOD_ICON_POSITION}'} set position of item "Applications" of container window to {'${PACKAGING_OSX_DMG_APPLICATION_ICON_POSITION}'} set position of item ".background" of container window to {'${PACKAGING_OSX_DMG_HIDDEN_ICON_POSITION}'} set position of item ".fseventsd" of container window to {'${PACKAGING_OSX_DMG_HIDDEN_ICON_POSITION}'} set position of item ".VolumeIcon.icns" of container window to {'${PACKAGING_OSX_DMG_HIDDEN_ICON_POSITION}'} update without registering applications delay 5 close end tell end tell ' | osascript # HACK: Copy the volume icon again - something in the previous step seems to delete it...? cp "${LAUNCHER_DIR}/Contents/Resources/${MOD_ID}.icns" "/Volumes/${PACKAGING_DISPLAY_NAME}/.VolumeIcon.icns" SetFile -c icnC "/Volumes/${PACKAGING_DISPLAY_NAME}/.VolumeIcon.icns" SetFile -a C "/Volumes/${PACKAGING_DISPLAY_NAME}" chmod -Rf go-w "/Volumes/${PACKAGING_DISPLAY_NAME}" sync sync hdiutil detach "${DMG_DEVICE}" rm -rf "${BUILTDIR}" if [ -n "${MACOS_DEVELOPER_CERTIFICATE_BASE64}" ] && [ -n "${MACOS_DEVELOPER_CERTIFICATE_PASSWORD}" ] && [ -n "${MACOS_DEVELOPER_IDENTITY}" ]; then security delete-keychain build.keychain fi if [ -n "${MACOS_DEVELOPER_USERNAME}" ] && [ -n "${MACOS_DEVELOPER_PASSWORD}" ] && [ -n "${MACOS_DEVELOPER_IDENTITY}" ]; then echo "Submitting build for notarization" # Reset xcode search path to fix xcrun not finding altool sudo xcode-select -r # Create a temporary read-only dmg for submission (notarization service rejects read/write images) hdiutil convert "build.dmg" -format ULFO -ov -o "build-notarization.dmg" xcrun notarytool submit "build-notarization.dmg" --wait --apple-id "${MACOS_DEVELOPER_USERNAME}" --password "${MACOS_DEVELOPER_PASSWORD}" --team-id "${MACOS_DEVELOPER_IDENTITY}" rm "build-notarization.dmg" echo "Stapling tickets" DMG_DEVICE=$(hdiutil attach -readwrite -noverify -noautoopen "build.dmg" | egrep '^/dev/' | sed 1q | awk '{print $1}') sleep 2 xcrun stapler staple "/Volumes/${PACKAGING_DISPLAY_NAME}/${PACKAGING_OSX_APP_NAME}" sync sync hdiutil detach "${DMG_DEVICE}" fi hdiutil convert "build.dmg" -format ULFO -ov -o "${OUTPUTDIR}/${PACKAGING_INSTALLER_NAME}-${TAG}.dmg" rm "build.dmg" ================================================ FILE: packaging/package-all.sh ================================================ #!/bin/bash set -e if [ $# -eq "0" ]; then echo "Usage: `basename $0` version [outputdir]" exit 1 fi TAG="$1" if [ $# -eq "1" ]; then OUTPUTDIR=$(pwd) else OUTPUTDIR=$2 fi command -v python3 >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK packaging requires python 3."; exit 1; } command -v make >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK packaging requires make."; exit 1; } if [[ "$OSTYPE" != "darwin"* ]]; then command -v curl >/dev/null 2>&1 || command -v wget > /dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK packaging requires curl or wget."; exit 1; } command -v makensis >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK packaging requires makensis."; exit 1; } fi PACKAGING_DIR=$(python3 -c "import os; print(os.path.dirname(os.path.realpath('$0')))") if [[ "$OSTYPE" == "darwin"* ]]; then echo "Windows packaging requires a Linux host." echo "Linux AppImage packaging requires a Linux host." echo "Building macOS package" ${PACKAGING_DIR}/macos/buildpackage.sh "${TAG}" "${OUTPUTDIR}" if [ $? -ne 0 ]; then echo "macOS package build failed." fi else echo "Building Windows package" ${PACKAGING_DIR}/windows/buildpackage.sh "${TAG}" "${OUTPUTDIR}" if [ $? -ne 0 ]; then echo "Windows package build failed." fi echo "Building Linux AppImage package" ${PACKAGING_DIR}/linux/buildpackage.sh "${TAG}" "${OUTPUTDIR}" if [ $? -ne 0 ]; then echo "Linux AppImage package build failed." fi echo "macOS packaging requires a macOS host." fi echo "Package build done." ================================================ FILE: packaging/windows/buildpackage.nsi ================================================ ; Copyright (c) The OpenRA Developers and Contributors ; This file is part of OpenRA. ; ; OpenRA is free software: you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation, either version 3 of the License, or ; (at your option) any later version. ; ; OpenRA is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with OpenRA. If not, see . !include "MUI2.nsh" !include "FileFunc.nsh" !include "WordFunc.nsh" Name "${PACKAGING_DISPLAY_NAME}" OutFile "${OUTFILE}" ManifestDPIAware true Unicode True Function .onInit !ifndef USE_PROGRAMFILES32 SetRegView 64 !endif ReadRegStr $INSTDIR HKLM "Software\${PACKAGING_WINDOWS_REGISTRY_KEY}" "InstallDir" StrCmp $INSTDIR "" unset done unset: !ifndef USE_PROGRAMFILES32 StrCpy $INSTDIR "$PROGRAMFILES64\${PACKAGING_WINDOWS_INSTALL_DIR_NAME}" !else StrCpy $INSTDIR "$PROGRAMFILES32\${PACKAGING_WINDOWS_INSTALL_DIR_NAME}" !endif done: FunctionEnd SetCompressor lzma RequestExecutionLevel admin !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "${PACKAGING_WINDOWS_LICENSE_FILE}" !insertmacro MUI_PAGE_DIRECTORY !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${PACKAGING_WINDOWS_REGISTRY_KEY}" !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" !define MUI_STARTMENUPAGE_DEFAULTFOLDER "OpenRA" Var StartMenuFolder !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH !insertmacro MUI_LANGUAGE "English" ;*************************** ;Section Definitions ;*************************** Section "-Reg" Reg ; Installation directory WriteRegStr HKLM "Software\${PACKAGING_WINDOWS_REGISTRY_KEY}" "InstallDir" $INSTDIR ; Join server URL Scheme WriteRegStr HKLM "Software\Classes\openra-${MOD_ID}-${TAG}" "" "URL:Join OpenRA server" WriteRegStr HKLM "Software\Classes\openra-${MOD_ID}-${TAG}" "URL Protocol" "" WriteRegStr HKLM "Software\Classes\openra-${MOD_ID}-${TAG}\DefaultIcon" "" "$INSTDIR\${MOD_ID}.ico,0" WriteRegStr HKLM "Software\Classes\openra-${MOD_ID}-${TAG}\Shell\Open\Command" "" "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe Launch.URI=%1" !ifdef USE_DISCORDID WriteRegStr HKLM "Software\Classes\discord-${USE_DISCORDID}" "" "URL:Run game ${USE_DISCORDID} protocol" WriteRegStr HKLM "Software\Classes\discord-${USE_DISCORDID}" "URL Protocol" "" WriteRegStr HKLM "Software\Classes\discord-${USE_DISCORDID}\DefaultIcon" "" "$INSTDIR\${MOD_ID}.ico,0" WriteRegStr HKLM "Software\Classes\discord-${USE_DISCORDID}\Shell\Open\Command" "" "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" !endif SectionEnd Section "Game" GAME SectionIn RO SetOutPath "$INSTDIR" File "${SRCDIR}\*.exe" File "${SRCDIR}\*.dll.config" File "${SRCDIR}\*.dll" File "${SRCDIR}\*.ico" File "${SRCDIR}\*.deps.json" File "${SRCDIR}\*.runtimeconfig.json" File "${SRCDIR}\global mix database.dat" File "${SRCDIR}\IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP" File "${SRCDIR}\VERSION" File "${SRCDIR}\AUTHORS" File "${SRCDIR}\COPYING" File /r "${SRCDIR}\mods" !insertmacro MUI_STARTMENU_WRITE_BEGIN Application CreateDirectory "$SMPROGRAMS\$StartMenuFolder" CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${PACKAGING_DISPLAY_NAME}.lnk" "$OUTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" "" \ "$OUTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" "" "" "" "" !insertmacro MUI_STARTMENU_WRITE_END SetOutPath "$INSTDIR\glsl" File "${SRCDIR}\glsl\*.frag" File "${SRCDIR}\glsl\*.vert" ; Estimated install size for the control panel properties ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 IntFmt $0 "0x%08X" $0 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "EstimatedSize" "$0" SetShellVarContext all CreateDirectory "$APPDATA\OpenRA\ModMetadata" SetOutPath "$INSTDIR" nsExec::ExecToLog '"$INSTDIR\OpenRA.Utility.exe" ${MOD_ID} --register-mod "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" system' nsExec::ExecToLog '"$INSTDIR\OpenRA.Utility.exe" ${MOD_ID} --clear-invalid-mod-registrations system' SetShellVarContext current SectionEnd Section "Desktop Shortcut" DESKTOPSHORTCUT SetOutPath "$INSTDIR" CreateShortCut "$DESKTOP\OpenRA - ${PACKAGING_DISPLAY_NAME}.lnk" "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" "" \ "$INSTDIR\${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" "" "" "" "" SectionEnd ;*************************** ;Uninstaller Sections ;*************************** Section "-Uninstaller" WriteUninstaller $INSTDIR\uninstaller.exe WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "DisplayName" "${PACKAGING_DISPLAY_NAME}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "UninstallString" "$INSTDIR\uninstaller.exe" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "InstallLocation" "$INSTDIR" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "DisplayIcon" "$INSTDIR\${MOD_ID}.ico" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "Publisher" "${PACKAGING_AUTHORS}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "URLInfoAbout" "${PACKAGING_WEBSITE_URL}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "DisplayVersion" "${TAG}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "NoModify" "1" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" "NoRepair" "1" SectionEnd !macro Clean UN Function ${UN}Clean nsExec::ExecToLog '"$INSTDIR\OpenRA.Utility.exe" ${MOD_ID} --unregister-mod system' RMDir /r $INSTDIR\mods RMDir /r $INSTDIR\maps RMDir /r $INSTDIR\glsl Delete $INSTDIR\*.exe Delete $INSTDIR\*.dll Delete $INSTDIR\*.ico Delete $INSTDIR\*.dll.config Delete $INSTDIR\*.deps.json Delete $INSTDIR\*.runtimeconfig.json Delete $INSTDIR\VERSION Delete $INSTDIR\AUTHORS Delete $INSTDIR\COPYING Delete "$INSTDIR\global mix database.dat" Delete $INSTDIR\IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP RMDir /r $INSTDIR\Support !ifndef USE_PROGRAMFILES32 SetRegView 64 !endif DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PACKAGING_WINDOWS_REGISTRY_KEY}" DeleteRegKey HKLM "Software\Classes\openra-${MOD_ID}-${TAG}" !ifdef USE_DISCORDID DeleteRegKey HKLM "Software\Classes\discord-${USE_DISCORDID}" !endif Delete $INSTDIR\uninstaller.exe RMDir $INSTDIR !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder ; Clean up start menu: Delete all our icons, and the OpenRA folder ; *only* if we were the only installed version Delete "$SMPROGRAMS\$StartMenuFolder\${PACKAGING_DISPLAY_NAME}.lnk" RMDir "$SMPROGRAMS\$StartMenuFolder" Delete "$DESKTOP\OpenRA - ${PACKAGING_DISPLAY_NAME}.lnk" DeleteRegKey HKLM "Software\${PACKAGING_WINDOWS_REGISTRY_KEY}" FunctionEnd !macroend !insertmacro Clean "" !insertmacro Clean "un." Section "Uninstall" Call un.Clean SectionEnd ;*************************** ;Section Descriptions ;*************************** LangString DESC_GAME ${LANG_ENGLISH} "${PACKAGING_DISPLAY_NAME} game files." LangString DESC_DESKTOPSHORTCUT ${LANG_ENGLISH} "Place shortcut on the Desktop." !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${GAME} $(DESC_GAME) !insertmacro MUI_DESCRIPTION_TEXT ${DESKTOPSHORTCUT} $(DESC_DESKTOPSHORTCUT) !insertmacro MUI_FUNCTION_DESCRIPTION_END ;*************************** ;Callbacks ;*************************** Function .onInstFailed Call Clean FunctionEnd ================================================ FILE: packaging/windows/buildpackage.sh ================================================ #!/bin/bash set -e command -v curl >/dev/null 2>&1 || command -v wget > /dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK Windows packaging requires curl or wget."; exit 1; } command -v makensis >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK Windows packaging requires makensis."; exit 1; } command -v convert >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK Windows packaging requires ImageMagick."; exit 1; } command -v python3 >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK Windows packaging requires python 3."; exit 1; } command -v wine64 >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK Windows packaging requires wine64."; exit 1; } require_variables() { missing="" for i in "$@"; do eval check="\$$i" [ -z "${check}" ] && missing="${missing} ${i}\n" done if [ -n "${missing}" ]; then printf "Required mod.config variables are missing:\n%sRepair your mod.config (or user.config) and try again.\n" "${missing}" exit 1 fi } if [ $# -eq "0" ]; then echo "Usage: $(basename "$0") version [outputdir]" exit 1 fi PACKAGING_DIR=$(python3 -c "import os; print(os.path.dirname(os.path.realpath('$0')))") TEMPLATE_ROOT="${PACKAGING_DIR}/../../" ARTWORK_DIR="${PACKAGING_DIR}/../artwork/" # shellcheck source=mod.config . "${TEMPLATE_ROOT}/mod.config" if [ -f "${TEMPLATE_ROOT}/user.config" ]; then # shellcheck source=user.config . "${TEMPLATE_ROOT}/user.config" fi require_variables "MOD_ID" "ENGINE_DIRECTORY" "PACKAGING_DISPLAY_NAME" "PACKAGING_INSTALLER_NAME" "PACKAGING_COPY_CNC_DLL" "PACKAGING_COPY_D2K_DLL" \ "PACKAGING_WINDOWS_LAUNCHER_NAME" "PACKAGING_WINDOWS_REGISTRY_KEY" "PACKAGING_WINDOWS_INSTALL_DIR_NAME" \ "PACKAGING_WINDOWS_LICENSE_FILE" "PACKAGING_FAQ_URL" "PACKAGING_WEBSITE_URL" "PACKAGING_AUTHORS" "PACKAGING_OVERWRITE_MOD_VERSION" TAG="$1" if [ $# -eq "1" ]; then OUTPUTDIR=$(python3 -c "import os; print(os.path.realpath('.'))") else OUTPUTDIR=$(python3 -c "import os; print(os.path.realpath('$2'))") fi BUILTDIR="${PACKAGING_DIR}/build" # Set the working dir to the location of this script cd "${PACKAGING_DIR}" if [ ! -f "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/Makefile" ]; then echo "Required engine files not found." echo "Run \`make\` in the mod directory to fetch and build the required files, then try again."; exit 1 fi . "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/packaging/functions.sh" . "${TEMPLATE_ROOT}/packaging/functions.sh" if [ ! -d "${OUTPUTDIR}" ]; then echo "Output directory '${OUTPUTDIR}' does not exist."; exit 1 fi if command -v curl >/dev/null 2>&1; then curl -s -L -O https://github.com/electron/rcedit/releases/download/v1.1.1/rcedit-x64.exe || exit 3 else wget -cq https://github.com/electron/rcedit/releases/download/v1.1.1/rcedit-x64.exe || exit 3 fi function build_platform() { PLATFORM="${1}" if [ "${PLATFORM}" = "x86" ]; then USE_PROGRAMFILES32="-DUSE_PROGRAMFILES32=true" else USE_PROGRAMFILES32="" fi if [ -n "${PACKAGING_DISCORD_APPID}" ]; then USE_DISCORDID="-DUSE_DISCORDID=${PACKAGING_DISCORD_APPID}" else USE_DISCORDID="" fi echo "Building core files (${PLATFORM})" install_assemblies "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${BUILTDIR}" "win-${PLATFORM}" "net6" "False" "${PACKAGING_COPY_CNC_DLL}" "${PACKAGING_COPY_D2K_DLL}" install_data "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${BUILTDIR}" for f in ${PACKAGING_COPY_ENGINE_FILES}; do mkdir -p "${BUILTDIR}/$(dirname "${f}")" cp -r "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}/${f}" "${BUILTDIR}/${f}" done echo "Building mod files (${PLATFORM})" install_mod_assemblies "${TEMPLATE_ROOT}" "${BUILTDIR}" "win-${PLATFORM}" "net6" "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" cp -Lr "${TEMPLATE_ROOT}/mods/"* "${BUILTDIR}/mods" set_engine_version "${ENGINE_VERSION}" "${BUILTDIR}" if [ "${PACKAGING_OVERWRITE_MOD_VERSION}" == "True" ]; then set_mod_version "${TAG}" "${BUILTDIR}/mods/${MOD_ID}/mod.yaml" else MOD_VERSION=$(grep 'Version:' "mods/${MOD_ID}/mod.yaml" | awk '{print $2}') echo "Mod version ${MOD_VERSION} will remain unchanged."; fi TAG_TYPE="${TAG%%-*}" TAG_VERSION="${TAG#*-}" BACKWARDS_TAG="${TAG_VERSION}-${TAG_TYPE}" # Create multi-resolution icon convert "${ARTWORK_DIR}/icon_16x16.png" "${ARTWORK_DIR}/icon_24x24.png" "${ARTWORK_DIR}/icon_32x32.png" "${ARTWORK_DIR}/icon_48x48.png" "${ARTWORK_DIR}/icon_256x256.png" "${BUILTDIR}/${MOD_ID}.ico" echo "Compiling Windows launcher (${PLATFORM})" install_windows_launcher "${TEMPLATE_ROOT}/${ENGINE_DIRECTORY}" "${BUILTDIR}" "win-${PLATFORM}" "${MOD_ID}" "${PACKAGING_WINDOWS_LAUNCHER_NAME}" "${PACKAGING_DISPLAY_NAME}" "${PACKAGING_FAQ_URL}" "${TAG}" # Use rcedit to patch the generated EXE with missing assembly/PortableExecutable information because .NET 6 ignores that when building on Linux. # Using a backwards version tag because rcedit is unable to set versions starting with a letter. wine64 rcedit-x64.exe "${BUILTDIR}/${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" --set-product-version "${BACKWARDS_TAG}" wine64 rcedit-x64.exe "${BUILTDIR}/${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" --set-version-string "ProductName" "OpenRA" wine64 rcedit-x64.exe "${BUILTDIR}/${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" --set-version-string "CompanyName" "The OpenRA team" wine64 rcedit-x64.exe "${BUILTDIR}/${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" --set-version-string "FileDescription" "${PACKAGING_WINDOWS_LAUNCHER_NAME} mod for OpenRA" wine64 rcedit-x64.exe "${BUILTDIR}/${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" --set-version-string "LegalCopyright" "Copyright (c) The OpenRA Developers and Contributors" wine64 rcedit-x64.exe "${BUILTDIR}/${PACKAGING_WINDOWS_LAUNCHER_NAME}.exe" --set-icon "${BUILTDIR}/${MOD_ID}.ico" echo "Building Windows setup.exe (${PLATFORM})" pushd "${PACKAGING_DIR}" > /dev/null makensis -V2 -DSRCDIR="${BUILTDIR}" -DTAG="${TAG}" -DMOD_ID="${MOD_ID}" -DPACKAGING_WINDOWS_INSTALL_DIR_NAME="${PACKAGING_WINDOWS_INSTALL_DIR_NAME}" -DPACKAGING_WINDOWS_LAUNCHER_NAME="${PACKAGING_WINDOWS_LAUNCHER_NAME}" -DPACKAGING_DISPLAY_NAME="${PACKAGING_DISPLAY_NAME}" -DPACKAGING_WEBSITE_URL="${PACKAGING_WEBSITE_URL}" -DPACKAGING_AUTHORS="${PACKAGING_AUTHORS}" -DPACKAGING_WINDOWS_REGISTRY_KEY="${PACKAGING_WINDOWS_REGISTRY_KEY}" -DPACKAGING_WINDOWS_LICENSE_FILE="${TEMPLATE_ROOT}/${PACKAGING_WINDOWS_LICENSE_FILE}" -DOUTFILE="${OUTPUTDIR}/${PACKAGING_INSTALLER_NAME}-${TAG}-${PLATFORM}.exe" ${USE_PROGRAMFILES32} ${USE_DISCORDID} buildpackage.nsi popd > /dev/null echo "Packaging zip archive (${PLATFORM})" pushd "${BUILTDIR}" > /dev/null zip "${OUTPUTDIR}/${PACKAGING_INSTALLER_NAME}-${TAG}-${PLATFORM}-winportable.zip" -r -9 ./* --quiet popd > /dev/null # Cleanup rm -rf "${BUILTDIR}" } build_platform "x86" build_platform "x64" ================================================ FILE: utility.cmd ================================================ @echo off setlocal EnableDelayedExpansion FOR /F "tokens=1,2 delims==" %%A IN (mod.config) DO (set %%A=%%B) if exist user.config (FOR /F "tokens=1,2 delims==" %%A IN (user.config) DO (set %%A=%%B)) set MOD_SEARCH_PATHS=%~dp0mods,./mods set ENGINE_DIR=.. if "!MOD_ID!" == "" goto badconfig if "!ENGINE_VERSION!" == "" goto badconfig if "!ENGINE_DIRECTORY!" == "" goto badconfig title OpenRA.Utility.exe %MOD_ID% set TEMPLATE_DIR=%CD% if not exist %ENGINE_DIRECTORY%\bin\OpenRA.exe goto noengine >nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine cd %ENGINE_DIRECTORY% set argC=0 for %%x in (%*) do set /A argC+=1 if %argC% == 0 goto choosemod if %argC% == 1 ( set MOD_ID=%1 goto loop ) if %argC% GEQ 2 ( @REM This option is for use by other scripts so we don't want any extra output here - before or after. call bin\OpenRA.Utility.exe %* EXIT /B 0 ) :choosemod echo ---------------------------------------- echo. call bin\OpenRA.Utility.exe echo Enter --exit to exit set /P mod="Please enter a modname: OpenRA.Utility.exe " if /I "%mod%" EQU "--exit" (exit /b) set MOD_ID=%mod% echo. :loop echo. echo ---------------------------------------- echo. echo Enter a utility command or --exit to exit. echo Press enter to view a list of valid utility commands. echo. set /P command="Please enter a command: OpenRA.Utility.exe %MOD_ID% " if /I "%command%" EQU "--exit" (cd %TEMPLATE_DIR% & exit /b) echo. echo ---------------------------------------- echo. echo Starting OpenRA.Utility.exe %MOD_ID% %command% call bin\OpenRA.Utility.exe %MOD_ID% %command% goto loop :noengine echo Required engine files not found. echo Run `make all` in the mod directory to fetch and build the required files, then try again. pause exit /b :badconfig echo Required mod.config variables are missing. echo Ensure that MOD_ID ENGINE_VERSION and ENGINE_DIRECTORY are echo defined in your mod.config (or user.config) and try again. pause exit /b ================================================ FILE: utility.sh ================================================ #!/bin/sh # Usage: # $ ./utility.sh # Launch the OpenRA.Utility with the default mod # $ Mod="" ./launch-utility.sh # Launch the OpenRA.Utility with a specific mod set -e command -v make >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK requires make."; exit 1; } if ! command -v mono >/dev/null 2>&1; then command -v dotnet >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK requires dotnet or mono."; exit 1; } fi if command -v python3 >/dev/null 2>&1; then PYTHON="python3" else command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod SDK requires python."; exit 1; } PYTHON="python" fi require_variables() { missing="" for i in "$@"; do eval check="\$$i" [ -z "${check}" ] && missing="${missing} ${i}\n" done if [ ! -z "${missing}" ]; then echo "Required mod.config variables are missing:\n${missing}Repair your mod.config (or user.config) and try again." exit 1 fi } TEMPLATE_LAUNCHER=$(${PYTHON} -c "import os; print(os.path.realpath('$0'))") TEMPLATE_ROOT=$(dirname "${TEMPLATE_LAUNCHER}") MOD_SEARCH_PATHS="${TEMPLATE_ROOT}/mods,./mods" # shellcheck source=mod.config . "${TEMPLATE_ROOT}/mod.config" if [ -f "${TEMPLATE_ROOT}/user.config" ]; then # shellcheck source=user.config . "${TEMPLATE_ROOT}/user.config" fi require_variables "MOD_ID" "ENGINE_VERSION" "ENGINE_DIRECTORY" LAUNCH_MOD="${Mod:-"${MOD_ID}"}" cd "${TEMPLATE_ROOT}" if [ ! -f "${ENGINE_DIRECTORY}/bin/OpenRA.Utility.dll" ] || [ "$(cat "${ENGINE_DIRECTORY}/VERSION")" != "${ENGINE_VERSION}" ]; then echo "Required engine files not found." echo "Run \`make\` in the mod directory to fetch and build the required files, then try again."; exit 1 fi if command -v mono >/dev/null 2>&1 && [ "$(grep -c .NETCoreApp,Version= ${ENGINE_DIRECTORY}/bin/OpenRA.Utility.dll)" = "0" ]; then RUNTIME_LAUNCHER="mono --debug" else RUNTIME_LAUNCHER="dotnet" fi cd "${ENGINE_DIRECTORY}" MOD_SEARCH_PATHS="${MOD_SEARCH_PATHS}" ENGINE_DIR=".." ${RUNTIME_LAUNCHER} bin/OpenRA.Utility.dll "${LAUNCH_MOD}" "$@"