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

Zero cost Tech Tree nodes make parts impossible to unlock #180

Closed
afyber opened this issue Jan 23, 2024 · 2 comments
Closed

Zero cost Tech Tree nodes make parts impossible to unlock #180

afyber opened this issue Jan 23, 2024 · 2 comments
Labels
kspBug Identified KSP issue
Milestone

Comments

@afyber
Copy link

afyber commented Jan 23, 2024

If you write a custom tech tree, such as via a patch file, with tech tree nodes other than the start node that have a cost of 0 those nodes will be "researched" at the start of the game. Meaning that the icon turns green, and child nodes become unlockable. This is all as you would expect. However, the parts in that node will not have been made available to purchase. The right-click information of the parts does not have the button to pay the unlock cost. The "Purchase X Parts [amount$]" Button below the node parts list does nothing when clicked. And none of those parts are included in the editor parts list like parts which have been researched, but not unlocked, usually do. This makes the parts impossible to ever use, since they're stuck in a state of researched, but not purchased, with no way to purchase them.

I highly suspect that some code is being run specifically for the root node of the tech tree, id = start, that allows the parts in it to be unlocked at the beginning of the game, and that is not being run for any other node.
Some pertinent code is the Load(ConfigNode node) function in RDTech.cs, which includes the lines

scienceCost = int.Parse(node.GetValue("cost"));
if (scienceCost == 0)
{
	state = State.Available;
}

Setting the tech node to Available (which I believe means "researched") if it has a cost of 0.

@JonnyOThan
Copy link
Contributor

Thanks for the report - it would be helpful to have a simple MM patch I could drop into my GameData for testing.

@afyber
Copy link
Author

afyber commented Jan 27, 2024

Here you go, this will create a new node to the left of the start node and place the Mk1-3 Pod, Kickback booster, and Mystery Goo Experiment in the node's parts
ZeroCostTechNode.txt
You'll have to change the filename to end in .cfg, since GitHub wouldn't let me upload it that way

@JonnyOThan JonnyOThan added this to the 1.34 milestone Jan 27, 2024
JonnyOThan added a commit that referenced this issue Jan 29, 2024
@JonnyOThan JonnyOThan added the kspBug Identified KSP issue label Jan 29, 2024
JonnyOThan added a commit that referenced this issue Jan 30, 2024
* New KSP QoL/performance patch : [**LowerMinPhysicsDTPerFrame**](#175) : Allow a min value of 0.02 instead of 0.03 for the "Max Physics Delta-Time Per Frame" main menu setting. This was already possible by manually editing the `settings.cfg` file, but changes would revert when going into the settings screen.

* Add tooltip describing the "Max Physics Delta-Time Per Frame" main menu setting

* merging master to dev (#181)

* zh-cn localization for ManufacturerFixes.cfg (#178)

* Remove ENABLE_PROFILER define that got added recently

---------

Co-authored-by: zhangyuesai <zhangyuesai@live.com>

* Fix #182: ModulePartInventory now accounts for changes to a part's mass or volume
-for example, changing a part's variant (rcs thruster blocks, structural tube) or its resource level could change its mass, but when you store it in inventory the mass would always use the value from the prefab

* oops, revert a couple changes to the csproj that made it into the last commit by accident

* Fix #185: calculate the correct mass for parts when picking them up off the ground in EVA construction

* Fix #104 : set dead kerbals to missing when loading a game and respawning is enabled

* Standardize spaces for indent in .editorconfig and add it to the SLN
(note personally I'd prefer tabs for indents, but all the existing code in here that didn't come from me uses spaces and consistency is more important)

* Change tabs -> spaces in the few files that used it
Whitespace-only change.
(note most of these were originally authored by me, but the project as a whole uses spaces pretty consistently)

* Fix #180: add ZeroCostTechNode patch

* Better editor undo redo (#176)

* BetterEditorUndoRedo : Exploratory fix for undo/redo state, doesn't work because of VesselCrewManifest side effects
See #172

* BetterEditorUndoRedo : functional, obvious issues fixed, still likely to cause side effects.

* disable BetterEditorUndoRedo by default

---------

Co-authored-by: JonnyOThan <jonnyothan@gmail.com>

* PAWGroupMemory is no longer per-window, but rather per-group (#186)

* Fix #50: PAWGroupMemory is no longer per-PAW, but stores the expansion state for all windows and is not cleared on scene changes
-possible future work: persist the collapse state to disk

* collapse or expand PAW groups when the PAW is shown

* Fix #179: ModulePartVariants now applies node position changes in all scenes

* enable BetterEditorUndoRedo by default

* Merge master -> dev (#187)

* zh-cn localization for ManufacturerFixes.cfg (#178)

* Remove ENABLE_PROFILER define that got added recently

---------

Co-authored-by: zhangyuesai <zhangyuesai@live.com>

* update readme with the new fixes

---------

Co-authored-by: gotmachine <24925209+gotmachine@users.noreply.github.com>
Co-authored-by: zhangyuesai <zhangyuesai@live.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kspBug Identified KSP issue
Development

No branches or pull requests

2 participants