AtomicTorch Studio Forums

CryoFall => Modding info => Topic started by: MightyMonte88 on December 04, 2020, 08:12:09 AM

Title: Adding a new type of gate
Post by: MightyMonte88 on December 04, 2020, 08:12:09 AM
When doing so, i'm making a copy of three files (ObjectGateSteel, ObjectGateSteelH, and ObjectGateSteelV.cs )

I'm getting an error from ObjectGateSteel.cs at line 14 "var folderPath = SharedGetRelativeFolderPath(this.GetType(), typeof(ProtoStaticWorldObject<,,>));"

"Severity   Code   Description   Project   File   Line   Suppression State
Error   CS0122   'ProtoStaticWorldObject<ObjectDoorPrivateState, ObjectDoorPublicState, ObjectDoorClientState>.SharedGetRelativeFolderPath(Type, Type)' is inaccessible due to its protection level   Tech_Expansion   C:\Users\adank\OneDrive\Desktop\Cryofall modding\Data\Mods\Tech_Expansion\Scripts\StaticObjects\Structures\Doors\ObjectGateSuperHeavy.cs   14   Active
"

What should i do to be able to access this folder path?
Title: Re: Adding a new type of gate
Post by: ai_enabled on December 04, 2020, 09:24:30 AM
Hello,
it's a compilation error, not a folder access error. There is something wrong with the class hierarchy, hmm...

If you just make a copy of ObjectGateSteel.cs replace "ObjectGateSteel" (3 occurrences inside the file) with your class name, there should be no issues.

Regards!
Title: Re: Adding a new type of gate
Post by: MightyMonte88 on December 04, 2020, 09:41:37 AM
It's still returning the same error, it returns the same error even after only making a copy of the file, hmm..

Here's a screenshot of the error from the compiler

https://ibb.co/XWfcPts
Title: Re: Adding a new type of gate
Post by: ai_enabled on December 04, 2020, 09:47:58 AM
I've just made a copy of ObjectGateSteel and renamed its file name and class name. No compilation errors.

Perhaps the issue is more complex in your case and the compiler error is misleading. Try to exclude the unnecessary stuff (such as all the class files related to the new gate world object) and then start adding them one by one to see which one will cause the issue.

Regards!
Title: Re: Adding a new type of gate
Post by: MightyMonte88 on December 04, 2020, 10:09:07 AM
I tried excluding some of the unnecessary stuff but it resulted in errors no matter what i commented out. The only way to stop the compile error is to "generate or generate abstract method, from "SharedGetRelativeFolderPath", the problem then becomes that the game crashes as soon as i try to launch it with that file present, im not sure what to do here. Can i define the folder path without using SharedGetRelativeFolderPath ?
Title: Re: Adding a new type of gate
Post by: ai_enabled on December 04, 2020, 10:19:54 AM
Ok, the problem is that this method (SharedGetRelativeFolderPath) is marked as internal currently. So it cannot be used outside Core.cpk (e.g. in your mod project) otherwise VS will report a compilation error.

The game will not report any errors as it's merging the files into a single project. But living with VS reporting an error is not fun.

Just make a copy of this method in your copy of the class. https://github.com/AtomicTorchStudio/CryoFall/blob/4a652eb58121d9ff37711e2ee7323c6cae94d09c/Core.cpk/Scripts/StaticObjects/Base/ProtoStaticWorldObject.cs#L281
Title: Re: Adding a new type of gate
Post by: MightyMonte88 on December 04, 2020, 02:08:11 PM
That fixed it, thanks again ai_enabled. I hope im not bothering you with all the questions, again thank you for all your help so far.
Title: Re: Adding a new type of gate
Post by: ai_enabled on December 04, 2020, 02:08:52 PM
Good luck with your creations! :-)