-
Notifications
You must be signed in to change notification settings - Fork 1
/
FV_PlayerBellyContainerScript.psc
58 lines (51 loc) · 2.83 KB
/
FV_PlayerBellyContainerScript.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
ScriptName FV_PlayerBellyContainerScript extends ObjectReference
GlobalVariable Property FV_PlayerBellyWeightPerks Auto
GlobalVariable Property FV_PlayerBellyWeight Auto
GlobalVariable Property FV_MaxBellyWeight Auto
GlobalVariable Property FV_CalculatedMaxWeight Auto
ActorValue Property FV_BellyCapacity Auto
ActorValue Property FV_BlockSwallowFlag Auto
ActorValue Property FV_IndigestionSeverityFlag Auto
Message Property FV_PlayerVorecumbered Auto
Float Property WeightPerCapacity = 2.0 Auto
Event OnInit()
AddInventoryEventFilter(NONE)
EndEvent
Event OnActivate(ObjectReference akActionRef)
debug.trace("FV_BellyContainer OnActivate akActionref: " + akActionRef)
AddInventoryEventFilter(NONE)
FV_CalculatedMaxWeight.SetValue(FV_MaxBellyWeight.GetValue() + FV_PlayerBellyWeightPerks.GetValue() + ((Game.GetPlayer().GetValue(FV_BellyCapacity)-2.0)*WeightPerCapacity))
FalloutVore.LoadBellyContainer(FV_PlayerBellyWeight.GetValue() as int, FV_CalculatedMaxWeight.GetValue() as int)
EndEvent
Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
debug.trace("FV_BellyContainer OnItemAdded() akBaseItem: " + akBaseItem + " aiItemCount: " + aiItemCount + " akItemReference: " + akItemReference + " akSourceContainer: " + akSourceContainer)
If(akSourceContainer == Game.GetPlayer())
Form ItemAdded = akBaseItem
If akItemReference != NONE
ItemAdded = akItemReference
EndIf
RemoveItem(ItemAdded, aiItemCount, false, Game.GetPlayer())
Else
SetInventoryWeight()
EndIf
EndEvent
Event OnItemRemoved(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
debug.trace("FV_BellyContainer OnItemRemoved() akBaseItem: " + akBaseItem + " aiItemCount: " + aiItemCount + " akItemReference: " + akItemReference + " akDestContainer: " + akDestContainer)
SetInventoryWeight()
EndEvent
Function SetInventoryWeight()
FV_PlayerBellyWeight.SetValue(self.GetInventoryWeight())
FV_CalculatedMaxWeight.SetValue(FV_MaxBellyWeight.GetValue() + FV_PlayerBellyWeightPerks.GetValue() + ((Game.GetPlayer().GetValue(FV_BellyCapacity)-2.0)*WeightPerCapacity))
FalloutVore.BellyItemChanged(FV_PlayerBellyWeight.GetValue() as int, FV_CalculatedMaxWeight.GetValue() as int)
If(FV_PlayerBellyWeight.GetValue() > FV_CalculatedMaxWeight.GetValue() && Game.GetPlayer().GetValue(FV_BlockSwallowFlag) < 2)
;Player is over weight limit. Push message and block swallow
Game.GetPlayer().SetValue(FV_BlockSwallowFlag, 2)
FV_PlayerVorecumbered.show()
ElseIf(FV_PlayerBellyWeight.GetValue() <= FV_CalculatedMaxWeight.GetValue())
If(Game.GetPlayer().GetValue(FV_IndigestionSeverityFlag) > 0)
Game.GetPlayer().SetValue(FV_BlockSwallowFlag, 1)
Else
Game.GetPlayer().SetValue(FV_BlockSwallowFlag, 0)
EndIf
EndIf
EndFunction