F4CF / Creation-Framework

A general purpose scripting library for Fallout 4.
MIT License
19 stars 4 forks source link

Planning: Creation Framework #3

Open Scrivener07 opened 4 years ago

Scrivener07 commented 4 years ago

I've still had this standard library for scripting on my mind. I am going for a Microsoft DotNet imitation and CSharp inspired syntax which is very expressive.

I am trying to make the entire library "stateless" where usage is called globally or via type extension (extends). In general this means you can call the global members of the classes as-is, or derive a child class and bind it to a Form in your own mod. The child classes are stateless out of the box. You may override the provided virtual properties to change the base functionality or provide your own. It is also on derived user made classes that instance data may be used as normal.

Here is some highlights.

System:Object

Extends the base Form type. The base for my "re-unified" type system. This is so I can extend the existing type system without overwriting base classes like xSE does. A new System:* base class is (will be) provided by the standard library. Each system base class will provide a special self property which is of the Form's concrete type. Besides this, you call, extend, and bind to Forms as you would normally with the vanilla base scripts. https://github.com/Scrivener07/FO4_Scripting/blob/4a490610befd2a88cdd373f547087a948330e860/System/Scripts/Source/System/System/Object.psc#L49-L60

System:Activator

With my own reunified type system I can more easily support some advanced functionality. The activator type provides a pseudo new operator for script types. https://github.com/Scrivener07/FO4_Scripting/blob/4a490610befd2a88cdd373f547087a948330e860/System/Scripts/Source/System/System/Activator.psc#L42-L71

https://docs.microsoft.com/en-us/dotnet/api/system.activator https://www.creationkit.com/fallout4/index.php?title=Activator

System:Type

An abstraction for "external" data communication. I plan for this to help support my type activator. https://github.com/Scrivener07/FO4_Scripting/blob/4a490610befd2a88cdd373f547087a948330e860/System/Scripts/Source/System/System/Type.psc#L61-L113

Here is an example of external data for the System:Type. The System:Type provides the generic globals that any script can call without doing any extends or attaching to CK forms. But you can optionally define your own System:Type that optionally provides instance members if bound to a Form.. The default instance implementation of the System:Object -> System:Type is an abstraction for Fallout4.esm. The "Creation Framework" as Ive coined it, internally uses a specialized extension of this by overriding some "virtual" members. The System:Type -> System:Properties:Assembly provides an abstraction for System.esl. https://github.com/Scrivener07/FO4_Scripting/blob/4a490610befd2a88cdd373f547087a948330e860/System/Scripts/Source/System/System/Properties/Assembly.psc#L48-L58

System:Collections:Stack

An example of a type which provides a global pseudo new operator called Type(). https://github.com/Scrivener07/FO4_Scripting/blob/4a490610befd2a88cdd373f547087a948330e860/System/Scripts/Source/System/System/Collections/Stack.psc#L13-L15 https://github.com/Scrivener07/FO4_Scripting/blob/4a490610befd2a88cdd373f547087a948330e860/SystemTests/Scripts/Source/SystemTests/SystemTests/Services/Object.psc#L1-L16 Its still in the design/prototype phase so Im interested to hear scripter impressions. :coffee:

Inheritance Diagram

I built an inheritance diagram of script objects. Open the image in a new tab to make larger.

Inheritance Diagram

That is the big picture so far with my current design direction. Just leaving this here in case someone has interesting feedback.

Scrivener07 commented 4 years ago

https://github.com/Scrivener07/CreationKit_Workspace https://github.com/Scrivener07/FO4_Interface/tree/b64445d2f62ce1d6363bc9db7de9b1e83188d588/--Tools