Delayed bottle filling (WIP)
This commit is contained in:
parent
5d25082558
commit
a11cafb50a
Binary file not shown.
2
config/Bottle Rinse Repeat.ini
Normal file
2
config/Bottle Rinse Repeat.ini
Normal file
@ -0,0 +1,2 @@
|
||||
[Settings]
|
||||
bFillBottleDelay = 1
|
@ -1,13 +1,16 @@
|
||||
if GetNVSEVersionFull < 6.2
|
||||
MessageBoxEx "Bottle Rinse Repeat requires xNVSE 6.20+."
|
||||
if GetNVSEVersionFull < 6.25
|
||||
MessageBoxEx "Bottle Rinse Repeat requires xNVSE 6.25+."
|
||||
return
|
||||
endif
|
||||
|
||||
if GetPluginVersion "JohnnyGuitarNVSE" < 325
|
||||
MessageBoxEx "Bottle Rinse Repeat requires JohnnyGuitar NVSE 3.25+."
|
||||
return
|
||||
endif
|
||||
|
||||
if GetPluginVersion "JIP LN NVSE" < 55.70
|
||||
MessageBoxEx "Bottle Rinse Repeat requires JIP LN 55.70+."
|
||||
return
|
||||
endif
|
||||
|
||||
call EBxBootstrap
|
||||
CallAfterSeconds 0.8 EBxBootstrap 1
|
||||
|
42
src/EBxActivateWaterSource.gek
Normal file
42
src/EBxActivateWaterSource.gek
Normal file
@ -0,0 +1,42 @@
|
||||
scn EBxActivateWaterSource
|
||||
|
||||
ref rSource
|
||||
string_var sPrompt
|
||||
|
||||
begin function {}
|
||||
|
||||
SetGameMainLoopCallback EBxOnCrosshairTracker 0
|
||||
|
||||
SetOnControlDownEventHandler EBxOnControlDown 0 5
|
||||
;SetOnControlUpEventHandler EBxOnControlUp 0 5
|
||||
;EnableControl 5
|
||||
|
||||
let rSource := GetCrosshairRef
|
||||
|
||||
if GetCrosshairWater
|
||||
let sPrompt := playerRef.AuxiliaryVariableGetString "*sDrinkPrompt"
|
||||
elseif eval IsFormValid rSource && (sPrompt := rSource.GetActivatorPrompt) == ""
|
||||
let sPrompt := playerRef.AuxiliaryVariableGetString "*sActivatePrompt"
|
||||
endif
|
||||
|
||||
if GetUIFloat "HUDMainMenu\_DUIF3" > 0 ; DarnUI
|
||||
SetUIStringAlt "HUDMainMenu/InfoWrap/Info/justify_center_hotrect/string" $sPrompt
|
||||
else
|
||||
SetUIStringAlt "HUDMainMenu/Info/justify_center_hotrect/string" $sPrompt
|
||||
endif
|
||||
|
||||
sv_destruct sPrompt
|
||||
|
||||
if IsFormValid rSource
|
||||
|
||||
MessageEx "filling bottles"
|
||||
|
||||
call EBxFillFromObject rSource
|
||||
|
||||
if rSource.HasScriptBlock 2
|
||||
rSource.Activate playerRef 1
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
end
|
@ -13,6 +13,22 @@ begin function {}
|
||||
playerRef.AuxiliaryVariableSetString "*sDrinkPrompt" (GetStringSetting "sTargetTypeDrink")
|
||||
playerRef.AuxiliaryVariableSetString "*sActivatePrompt" (GetStringSetting "sTargetTypeActivate")
|
||||
|
||||
; Fix bottle names in English version
|
||||
|
||||
if eval $ScotchBottle01Empty01 == "Large Whiskey Bottle"
|
||||
SetName "Empty Scotch Bottle" ScotchBottle01Empty01
|
||||
endif
|
||||
|
||||
if eval $Milkbottle01 == "Milk Bottle"
|
||||
SetName "Empty Milk Bottle" Milkbottle01
|
||||
endif
|
||||
|
||||
; INI settings
|
||||
|
||||
if FileExists "config\Bottle Rinse Repeat.ini"
|
||||
set EBxFillBottleDelay to GetINIFloat "Settings:bFillBottleDelay" "Bottle Rinse Repeat.ini"
|
||||
endif
|
||||
|
||||
; Add new items to form lists
|
||||
|
||||
ListAddForm NonAlchoholicDrinks EBxBrahminMilk
|
||||
@ -30,16 +46,6 @@ begin function {}
|
||||
ListAddForm EBxUpgradableToPuraList IrradiatedWaterUnpurified
|
||||
ListAddForm EBxUpgradableToPurifiedList IrradiatedWaterUnpurified
|
||||
|
||||
; Fix bottle names in English version
|
||||
|
||||
if eval $ScotchBottle01Empty01 == "Large Whiskey Bottle"
|
||||
SetName "Empty Scotch Bottle" ScotchBottle01Empty01
|
||||
endif
|
||||
|
||||
if eval $Milkbottle01 == "Milk Bottle"
|
||||
SetName "Empty Milk Bottle" Milkbottle01
|
||||
endif
|
||||
|
||||
; PipBoy icons
|
||||
|
||||
SetTexturePath "interface\icons\pipboyimages\items\items_whiskey.dds" WhiskeyBottle01Empty01
|
||||
@ -111,9 +117,7 @@ begin function {}
|
||||
if EBxTTW == 0
|
||||
let i := 0
|
||||
while rItem := ListGetNthForm EBxListNonAlchoholicDrinks i
|
||||
if ListGetFormIndex NonAlchoholicDrinks rItem == -1
|
||||
ListAddForm NonAlchoholicDrinks rItem
|
||||
endif
|
||||
ListAddForm NonAlchoholicDrinks rItem -2 1
|
||||
let i += 1
|
||||
loop
|
||||
endif
|
||||
@ -128,9 +132,7 @@ begin function {}
|
||||
let i -= 1
|
||||
let rItem := ListGetNthForm rList i
|
||||
if GetEquipType rItem == 13
|
||||
if ListGetFormIndex AlchoholicDrinks rItem == -1
|
||||
ListAddForm AlchoholicDrinks rItem
|
||||
endif
|
||||
ListAddForm AlchoholicDrinks rItem -2 1
|
||||
endif
|
||||
loop
|
||||
|
||||
|
10
src/EBxOnControlDown.gek
Normal file
10
src/EBxOnControlDown.gek
Normal file
@ -0,0 +1,10 @@
|
||||
scn EBxOnControlDown
|
||||
|
||||
int iControl
|
||||
|
||||
begin function { iControl }
|
||||
|
||||
; start countdown
|
||||
playerRef.AuxiliaryVariableErase "*timer"
|
||||
|
||||
end
|
@ -6,33 +6,23 @@ string_var sPrompt
|
||||
|
||||
begin function { iControl }
|
||||
|
||||
SetGameMainLoopCallback EBxOnCrosshairTracker 0
|
||||
|
||||
SetOnControlUpEventHandler EBxOnControlUp 0 5
|
||||
EnableControl 5
|
||||
|
||||
if eval EBxFillBottleDelay > 0 && playerRef.AuxiliaryVariableGetFloat "*timer" < EBxFillBottleDelay
|
||||
MessageEx "Normal activation"
|
||||
let rSource := GetCrosshairRef
|
||||
|
||||
call EBxFillFromObject rSource
|
||||
|
||||
if GetCrosshairWater
|
||||
let sPrompt := playerRef.AuxiliaryVariableGetString "*sDrinkPrompt"
|
||||
elseif eval (sPrompt := rSource.GetActivatorPrompt) == ""
|
||||
let sPrompt := playerRef.AuxiliaryVariableGetString "*sActivatePrompt"
|
||||
endif
|
||||
|
||||
if GetUIFloat "HUDMainMenu\_DUIF3" > 0 ; DarnUI
|
||||
SetUIStringAlt "HUDMainMenu/InfoWrap/Info/justify_center_hotrect/string" $sPrompt
|
||||
else
|
||||
SetUIStringAlt "HUDMainMenu/Info/justify_center_hotrect/string" $sPrompt
|
||||
endif
|
||||
|
||||
sv_destruct sPrompt
|
||||
|
||||
if IsFormValid rSource
|
||||
if rSource.HasScriptBlock 2
|
||||
rSource.Activate playerRef 1
|
||||
endif
|
||||
playerRef.AuxiliaryVariableErase "*timer"
|
||||
return
|
||||
endif
|
||||
|
||||
if EBxFillBottleDelay <= 0
|
||||
call EBxActivateWaterSource
|
||||
endif
|
||||
|
||||
playerRef.AuxiliaryVariableErase "*timer"
|
||||
|
||||
EnableControl 5
|
||||
SetOnControlUpEventHandler EBxOnControlUp 0 5
|
||||
|
||||
end
|
||||
|
@ -4,6 +4,9 @@ ref rSource
|
||||
ref rDrink
|
||||
int iCount
|
||||
array_var aDrinksToUpgrade
|
||||
string_var sOrigPrompt
|
||||
string_var sPrompt
|
||||
string_var sBottles
|
||||
|
||||
begin function { rSource }
|
||||
|
||||
@ -11,7 +14,7 @@ begin function { rSource }
|
||||
return
|
||||
endif
|
||||
|
||||
if GetType rSource != 21 ; activator
|
||||
if rSource.GetType != 21 ; activator
|
||||
if GetCrosshairWater == 0
|
||||
return
|
||||
endif
|
||||
@ -31,47 +34,36 @@ begin function { rSource }
|
||||
let aDrinksToUpgrade := ar_null
|
||||
|
||||
if iCount > 0
|
||||
|
||||
if GetCrosshairWater
|
||||
if iCount > 1
|
||||
SetStringSetting "sTargetTypeDrink" ("Fill " + $iCount + " bottles with " + $rDrink)
|
||||
else
|
||||
SetStringSetting "sTargetTypeDrink" ("Fill " + $iCount + " bottle with " + $rDrink)
|
||||
endif
|
||||
elseif eval rSource.GetActivatorPrompt != ""
|
||||
playerRef.AuxiliaryVariableSetString "*ap" (rSource.GetActivatorPrompt)
|
||||
if iCount > 1
|
||||
rSource.SetActivatorPrompt ("Fill " + $iCount + " bottles with " + $rDrink)
|
||||
else
|
||||
rSource.SetActivatorPrompt ("Fill " + $iCount + " bottle with " + $rDrink)
|
||||
endif
|
||||
else
|
||||
if iCount > 1
|
||||
SetStringSetting "sTargetTypeActivate" ("Fill " + $iCount + " bottles with " + $rDrink)
|
||||
else
|
||||
SetStringSetting "sTargetTypeActivate" ("Fill " + $iCount + " bottle with " + $rDrink)
|
||||
endif
|
||||
endif
|
||||
|
||||
let sBottles := sv_construct "%g bottle%{s%}" iCount (iCount > 1)
|
||||
elseif eval EBxCanteenSipsMax > 0 && call EBxReplenishCanteen rDrink 1
|
||||
|
||||
if GetCrosshairWater
|
||||
SetStringSetting "sTargetTypeDrink" ("Fill canteen with " + $rDrink)
|
||||
elseif eval rSource.GetActivatorPrompt != ""
|
||||
playerRef.AuxiliaryVariableSetString "*ap" (rSource.GetActivatorPrompt)
|
||||
rSource.SetActivatorPrompt ("Fill canteen with " + $rDrink)
|
||||
else
|
||||
SetStringSetting "sTargetTypeActivate" ("Fill canteen with " + $rDrink)
|
||||
endif
|
||||
|
||||
let sBottles := "canteen"
|
||||
else
|
||||
return
|
||||
endif
|
||||
|
||||
DisableControl 5
|
||||
SetOnControlUpEventHandler EBxOnControlUp 1 5
|
||||
if GetCrosshairWater
|
||||
let sPrompt := sv_construct "%{Drink or hold to fill%}%{Fill%} %z with %n" (EBxFillBottleDelay > 0) (EBxFillBottleDelay <= 0) sBottles rDrink
|
||||
SetStringSetting "sTargetTypeDrink" $sPrompt
|
||||
CallAfterSeconds 0 ({} => SetStringSetting "sTargetTypeDrink" (playerRef.AuxiliaryVariableGetString "*sDrinkPrompt"))
|
||||
elseif eval rSource.GetActivatorPrompt != ""
|
||||
let sOrigPrompt := rSource.GetActivatorPrompt
|
||||
if EBxFillBottleDelay > 0
|
||||
let sPrompt := $(rSource.GetActivatorPrompt) + " or hold to fill"
|
||||
else
|
||||
let sPrompt := "Fill"
|
||||
endif
|
||||
let sPrompt := sv_construct "%z %z with %n" sPrompt sBottles rDrink
|
||||
rSource.SetActivatorPrompt $sPrompt
|
||||
CallAfterSeconds 0 ({} => rSource.SetActivatorPrompt $sOrigPrompt)
|
||||
else
|
||||
let sPrompt := sv_construct "%{Activate or hold to fill%}%{Fill%} %z with %n" (EBxFillBottleDelay > 0) (EBxFillBottleDelay <= 0) sBottles rDrink
|
||||
SetStringSetting "sTargetTypeActivate" $sPrompt
|
||||
CallAfterSeconds 0 ({} => SetStringSetting "sTargetTypeActivate" (playerRef.AuxiliaryVariableGetString "*sActivatePrompt"))
|
||||
endif
|
||||
|
||||
CallAfterSeconds 0 EBxOnCrosshairAfter
|
||||
DisableControl 5
|
||||
SetOnControlDownEventHandler EBxOnControlDown 1 5
|
||||
SetOnControlUpEventHandler EBxOnControlUp 1 5
|
||||
|
||||
SetGameMainLoopCallback EBxOnCrosshairTracker 1 1 11
|
||||
|
||||
|
@ -6,12 +6,22 @@ begin function {}
|
||||
|
||||
if MenuMode == 0
|
||||
|
||||
if eval EBxFillBottleDelay > 0 && IsControlDisabled 5 && IsKeyPressed (GetControl 5) 2
|
||||
if playerRef.AuxiliaryVariableGetFloat "*timer" < EBxFillBottleDelay
|
||||
playerRef.AuxiliaryVariableSetFloat "*timer" (playerRef.AuxiliaryVariableGetFloat "*timer" + GetSecondsPassed)
|
||||
else
|
||||
MessageEx "activating source"
|
||||
call EBxActivateWaterSource
|
||||
return
|
||||
endif
|
||||
endif
|
||||
|
||||
if GetCrosshairWater
|
||||
return
|
||||
endif
|
||||
|
||||
if eval rSource := GetCrosshairRef
|
||||
if GetType rSource == 21 ; activator
|
||||
if rSource.GetType == 21 ; activator
|
||||
if rSource.GetActivatorWaterType
|
||||
return
|
||||
endif
|
||||
@ -22,6 +32,7 @@ begin function {}
|
||||
|
||||
SetGameMainLoopCallback EBxOnCrosshairTracker 0
|
||||
|
||||
SetOnControlDownEventHandler EBxOnControlDown 0 5
|
||||
SetOnControlUpEventHandler EBxOnControlUp 0 5
|
||||
EnableControl 5
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user