• Welcome to AtomicTorch Studio Forums.
 

Adding a new type of gate

Started by MightyMonte88, December 04, 2020, 08:12:09 AM

MightyMonte88

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?

ai_enabled

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!

MightyMonte88

#2
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

ai_enabled

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!

MightyMonte88

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 ?

ai_enabled

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

MightyMonte88

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.

ai_enabled

Good luck with your creations! :-)