Re-add vanilla Vault 13 Canteen, when it's empty; allow to disable canteen replenishing in INI

master
Eddoursul 2 years ago
parent a11cafb50a
commit f4fcea01bf
  1. BIN
      Bottle Rinse Repeat.esp
  2. 4
      config/Bottle Rinse Repeat.ini
  3. 51
      src/EBxBootstrap.gek
  4. 4
      src/EBxFillFromObject.gek
  5. 2
      src/EBxOnCrosshair.gek
  6. 15
      src/EBxOnGameLoad.gek
  7. 16
      src/EBxReplenishCanteen.gek

Binary file not shown.

@ -1,2 +1,4 @@
[Settings]
bFillBottleDelay = 1
iFillBottleDelay = 1
bReplenishableCanteen = 1
iReplenishableCanteenMaxSips = 4

@ -26,7 +26,12 @@ begin function {}
; INI settings
if FileExists "config\Bottle Rinse Repeat.ini"
set EBxFillBottleDelay to GetINIFloat "Settings:bFillBottleDelay" "Bottle Rinse Repeat.ini"
let EBxFillBottleDelay := GetINIFloat "Settings:iFillBottleDelay" "Bottle Rinse Repeat.ini"
let EBxReplenishableCanteen := GetINIFloat "Settings:bReplenishableCanteen" "Bottle Rinse Repeat.ini"
let EBxCanteenSipsMax := GetINIFloat "Settings:iReplenishableCanteenMaxSips" "Bottle Rinse Repeat.ini"
if EBxCanteenSipsMax < 1
let EBxCanteenSipsMax := 4
endif
endif
; Add new items to form lists
@ -61,17 +66,43 @@ begin function {}
; Vault 13 Canteen
if IsModLoaded "ClassicPack.esm"
if eval EBxReplenishableCanteen && IsModLoaded "ClassicPack.esm"
let rItem := GetFormFromMod "FalloutNV.esm" "174095" ; PreordVault13CanteenQuest
if IsFormValid rItem
RemoveScript rItem
endif
let rItem := GetFormFromMod "FalloutNV.esm" "1735D2" ; PreordVaultCanteen
if IsFormValid rItem
SetScript EBxPreordVault13CanteenScript rItem
if eval $rItem == "Vault 13 Canteen"
SetName "Empty Vault 13 Canteen" rItem
endif
endif
endif
; Vault 13 Canteen effect
SetOnUseAidItemEventHandler (begin function { ref rEBxVault13Canteen }
if this == playerRef
if eval ref rEffect := ListGetNthForm EBxCanteenEffects EBxCanteenDrink
playerRef.CIOS rEffect
else
playerRef.CIOS WaterPurified
endif
if playerRef.GetItemCount EBxVault13Canteen == 0
let ref rCanteen := GetFormFromMod "FalloutNV.esm" "1735D2" ; PreordVaultCanteen
if IsFormValid rCanteen
playerRef.AddItem rCanteen 1 1
if MenuMode
RefreshItemsList
endif
endif
endif
endif
end) 1 EBxVault13Canteen
; Draining on middle click
; Short callback notation with SetOnKeyUp/DownEventHandler currently throws an exception with xNVSE 6.20 + JIP LN 56.31
@ -82,18 +113,6 @@ begin function {}
SetOnMenuCloseEventHandler (begin function { i }
SetOnKeyUpEventHandler EBxOnMiddleClick 0 258
end) 1 1002
; Vault 13 Canteen effect
SetOnUseAidItemEventHandler (begin function { rItem }
if this == playerRef
if eval rItem := ListGetNthForm EBxCanteenEffects EBxCanteenDrink
playerRef.CIOS rItem
else
playerRef.CIOS WaterPurified
endif
endif
end) 1 EBxVault13Canteen
; SSBottleEmptyNoFloat
@ -139,7 +158,7 @@ begin function {}
; Enable brahmin milking
if EBxTTW
set rBrahminScriptDC to GetFormFromMod "Fallout3.esm" "38705" ; CRBrahminScriptDC
let rBrahminScriptDC := GetFormFromMod "Fallout3.esm" "38705" ; CRBrahminScriptDC
endif
GetLoadedType rList 43

@ -28,8 +28,6 @@ begin function { rSource }
call EBxReplaceFormListWithItem rDrink rReplaceables
if EBxCanteenSipsMax > 0
call EBxReplenishCanteen rDrink 0
endif
call EBxReplenishCanteen rDrink 0
end

@ -35,7 +35,7 @@ begin function { rSource }
if iCount > 0
let sBottles := sv_construct "%g bottle%{s%}" iCount (iCount > 1)
elseif eval EBxCanteenSipsMax > 0 && call EBxReplenishCanteen rDrink 1
elseif call EBxReplenishCanteen rDrink 1
let sBottles := "canteen"
else
return

@ -26,6 +26,21 @@ begin function { i }
endif
endif
if EBxVersion < 31
let EBxVersion := 31
if IsModLoaded "ClassicPack.esm"
let ref rPreordQuest := GetFormFromMod "FalloutNV.esm" "17912D" ; VDLCPackQuest
if eval IsFormValid rPreordQuest && GetVariable "bClassicItemsGiven" rPreordQuest
if playerRef.GetItemCount EBxVault13Canteen == 0
let ref rPreordVaultCanteen := GetFormFromMod "FalloutNV.esm" "1735D2" ; PreordVaultCanteen
if eval IsFormValid rPreordVaultCanteen && playerRef.GetItemCount rPreordVaultCanteen == 0
playerRef.AddItem rPreordVaultCanteen 1 1
endif
endif
endif
endif
endif
if GetGameRestarted == 0
return
endif

@ -3,12 +3,24 @@ scn EBxReplenishCanteen
ref rNewDrink
ref rCurrentDrink
ref rCanteen
ref rPreordVaultCanteen
int iCount
int iNewDrink
int bCheckOnly
begin function { rNewDrink, bCheckOnly }
if EBxReplenishableCanteen == 0
return
endif
if playerRef.GetItemCount EBxVault13Canteen == 0
let ref rPreordVaultCanteen := GetFormFromMod "FalloutNV.esm" "1735D2" ; PreordVaultCanteen
if eval ! IsFormValid rPreordVaultCanteen || playerRef.GetItemCount rPreordVaultCanteen == 0
return
endif
endif
let iNewDrink := ListGetFormIndex EBxCanteenEffects rNewDrink
if iNewDrink == -1 ; unknown type, fallback to Purified Water
@ -38,6 +50,10 @@ begin function { rNewDrink, bCheckOnly }
endif
if iCount > 0
let rPreordVaultCanteen := GetFormFromMod "FalloutNV.esm" "1735D2" ; PreordVaultCanteen
if IsFormValid rPreordVaultCanteen
playerRef.RemoveItem rPreordVaultCanteen 1 1
endif
playerRef.AddItem EBxVault13Canteen iCount 1
endif

Loading…
Cancel
Save