Skip to content

Commit

Permalink
Update 2.1.4
Browse files Browse the repository at this point in the history
At last, a data patch that fixes drone malfunctions! You can now make sure that your drone spawners are safe to use...
> Note that next version (2.2) will remove a lot of long-deprecated items and objects. Load you world and check inventories with those to update them to avoid them turning into Perfectly Generic Items. Deprecation Station will also get deprecated. It's no longer of much use, and the Perfectly Generic Item section will be moved to the Upgrade Station.

Main:

- many big bugfixes, lore additions and wiki improvements;
- properly functional hazard objects and decorations;
- pretty big mod cleanup;

Alta:

- fixed scout/EDS drone spawners:
  - increased amount of drones in the Alta Drone Station from 3 to 10;
  - fixed spam in EDS Spawner;
  - fixed EDS Drones exploding on spawn in low threat environments;
- fixed defeat logic on some drones (like Frigate Drone);
- seemingly fixed errors with "liquidLineCollision" on all droids & drones (?);
- fixed Alta Lab Barrier - now it:
  - only damages when closed;
  - has according particles and looping electric sound when closed;
  - shows up in the Hazards tab in Alta Constructor;
- fixed break sounds on EDS Haulters;
- fixed Staris Soup food item;
- fixed items no longer being upgradable at the Weapon Upgrade Anvil when having certain items in your inventory;
- fixed some items not being upgradable at the Weapon Upgrade Anvil due to incorrect tags (forgot the `upgradeableWeapon` tag): Bishyn Spear, Niverisk, Protospear;
- fixed tooltips on Alta City Sapling, Alta Lab Sapling and Alta Ship Sapling;

Wiki:

- added trivia sections;
- added extended descriptions to rifles, drones, droids, hazard objects, plants and some other things;
- added screenshots for Defensive Drone R300, Ionic Drone and Lava Drone;
- added species support;
- made Alta page semi-automated, added in-game info;
- fixed extended descriptions on monster spawner items;
- minor adjustments and formatting update;

Dev:

- added comments to some lua scripts;
- moved dev landscape screenshots and previews and their psd files for versioning and to keep them in one place;
- moved all dev/meta stuff like mod support scripts, palettes, mod descriptions and images to a `/.meta` folder to keep it clean;
- the `/.meta` folder is excluded from actual releases and will only be present in the GitHub repo, as well as `.gitignore`, `changelog.md` and `README.md`;
- reworked mod support scripts and added comments to make them cleaner and easier to understand;
- optimized build scripts and made them cleaner;
- made deprecation builders slightly more seamless;

Other:

- added particles to objects: Poison Crystals, Yaara Heart;
- fixed upgraded item icons;
- fixed upgraded calin sword;
- fixed collision on hazard objects: Alternia Crystal, Poison Crystals, Yaara Heart, Yaara Roots, Warped Roots, Alta Lab Barrier, EDS Haulters;
- fixed particles on hazard objects: Alternia Crystal, Yaara Heart, Yaara Roots, Alta Lab Barrier, EDS Haulters;
- fixed levels on hazard objects: Alternia Crystal, Yaara Heart, Yaara Roots, Warped Roots;
- fixed level inventory tooltips on objects;
- moved text lines from item builder scripts into a `/items/buildscripts/ct_texts.config` file to make them easier to translate/change;
- tried to fix emote issues for kaiteras (second alta gender), but wasn't successful;
- minor bug fixes.
  • Loading branch information
Ceterai committed Jan 9, 2024
1 parent 845e5d9 commit 1356eaa
Show file tree
Hide file tree
Showing 217 changed files with 2,428 additions and 849 deletions.
5 changes: 5 additions & 0 deletions ct_meta/alta_config.json → .meta/alta.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
// This config is used by the mod support scripts in ./scripts to generate patches for different mods.
{
"lore" : [
"An artifical species of humanoids. The main focus of their decentralized society is research and exploration ",
"with purpose of technological advancement, as well as entertainment and quality of life improvement."
],
"diet" : "herbivore",
"stats" : [
{ "stat" : "maxHealth", "effectiveMultiplier" : 0.80 },
Expand Down
File renamed without changes.
19 changes: 9 additions & 10 deletions description_sb_forum.md → .meta/description_sb_forum.bbcode
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,25 @@ Also, check out a [IMG]https://raw.githubusercontent.com/Ceterai/Enternia/main/c
[*][URL='https://community.playstarbound.com/resources/erissss-more-planet-info.4966/']More Planet Info[/URL] (proper support for all effects, weather and biomes of this mod);
[*][URL='https://community.playstarbound.com/resources/truespace.3785/']True Space[/URL] (planets added by this mod are able to spawn near True Space stars. [IMG]https://raw.githubusercontent.com/Ceterai/Enternia/main/interface/bookmarks/icons/ct_alterash_planet.png[/IMG] [URL='https://github.com/Ceterai/Enternia/wiki/Alterash']Alterash[/URL] can spawn as a mild/cool planet or satellite, [IMG]https://raw.githubusercontent.com/Ceterai/Enternia/main/interface/bookmarks/icons/ct_alterash_prime_planet.png[/IMG] [URL='https://github.com/Ceterai/Enternia/wiki/Alterash-Prime']Alterash Prime[/URL] as a cool/cold planet or satellite);
[*][URL='https://steamcommunity.com/sharedfiles/filedetails/?id=2622273194']Race Traits[/URL] (check mod screenshots for stats);
[*][URL='https://steamcommunity.com/sharedfiles/filedetails/?id=763259329']Frackin' Races[/URL]/[URL='https://steamcommunity.com/sharedfiles/filedetails/?id=729480149']Frackin' Universe[/URL] (PARTIAL: no FU BYOS support. If you need it, you can get it here: [URL='https://steamcommunity.com/sharedfiles/filedetails/?id=3048977458']Alta FU Patch+[/URL]).
[*][URL='https://community.playstarbound.com/resources/frackinraces.3717/']Frackin' Races[/URL]/[URL='https://community.playstarbound.com/resources/frackinuniverse.2920/']Frackin' Universe[/URL] (PARTIAL: no FU BYOS support. If you need it, you can get it here: [URL='https://steamcommunity.com/sharedfiles/filedetails/?id=3048977458']Alta FU Patch+[/URL]).
[/LIST]

[SIZE=6]Content Rundown[/SIZE]

[SPOILER="Some Informative Images"][IMG]https://raw.githubusercontent.com/wiki/Ceterai/Enternia/images/tooltip1.png[/IMG]
[IMG]https://raw.githubusercontent.com/wiki/Ceterai/Enternia/images/tooltip2.png[/IMG]
[IMG]https://raw.githubusercontent.com/wiki/Ceterai/Enternia/images/tooltip3.png[/IMG]
[IMG]https://raw.githubusercontent.com/wiki/Ceterai/Enternia/images/tooltip4.png[/IMG]
[SPOILER="Some Informative Images"][ATTACH=full]223392[/ATTACH]
[ATTACH=full]223393[/ATTACH]
[ATTACH=full]223394[/ATTACH]
[ATTACH=full]223395[/ATTACH]
[/SPOILER]
More information on new weapon features like press&hold, firemodes, attachments and upgrading: [URL='https://github.com/Ceterai/Enternia/wiki/Weapons']My Enternia Wiki: Weapons[/URL]

[SIZE=6]Enhanced Tooltips[/SIZE]

As mentioned in the content rundown, many different items in this mod have improved, informative tooltips. Below are some examples of that:

[SPOILER="Tooltip Examples"][IMG]https://raw.githubusercontent.com/wiki/Ceterai/Enternia/images/scrn_tooltips1.png[/IMG]
[IMG]https://raw.githubusercontent.com/wiki/Ceterai/Enternia/images/scrn_tooltips2.png[/IMG]
[SPOILER="Tooltip Examples"][ATTACH=full]223396[/ATTACH]
[ATTACH=full]223397[/ATTACH]
[/SPOILER]

[SIZE=6]Screenshots[/SIZE]

You can view screenshots on the [URL='https://steamcommunity.com/sharedfiles/filedetails/?id=2006558650']Steam page of the mod[/URL].
Expand All @@ -80,7 +79,7 @@ The full list of changes can be found in the changelog file on the GitHub page o

I made this little mod mainly for myself, but decided to share with everybody.
It was originally only on Steam Workshop and GitHub, but since I've decided to release a 2.0 version, I thought it would be a good idea to finally share it here aswell.
This mod on [COLOR=rgb(0, 128, 255)]Steam[/COLOR]: https://steamcommunity.com/sharedfiles/filedetails/?id=2006558650
This mod on [COLOR=rgb(0, 128, 255)]GitHub[/COLOR]: https://github.com/Ceterai/Enternia
This mod on [COLOR=rgb(0, 128, 255)]Steam[/COLOR]: [URL]https://steamcommunity.com/sharedfiles/filedetails/?id=2006558650[/URL]
This mod on [COLOR=rgb(0, 128, 255)]GitHub[/COLOR]: [URL]https://github.com/Ceterai/Enternia[/URL]

[CENTER][IMG]https://github.com/Ceterai/Enternia/wiki/images/alta_sign4.png[/IMG][/CENTER]
8 changes: 4 additions & 4 deletions description_steam.md → .meta/description_steam.bbcode
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ This mod [b]doesn't[/b] require any other mods to work and should be FU-compatib
[*][url=https://steamcommunity.com/sharedfiles/filedetails/?id=763259329]Frackin' Races[/url]/[url=https://steamcommunity.com/sharedfiles/filedetails/?id=729480149]Frackin' Universe[/url] (PARTIAL: no FU BYOS support. If you need it, you can get it here: [url=https://steamcommunity.com/sharedfiles/filedetails/?id=3048977458]Alta FU Patch+[/url]).[/list]
[h2]Mod Content Rundown[/h2]
(Scroll down for information for modders)
[img]https://raw.githubusercontent.com/Ceterai/Enternia/main/images/tooltip1.png[/img]
[img]https://raw.githubusercontent.com/Ceterai/Enternia/main/images/tooltip2.png[/img]
[img]https://raw.githubusercontent.com/Ceterai/Enternia/main/images/tooltip3.png[/img]
[img]https://raw.githubusercontent.com/Ceterai/Enternia/main/images/tooltip4.png[/img]
[img]https://raw.githubusercontent.com/Ceterai/Enternia/main/.meta/images/tooltip1.png[/img]
[img]https://raw.githubusercontent.com/Ceterai/Enternia/main/.meta/images/tooltip2.png[/img]
[img]https://raw.githubusercontent.com/Ceterai/Enternia/main/.meta/images/tooltip3.png[/img]
[img]https://raw.githubusercontent.com/Ceterai/Enternia/main/.meta/images/tooltip4.png[/img]
More information on new weapon features like press&hold, firemodes, attachments and upgrading: [url=https://github.com/Ceterai/Enternia/wiki/Weapons]My Enternia Wiki: Weapons[/url]
[h2]Information for modders[/h2][list]
[*]As said before, the mod shouldn't conflict with anything because all ids in it start with a 'ct_' prefix;
Expand Down
File renamed without changes
File renamed without changes
Binary file added .meta/images/banners/Asirai.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/banners/Asirai.psd
Binary file not shown.
Binary file added .meta/images/biomes/template.psd
Binary file not shown.
Binary file added .meta/images/biomes/v1.3/caves_yaara1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.3/core_barrens1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.3/core_haven1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.3/core_haven2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.3/core_starfields1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.3/menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.3/surface_gardens1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.3/underworld_forests1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.3/underworld_forests2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.3/underworld_forests3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.3/underworld_forests4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.3/underworld_forests5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.3/underworld_spikes1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.3/underworld_spikes2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.3/underworld_spikes3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.3/underworld_warped1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.3/underworld_warped2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.3/underworld_warped3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.4/caves_crystal1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.4/caves_yaara1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .meta/images/biomes/v1.4/caves_yaara2.png
Binary file added .meta/images/biomes/v1.4/caves_yaara3.png
Binary file added .meta/images/biomes/v1.4/core_barrens2.png
Binary file added .meta/images/biomes/v1.4/core_normal1.png
Binary file added .meta/images/biomes/v1.4/space_asteroids1.png
Binary file added .meta/images/biomes/v1.4/surface_gardens2.png
Binary file added .meta/images/biomes/v1.4/surface_labs1.png
Binary file added .meta/images/biomes/v1.4/surface_labs2.png
Binary file added .meta/images/biomes/v1.4/underworld_warped4.png
Binary file added .meta/images/logos/alta_sign2.png
Binary file added .meta/images/logos/alta_sign3.png
Binary file added .meta/images/logos/alta_sign4.png
Binary file added .meta/images/logos/logo_v2.png
Binary file added .meta/images/logos/logo_v2.psd
Diff not rendered.
Binary file added .meta/images/logos/logo_v2_96.png
File renamed without changes
Binary file added .meta/images/panels/scrn_tooltips.psd
Diff not rendered.
File renamed without changes
Binary file added .meta/images/panels/scrn_tooltips2.psd
Diff not rendered.
Binary file added .meta/images/panels/scrn_tooltips3.png
Binary file added .meta/images/panels/scrn_tooltips3.psd
Diff not rendered.
Binary file added .meta/images/panels/tooltip0.png
Binary file added .meta/images/panels/tooltip02.png
File renamed without changes
Binary file added .meta/images/panels/tooltip1.psd
Diff not rendered.
File renamed without changes
Binary file added .meta/images/panels/tooltip2.psd
Diff not rendered.
File renamed without changes
Binary file added .meta/images/panels/tooltip3.psd
Diff not rendered.
File renamed without changes
Binary file added .meta/images/panels/tooltip4.psd
Diff not rendered.
Binary file added .meta/images/scrn_tooltips1.png
Binary file added .meta/images/scrn_tooltips2.png
Binary file added .meta/images/tooltip1.png
Binary file added .meta/images/tooltip2.png
Binary file added .meta/images/tooltip3.png
Binary file added .meta/images/tooltip4.png
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
93 changes: 93 additions & 0 deletions .meta/scripts/FU_support_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
"""
This script automatically creates support for the Frakin' Universe mod.
"""

import RT_support_script


PATH = f'/species/{RT_support_script.RACE}.raceeffect'
PATH_WINDOW = '/interface/scripted/statWindow/statWindow.config.patch'
PATH_SPECIES = f'/species/{RT_support_script.RACE}.species'
AFFECTED_FILES = [PATH, PATH_WINDOW, PATH_SPECIES]
MOD = 'Frakin Universe/Frakin Races'
HINT = RT_support_script.base.HINT.format(mod=MOD)
EXCLUDED = [
'foodDelta',
]
TEMPLATE = '''{hint}
{{
"stats": [
{stats}
],
"diet" : "{diet}",
"controlModifiers": {{
{controls}
}}
}}
'''

def run():
RT_support_script.create_patch(EXCLUDED, TEMPLATE, HINT, RT_support_script.RACE, PATH, ' ')
with open(RT_support_script.base.ROOT + PATH_WINDOW, 'w') as f:
f.write(f'''{HINT}
[
{{
"op": "add",
"path": "/races/-",
"value": "{RT_support_script.RACE}"
}}
]
''')
TEXT = '''
If you have ^orange;Frakin' Universe^reset;/^orange;Frakin' Races^reset;/^orange;Race Traits^reset; installed:
^yellow;Attributes^reset;
^cyan;Max Health^reset;: ^red;-20%^reset;
^cyan;Max Energy^reset;: ^green;+10%^reset;
^cyan;Energy Regen^reset;: ^green;+5%^reset;
^yellow;Resistances^reset;
^cyan;Fire Resistance^reset;: ^red;-10%^reset;
^cyan;Electric Resistance^reset;: ^green;+20%^reset;
^cyan;Poison Resistance^reset;: ^green;+5%^reset;
^cyan;Ice Resistance^reset;: ^green;+5%^reset;
^cyan;Cosmic Resistance^reset;: ^green;+10%^reset; ^gray;(FU/FR only)^reset;
^cyan;Radioactive Resistance^reset;: ^red;-25%^reset; ^gray;(FU/FR only)^reset;
^cyan;Shadow Resistance^reset;: ^red;-15%^reset; ^gray;(FU/FR only)^reset;
^yellow;Immunities^reset;
^#7733aa;Electrified^reset;
^yellow;Extra Stats^reset;
^cyan;Hunger Slowness ^gray;(Race Traits)^reset;/^cyan;Max Food ^gray;(FU/FR)^reset;: ^green;+10%^reset;
^cyan;Jump Height^reset;: ^green;+5%^reset;
^cyan;Charisma^reset;: ^green;+15%^reset; ^gray;(FU/FR only)^reset;
^cyan;Mental Protection^reset;: ^green;+15%^reset; ^gray;(FU/FR only)^reset;
^orange;Diet^reset;: ^cyan;Herbivore^reset; ^gray;(FU/FR only)^reset;
^orange;Environment^reset;: None ^gray;(FU/FR only)^reset;
^orange;Weapons^reset;: None ^gray;(FU/FR only)^reset;'''
desc = str(''.join(RT_support_script.CONFIG.get('lore')) + TEXT).replace('\n\n', '\\n\\n').replace('\n', ' \\n')
hint = ' ' + RT_support_script.base.HINT.format(mod='species traits mods') + '\n'
has_hint = False
has_desc = False
lore_line = 0
lines = []
with open(RT_support_script.base.ROOT + PATH_SPECIES, 'r') as f:
lines = f.readlines()
for i in range(len(lines)):
if '"subTitle"' in lines[i]:
lore_line = i
if '//' in lines[i+1]:
has_hint = True
if '"description"' in lines[i+2] or '"description"' in lines[i+1]:
has_desc = True
break
if lore_line > 0:
if has_hint:
lines[lore_line + 1] = hint
else:
lines.insert(lore_line + 1, hint)
if has_desc:
lines[lore_line + 2] = f' "description" : "{desc}"\n'
else:
lines.insert(lore_line + 2, f' "description" : "{desc}"\n')
with open(RT_support_script.base.ROOT + PATH_SPECIES, 'w') as f:
f.writelines(lines)
29 changes: 29 additions & 0 deletions .meta/scripts/IFD_support_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
It's a bit stupid that you have to specify effect's path AND name
for the Improved Food Descriptions mod, since the path is used to
literally load the effect which already has the name in it, so I
did this to create patches automatically for this mod (since it
has a lot of effects)."""

import pyjson5
import base


PATH = '/IFD_statuseffects.config.patch'
AFFECTED_FILES = [PATH]
MOD = 'Improved Food Descriptions'
HINT = base.HINT.format(mod=MOD)

def is_obj_file(name: str) -> bool:
return (name[-13:] == '.statuseffect')

def run():
paths = base.get_files_flat(is_obj_file)
objs = {path: base.get_obj(path) for path in paths}
patches = [(objs[path].get('name'), f"^green;+ {objs[path].get('label')}^reset;", path.replace(base.ROOT, '').replace('\\', '/')) for path in objs]
json_patches = [{'op': 'add', 'path': f'/effectNames/{patch[0]}', 'value': {'customLabels': [patch[1]], 'path': patch[2]}} for patch in patches]
json_patch_lines = '[\n ' + ',\n '.join([pyjson5.dumps(json_patch) for json_patch in json_patches]) + '\n]\n'
json_patch_lines = HINT + '\n' + json_patch_lines
# print(json_patch_lines)
with open(base.ROOT + PATH, 'w') as patch_file:
patch_file.writelines(json_patch_lines)
59 changes: 59 additions & 0 deletions .meta/scripts/MPI_support_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""
Run this script to update the cockpit patch file to include
biome and planet info for the More Planet Info addon."""

import os
import pyjson5
import base


PATH_INPUT = '/interface/cockpit/cockpit.config.patch.init.json'
PATH = '/interface/cockpit/cockpit.config.patch'
AFFECTED_FILES = [PATH, PATH_INPUT]
MOD = 'More Planet Info'
HINT = base.HINT.format(mod=MOD)

def is_effect(name: str) -> bool:
return (name[-13:] == '.statuseffect')

def is_weather(name: str) -> bool:
return (name[-8:] == '.weather')

def is_biome(name: str) -> bool:
return (name[-6:] == '.biome')

def run():
# Initial fill
json_patches: list[list[dict]] = [
pyjson5.load(open(base.ROOT + '/interface/cockpit/cockpit.config.patch.init.json')),
'\n ' + HINT,
[ { "op": "test", "path": "/displayEnvironmentStatusEffects" }, ]
]

# Effects
paths = base.get_files_flat(is_effect)
objs = {path: base.get_obj(path) for path in paths}
for path in objs:
icon = objs[path].get('icon', 'icon.png')
objs[path]['icon'] = ((os.path.dirname(path) + '/' + icon) if icon[0] != '/' else icon).replace(base.ROOT, '').replace('\\', '/')
patches = [ ( objs[path].get('name'), f"{objs[path].get('label')}", objs[path].get('icon'), ) for path in objs ]
json_patches[-1].extend([{'op': 'add', 'path': f'/displayEnvironmentStatusEffects/{patch[0]}', 'value': {'displayName': patch[1], 'icon': patch[2]}} for patch in patches])

# Weather
paths = base.get_files_flat(is_weather)
objs = {path: base.get_obj(path) for path in paths}
patches = [ ( objs[path].get('name'), f"{objs[path].get('threat', 0.1)}", ) for path in objs ]
json_patches[-1].extend([{'op': 'add', 'path': f'/weatherThreatValues/{patch[0]}', 'value': patch[1]} for patch in patches])

# Biomes
paths = base.get_files_flat(is_biome)
objs = {path: base.get_obj(path) for path in paths}
patches = [ ( objs[path].get('name'), f"{objs[path].get('friendlyName')}", ) for path in objs ]
json_patches[-1].extend([{'op': 'add', 'path': f'/namesList/{patch[0]}', 'value': {'word': patch[0], 'friendlyWord': patch[1]}} for patch in patches])

lines = [('\n [\n ' + ',\n '.join([pyjson5.dumps(json_patch) for json_patch in json_batch]) + '\n ]' + (',' if json_batch != json_patches[-1] else '')) if type(json_batch) == list else json_batch for json_batch in json_patches]

json_patch_lines = '[' + ''.join(lines) + '\n]\n'
# print(json_patch_lines)
with open(base.ROOT + '/interface/cockpit/cockpit.config.patch', 'w') as patch_file:
patch_file.writelines(json_patch_lines)
23 changes: 13 additions & 10 deletions ct_meta/RT_support_script.py → .meta/scripts/RT_support_script.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
"""
This script automatically creates support for the Racial Traits mod.
This script automatically creates support for the Race Traits mod.
"""

import os
import pyjson5
import pathlib
import base


ROOT = os.path.dirname(os.path.dirname(__file__))
PATH = '/stats/effects/om_customstats/om_racetraits/om_racetraits.statuseffect.patch'
AFFECTED_FILES = [PATH]
RACE = 'alta'
MOD = 'Racial Traits'
HINT = base.HINT.format(mod=MOD)
EXCLUDED = [
'maxFood',
'fuCharisma',
Expand All @@ -19,8 +21,8 @@
'radioactiveResistance',
'shadowResistance',
]
CONFIG = dict(pyjson5.load(open(os.path.dirname(__file__) + '/' + RACE + '_config.json')))
TEMPLATE = '''// Mod Support for {mod} (see mod description)
CONFIG = dict(pyjson5.load(open(os.path.dirname(os.path.dirname(__file__)) + '/' + RACE + '.config')))
TEMPLATE = '''{hint}
[
{{
"op": "add", "path": "/effectConfig/0/{species}",
Expand All @@ -39,15 +41,16 @@
]
'''

def create_patch(excluded_stats: list, template: str, mod: str, species: str, path: str, pref: str=' '):
def create_patch(excluded_stats: list, template: str, hint: str, species: str, path: str, pref: str=' '):
stats = ',\n'.join([pref + pyjson5.dumps(stat) for stat in CONFIG['stats'] if stat['stat'] not in excluded_stats])
benefits = ',\n'.join([pref + pyjson5.dumps(stat) for stat in CONFIG['benefits']])
controls = ',\n'.join([pref + '"' + stat + '":' + pyjson5.dumps(CONFIG['controlModifiers'][stat]) for stat in CONFIG['controlModifiers']])
result = template.format(mod=mod, species=species, stats=stats, benefits=benefits, controls=controls, diet=CONFIG.get('diet'))
print(result)
result = template.format(hint=hint, species=species, stats=stats, benefits=benefits, controls=controls, diet=CONFIG.get('diet'))
# print(result)
# Saving...
pathlib.Path(os.path.dirname(ROOT + path)).mkdir(parents=True, exist_ok=True)
with open(ROOT + path, 'w') as f:
pathlib.Path(os.path.dirname(base.ROOT + path)).mkdir(parents=True, exist_ok=True)
with open(base.ROOT + path, 'w') as f:
f.write(result)

create_patch(EXCLUDED, TEMPLATE, MOD, RACE, PATH)
def run():
create_patch(EXCLUDED, TEMPLATE, HINT, RACE, PATH)
31 changes: 31 additions & 0 deletions .meta/scripts/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os
import pyjson5
import re


ROOT = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
HINT = '// Mod Support for {mod} (see mod description)'

def get_paths_flat(roots: list[str] = ['']) -> list[str]:
paths = []
for path in roots:
paths.extend([r[0] for r in list(os.walk(os.path.join(ROOT, path)))])
return paths

def get_obj(file_path) -> dict[str, str]:
with open(file_path, encoding="utf-8") as fp:
lines = ''.join(fp.readlines())
lines = str(re.sub(r'((?<!:)\/\/.*)\n', r'\n', lines))
lines = lines.replace('\n', ' ')
return pyjson5.loads(lines)

def get_files(path: str, filter_f) -> list[str]:
file_names = os.listdir(path)
file_paths = [os.path.join(path, file_name) for file_name in file_names if filter_f(file_name)]
return file_paths

def get_files_flat(filter_f, paths: list[str] = None) -> list[str]:
obj_list = []
for path in paths or get_paths_flat():
obj_list.extend(get_files(path, filter_f))
return obj_list
23 changes: 23 additions & 0 deletions .meta/scripts/update_all.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""Run this script to update all mod support related files."""

import RT_support_script as RT, FU_support_script as FU, IFD_support_script as IFD, MPI_support_script as MPI, json

METADATA_PATH = '/_metadata'

with open(RT.base.ROOT + '/.meta/description.md', 'r') as f:
mod_info = RT.base.get_obj(RT.base.ROOT + METADATA_PATH)
mod_desc = ''.join(f.readlines())
mod_info['description'] = mod_desc
json.dump(mod_info, open(RT.base.ROOT + METADATA_PATH, 'w'), indent=2)

RT.run()
FU.run()
IFD.run()
MPI.run()
print('Affected files:\n' + '\n'.join(['- ' + path for path in (
RT.AFFECTED_FILES +
FU.AFFECTED_FILES +
IFD.AFFECTED_FILES +
MPI.AFFECTED_FILES +
[METADATA_PATH]
)]))
Loading

0 comments on commit 1356eaa

Please sign in to comment.