Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix cfg syntax errors #2612

Merged
merged 9 commits into from
Mar 29, 2022
Merged

Fix cfg syntax errors #2612

merged 9 commits into from
Mar 29, 2022

Conversation

HebaruSan
Copy link
Contributor

Hi, KSP-RO team!

I'm using RealismOverhaul to test some cfg parser code for KSP-CKAN/CKAN#3525, and I found a few minor syntax errors.

This pull request fixes them.

Cheers!

@DRVeyl
Copy link
Contributor

DRVeyl commented Mar 28, 2022

That's pretty amazing.
I'll look over them in the next day or so. Thanks!

@NathanKell
Copy link
Member

Echoing DRVeyl, this is awesome, thank you so much!! :)

@NathanKell
Copy link
Member

Oh maaaan some of these are real howlers. Again, thanks so much for catching them! (And we probably should add your checker to our actions so we can check PRs in future!!)

I found a few things that needed to be changed (and a few others that I had to tag @DRVeyl and @al2me6 on since they will know where I don't!) but everything else LGTM.

@@ -65,8 +65,7 @@

@MODULE[ModuleProbeControlPoint] {}
@MODULE[ModuleCommand] {}
@MODULE[ModuleDataTransmitter] {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These rows all look weird to begin with, not sure if this is the intended behaviour

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what this is trying/intending to do, either. Should those be %MODULE to guarantee they exist? Or are they just NOPs to be deleted?
Why are we NOPing a ModuleCommand and then patching an MDT to be a ModuleCommand?
Are there supposed to be 2 ModuleFuelTanks on here? Or just 1? (This has a weird pattern of creating a node and then immediately patching it).
@pap1723 ?

Copy link
Contributor Author

@HebaruSan HebaruSan Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the intention was to delete ModuleCommand (rather than edit) and then create a new one (i.e., add MODULE before the {)? That would sort of explain why it's setting name.

I'll push that in a moment. Even if it's not exactly right, it's surely better than my initial guess...

Copy link
Contributor Author

@HebaruSan HebaruSan Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semi-confirmed, that's close to what the 225m part does (without the deletion):

@MODULE[ModuleProbeControlPoint] {}
@MODULE[ModuleCommand] {}
@MODULE[ModuleDataTransmitter] {}
MODULE
{
name = ModuleCommand
minimumCrew = 1
}

The empty edits still don't make sense, but they aren't hurting anything either.

Copy link
Contributor

@DRVeyl DRVeyl Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. TODO for @DRVeyl : Fix the SSPX configs with a more appropriate pattern after merging this, they're making this mistake everywhere in addition to only a couple of the files having invalid syntax.

@HebaruSan
Copy link
Contributor Author

HebaruSan commented Mar 28, 2022

And we probably should add your checker to our actions so we can check PRs in future!!

I like that idea a lot, but unfortunately the parser is not quite ready for prime time yet. The error messages that it produces are still very poor quality; it only tells you the first line of the top level config node containing the problem, and then a human has to inspect that node and all of its values and child nodes, potentially dozens of lines, to find the problem by eye. I need to do some more research into monadic parsers to figure out how to make it pinpoint problems more precisely, but if I do, I'll look into making it available for a GitHub Action (the current code is buried deep within some CKAN routines that aren't easily applied to other purposes).

... Improving the error messages turned out to be trivial, I just needed to call .AbortIfEntered() once in the right spot, and now I have line-specific errors. 🎉

@HebaruSan

This comment was marked as resolved.

@DRVeyl
Copy link
Contributor

DRVeyl commented Mar 28, 2022

That is the "special" operator. It operates on a non-local node, and I don't think you will find it in the MM documentation, unless @al2me6 has written about it in his draft updated MM guide. It also has some restrictive rules in terms of what it can do.

https://github.com/sarbian/ModuleManager/blob/master/ModuleManager/CommandParser.cs#L39-L45 Note these two operators. I'm not sure if you also handle paste (#) correctly based on the tool triggering on: [GameData/RealismOverhaul/RO_SuggestedMods/RO_B9.cfg(https://github.com//pull/2612/files#diff-a7754b76bfd0b9946514501f6961f0ea271edd2073d8ab27cdad73fbf65e49ae)

I think #@AJE_TPR_CURVE_DEFAULTS/FixedCone/TPRCurve {} is correct legal syntax, though I don't use that much.

Addendum: Unfortunately, I don't see them in the MM unit tests, either. :/

@al2me6
Copy link
Member

al2me6 commented Mar 28, 2022

@HebaruSan AFAIK this is the only official reference for the feature that exists: https://forum.kerbalspaceprogram.com/index.php?/topic/50533-18x-112x-module-manager-421-august-1st-2021-locked-inside-edition/page/136/#comment-2413546

@HebaruSan

This comment was marked as resolved.

@al2me6
Copy link
Member

al2me6 commented Mar 28, 2022

Huh. Any idea how MM tells the difference between this use of # and the common use of it in translation tokens?

Node name vs key name.

#@AJE_TPR_CURVE_DEFAULTS/FixedCone/TPRCurve {} is valid
@DRVeyl
Copy link
Contributor

DRVeyl commented Mar 28, 2022

Two ModuleCommand is wrong, functionally. But fixing that isn't really in scope for this PR. You found something where we were doing something syntactically broken that happened to be right next to where we were doing something logically dumb. I'll go through the SSPX patches [that mistake is part of a pattern there] separately after merging this PR. So I'm not worried about the state of the SSPX patches in this PR.

Copy link
Contributor

@DRVeyl DRVeyl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, looked over everything. Modulo identifying a new issue regarding SSPX config pattern, I think everything in here has been addressed.

@DRVeyl DRVeyl merged commit 4f3c030 into KSP-RO:master Mar 29, 2022
@HebaruSan HebaruSan deleted the fix/cfg-syntax branch March 29, 2022 16:37
@DRVeyl DRVeyl mentioned this pull request Mar 29, 2022
Capkirk123 added a commit to Capkirk123/RealismOverhaul that referenced this pull request Apr 2, 2022
* Add RO Support for ROTanks KatnissTanks

* Add support for Photon Corp RSRM and RSRMV. Waterfall configs only

* Fix Photon Corp WaterFall glow clipping

* ROWaterfall: fix auto-config for derived MEC

* Remove support for ProcFairings pre-v6

Fix PF v6 mass calculations by using the provided decouplerMassMult/decouplerMassBase tooling.  Previously, disabling the decoupler was not giving a mass savings.

* Fix R-4D-11 TF config (KSP-RO#2582)

was using wrong config name in selector

* Add PhotonCorp RealPlume configs for RSRM and RSRMV

* Increase J57-P-8 temp limit (KSP-RO#2589)

Increase the temperature limit of the J57-P-8 to get it a bit closer to it's advertised performance, and more competitive with RD-9B

Also edit J48 description to be less confusing

* Engine config for Filament Wound Casing RSRM (KSP-RO#2587)

* Add source example to Engine Config Template

* Add RSRM FWC-SRM config

* Link PhotonCorp RSRM color to engine config

* Add tagging system for ModuleCargoPart (KSP-RO#2591)

Every part that doesn't have ROCargoConfig tag will be stripped of it's ModuleCargoPart PM.

* Basic configs for KSP 1.11+ kerbals (KSP-RO#2537)

* Revert "Remove kerbalCrewMass (KSP-RO#2290)"

* No, KSP, we don't want you to adjust the mass of our crewed parts

* Configure mass for KSP 1.11+ jetpack and chute

* Make sure only KSP 1.11+ installs get crew mass

* Change EVA fuel to Nitrogen and increase Kerbal Carry Capacity

* Also change EVA fuel resource for 1.10

Co-authored-by: siimav

* Add support for RMM (KSP-RO#2585)

Add engine and Waterfall configs for RMM by EStreetrockets.

* Add P&W Model 304 (KSP-RO#2581)

* Update version to v14.10.0.0

* Added configs for two additional sizes of RCS Blocks

* Configured RCS Blocks with Variants that Squad added in 1.11

* Adjust tank masses when LH2 is loaded (KSP-RO#2578)

Decrease the tankage mass of all tanks except balloon when LH2 is loaded. This is to simulate the fact that LH2 is extremely light, and requires much less structural mass to support.

The 80% mass reduction seems to accurately simulate CBC and SII/SIV, without making smaller stages like DCSS significantly underweight.

* Add restart timer to RD-119, S5.92, update descriptions (KSP-RO#2592)

* Add restart timer to RD-119

Add restart timer to RD-119 to prevent it from staying in pumped idle forever. Due to lack of data, we're going with 90 minutes.

* Add more descriptions

Add restart windows to descriptions of applicable engines, and add restart window to the S5.92 and S5.98M

* Add RO configs for New Tantares Mir station parts revamp. (KSP-RO#2515)

* Change to 1.12's new stock RCS blocks (KSP-RO#2594)

* MLI Settings Use RF+PartUpgrades (KSP-RO#2595)

Remove MLI definitions from tanks, and instead use part upgrades to upgrade all tanks at once.  RF implements default PartUpgrades.  RP-0 PR will address separately.

* Add RCSBlock so older craft still load (KSP-RO#2576)

* Revert "Change to 1.12's new stock RCS blocks (KSP-RO#2594)"

This reverts commit b59d721.

* Fix broken tech transfer F-1->F-1A (can't have spaces)

* Add SolarConfig support for multiple identical solar modules (KSP-RO#2599)

* Rename Integral to Isogrid in part title / description but leave RF tank type Integral so as to not break craft

* ROWaterfall: colorful plumes
April Fools, makes all Waterfall plumes rainbow-colored on April 1st.
To disable (effective on game restart), create an empty file named
`GameData/RealismOverhaul/Plugins/PluginData/DisableRainbowPloom`.

* ROWaterfall: support useRelativeScaling with hybrid plumes

* ROWaterfall: import templates from @Katniss218

* Add RD-0120T, fix RD-0120, 701, 704 (KSP-RO#2549)

* Add Rocketdyne G-1 (KSP-RO#2598)

Add config for Rocketdyne G-1 (NOMAD).

* Add more resource boiling points, move resource prices to RP-1 (KSP-RO#2600)

* Near Future Propulsion updates (KSP-RO#2574)

* SSME variants and triprop support (KSP-RO#2569)

Update configs to use MBEC instead of MEC

* Near future Launch Vehicles Support (KSP-RO#2567)

Add support for Nertea's Near Future Launch Vehicles.

* High Performance Prototypes (KSP-RO#2603)

Add RS-30, RD301 config, update RD-701, 704, and LR129 configs. Add support for ROE LR129, RD301, RD270.

* BDB Keyhole Parachute Fix (KSP-RO#2601)

* Dynamic Part Hider (KSP-RO#2586)

Adds a system to dynamically hide parts in the VAB/SPH and RnD building based on filters.

Implements a filters for hiding speculative parts based on a difficulty setting that is save independent.

* Add speclevel tagging to engines, fix techTransfer (KSP-RO#2606)

Add specLevel tagging to engine configs, and correct the ordering of techTransfer tags.

* Feed 1.12 DLLs to build scripts

* Update .version file script to target KSP 1.12

* Update version to v14.11.0.0

* Fix proton verniers (KSP-RO#2611)

Apply ignition, ullage and pressurefed tags to Proton verniers and 3rd stage

* Finish transfering RO config of ProcParts

Last value that hasn't already been pulled from ProcParts into RO

* Fix cfg syntax errors (KSP-RO#2612)

* Move fuel property data to RF (KSP-RO#2614)

Move thermal data to RF, where it probably belongs, and add tank definitions for liquid Nitrogen and liquid Helium

* Fix cfg error: invalid use of OR inside HAS (KSP-RO#2616)

* Fix Inconsistent CrewCapacity

PART.CrewCapacity not PART.crewCapacity

* Globally set applyKerbalMassModification

Disable KSP 1.12 reducing part mass based on crew capacity by default.  Override if desired in later pass.  This is because RO by convention assigns part masses without the crew, opposite a later KSP/stock assumption.
Based on stock Physics.cfg, set kerbalCrewMass and perSeatReduction to same value (the mass of the kerbal) and perCommandSeatReduction to include jetpack + parachute.
Since RO is 1.12-only, remove older version guards in NEEDS
Warning: don't set perCommandSeatReduction to 0, it breaks code in kerbal jumping resulting in infinte force applied, which crashes KSP after causing a NaN position/orbit.

* Change specparts default to be Speculative

This feels like a reasonable midway between Show All The Things and Show None Of The Things.

* Fix RD-107 and RD-108

Fix various issues in the RD-107 and RD-108 configs, including incorrect masses, and the 11D511/11D512 configs being swapped.

* Fix config names

Fix 11D511/11D512 names since this is savebreaking anyway

Co-authored-by: Dan <[email protected]>
Co-authored-by: stonesmileGit <[email protected]>
Co-authored-by: Alvin Meng <[email protected]>
Co-authored-by: DRVeyl <[email protected]>
Co-authored-by: Louis-Philippe Gagnon <[email protected]>
Co-authored-by: Stonesmile <[email protected]>
Co-authored-by: siimav <[email protected]>
Co-authored-by: GitHub Actions Bot <>
Co-authored-by: D0m1nu2 <[email protected]>
Co-authored-by: jimmymcgoochie <[email protected]>
Co-authored-by: NathanKell <[email protected]>
Co-authored-by: Vieju17 <[email protected]>
Co-authored-by: HebaruSan <[email protected]>
@HebaruSan
Copy link
Contributor Author

(And we probably should add your checker to our actions so we can check PRs in future!!)

Preliminary support for this now exists, although we are still working on several things, and it may break without warning:

https://github.com/KSP-CKAN/KSPMMCfgParser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants