-
Notifications
You must be signed in to change notification settings - Fork 4
/
Activator.psc
71 lines (52 loc) · 1.86 KB
/
Activator.psc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Scriptname System:Activator extends System:Object Const
{An activator is an object that can be used (or activated) by an `Actor` or another activator.
Contains methods to create types of objects locally or remotely, or obtain references to existing remote objects.
**See Also**
* https://docs.microsoft.com/en-us/dotnet/api/system.activator
* https://www.creationkit.com/index.php?title=Activator
* https://www.creationkit.com/fallout4/index.php?title=Activator
**TODO**
* Do not allow creation of certain types like `Quest` via "instantiation".
}
import System
;/ USAGE
MyType Function Type() Global
return This().Type(0x0000083E) as MyType
EndFunction
/;
; Instance
;---------------------------------------------
Activator Property ACTI Hidden
Activator Function Get()
return ACTI()
EndFunction
EndProperty
; @virtual
Activator Function ACTI()
Activator this = System:Type.AsActivator(self)
System:Debug.Assert(this, "Exception: Invalid Object! This must be of the `Activator` type.")
return this
EndFunction
; Instantiation
;---------------------------------------------
System:Activator Function This() Global
Properties:Assembly assembly = System:Properties:Assembly.Type()
return System:Type.Read(assembly.File, assembly.System) as System:Activator
EndFunction
Activator Function GetType(int formID) Global
Properties:Assembly assembly = System:Properties:Assembly.Type()
return System:Type.Read(assembly.File, formID) as Activator
EndFunction
var Function Type(int aFormID)
Activator Type = System:Activator.GetType(aFormID)
return Initialize(Type)
EndFunction
ObjectReference Function Initialize(Activator aActivator)
return Factory.PlaceAtMe(aActivator)
EndFunction
; Properties
;---------------------------------------------
Group Objects
ObjectReference Property Factory Auto Const Mandatory
{A "COC Marker Heading" placed within the `SystemCell`.}
EndGroup