This repository was archived by the owner on Jun 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 104
Expand file tree
/
Copy path__init__.py
More file actions
56 lines (45 loc) · 1.6 KB
/
__init__.py
File metadata and controls
56 lines (45 loc) · 1.6 KB
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
from typing import Optional
import unrealsdk # type: ignore
from Mods.ModMenu import EnabledSaveType, Hook, RegisterMod, SDKMod
class Bossbar(SDKMod):
Name: str = "Bossbar"
Description: str = (
"Adds a bossbar to minibosses and named enemies."
)
Author: str = "Juso"
Version: str = "1.1"
SaveEnabledState: EnabledSaveType = EnabledSaveType.LoadOnMainMenu
def __init__(self) -> None:
super().__init__()
self.boss_pawn: Optional[unrealsdk.UObject] = None
self.bar_active: bool = False
@Hook("WillowGame.WillowPawn.Died")
def hk_pawn_died(
self,
caller: unrealsdk.UObject,
function: unrealsdk.UFunction,
params: unrealsdk.FStruct,
) -> bool:
if caller == self.boss_pawn:
self.boss_pawn = None
gri = unrealsdk.GetEngine().GetCurrentWorldInfo().GRI
gri.UpdateBossBarInfo()
gri.InitBossBar(False, self.boss_pawn)
self.bar_active = False
return True
@Hook("WillowGame.WillowPawn.TakeDamage")
def hk_pawn_take_damage(
self,
caller: unrealsdk.UObject,
function: unrealsdk.UFunction,
params: unrealsdk.FStruct,
) -> bool:
if BBInstance.boss_pawn is None and (caller.IsChampion() or caller.IsBoss()):
self.boss_pawn = caller
gri: unrealsdk.UObject = unrealsdk.GetEngine().GetCurrentWorldInfo().GRI
if gri:
gri.InitBossBar(True, self.boss_pawn)
self.bar_active = True
return True
BBInstance = Bossbar()
RegisterMod(BBInstance)