def WillowClientDisableLoadingMovie(caller: unrealsdk.UObject, function: unrealsdk.UFunction, params: unrealsdk.FStruct) -> bool: # On level change reset all our caching self.TouchingActors = {} self.VialCosts = {} self.AmmoCosts = {} self.PlayerAmmoPools = {} AsyncUtil.CancelFutureCallbacks(self.Name) return True
def Disable(self) -> None: AsyncUtil.CancelFutureCallbacks(self.Name) unrealsdk.RemoveHook("WillowGame.WillowInteractiveObject.ConditionalReactToUse", self.Name) unrealsdk.RemoveHook("WillowGame.WillowInteractiveObject.InitializeFromDefinition", self.Name) unrealsdk.RemoveHook("WillowGame.WillowInteractiveObject.Touch", self.Name) unrealsdk.RemoveHook("WillowGame.WillowInteractiveObject.UnTouch", self.Name) unrealsdk.RemoveHook("WillowGame.WillowPlayerController.WillowClientDisableLoadingMovie", self.Name) unrealsdk.RemoveHook("WillowGame.WillowVendingMachine.GenerateInventory", self.Name) unrealsdk.RemoveHook("WillowGame.WillowPlayerController.PayForUsedObject", self.Name)
def Disable(self) -> None: AsyncUtil.CancelFutureCallbacks("CrowdControl") unrealsdk.RemoveHook("WillowGame.FrontendGFxMovie.ConfirmQuit_Clicked", "CrowdControl") if self._listener is not None: self._listener.kill() self._listener = None for callback in Effects.ON_DISABLE: callback()
def OnRun(self, msg: JSON) -> None: """ Callback function for whenever a queued messages should be activated. This implementation makes sure the effect properly runs for the specified duration, so if you need to overwrite it make sure to call this function from your's. If the effect is already running then this function will restart the timer. """ AsyncUtil.CancelFutureCallbacks(f"CC-{self.Name}-Stop") self.OnStart(msg) AsyncUtil.RunIn(self._DurationOption.CurrentValue, self.OnEnd, f"CC-{self.Name}-Stop")
def Disable(self) -> None: AsyncUtil.CancelFutureCallbacks(self.Name) unrealsdk.RemoveHook( "WillowGame.WillowInteractiveObject.ConditionalReactToUse", self.Name) unrealsdk.RemoveHook( "WillowGame.WillowInteractiveObject.InitializeFromDefinition", self.Name) unrealsdk.RemoveHook("WillowGame.WillowInteractiveObject.Touch", self.Name) unrealsdk.RemoveHook("WillowGame.WillowInteractiveObject.UnTouch", self.Name)
def UnTouch(caller: unrealsdk.UObject, function: unrealsdk.UFunction, params: unrealsdk.FStruct) -> bool: if str(caller).split(" ")[0] != "WillowVendingMachine": return True try: self.TouchingActors.remove(params.Other) except KeyError: # If the player is not already in the set pass if self.UpdatingOption.CurrentValue and len( self.TouchingActors) == 0: AsyncUtil.CancelFutureCallbacks(self.Name) return True
def ModOptionChanged(self, option: unrealsdk.Options.Boolean, new_value: bool) -> None: if option != self.UpdatingOption: return # If you turn on updating and there are people close to vendors, start updating if new_value: if len(self.TouchingActors) > 0: AsyncUtil.RunEvery(self.UPDATE_DELAY, self.OnUpdate, self.Name) # If you turn off updating, stop updating and make sure all vendors are usable at no cost else: AsyncUtil.CancelFutureCallbacks(self.Name) for vendor in unrealsdk.FindAll("WillowVendingMachine"): if vendor.ShopType == 1 or vendor.ShopType == 2: vendor.SetUsability(True, 1) vendor.Behavior_ChangeUsabilityCost(1, 0, 0, 1)
def UnTouch(caller: unrealsdk.UObject, function: unrealsdk.UFunction, params: unrealsdk.FStruct) -> bool: if caller.Class.Name != "WillowVendingMachine": return True if params.Other.Class.Name != "WillowPlayerPawn": return True try: self.TouchingActors[caller].remove(params.Other) if len(self.TouchingActors[caller]) == 0: del self.TouchingActors[caller] except (KeyError, ValueError): # If the player or vendor aren't in the dict pass if self.UpdatingOption.CurrentValue and len(self.TouchingActors) == 0: AsyncUtil.CancelFutureCallbacks(self.Name) return True