Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Commit

Permalink
Fix vent unlocking (#292)
Browse files Browse the repository at this point in the history
* #261: Disable Vent Button for GA

* #261: Unlock Vents for Engineers
  • Loading branch information
DarkPenguin24 authored Feb 5, 2022
1 parent 4de6c91 commit 6611044
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions appdata/il2cpp-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -7386,6 +7386,7 @@ namespace app
#endif
struct AbilityButtonSettings* Ability;
struct AudioClip* UseSound;
struct AudioClip* IntroSound;
struct PlayerControl* Player;
};

Expand Down
13 changes: 9 additions & 4 deletions hooks/HudManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ void dHudManager_Update(HudManager* __this, MethodInfo* method) {

//HudManager_SetHudActive(__this, State.ShowHud, NULL);
if (IsInGame()) {
auto localData = GetPlayerData(*Game::pLocalPlayer);
GameObject* shadowLayerObject = Component_get_gameObject((Component_1*)__this->fields.ShadowQuad, NULL);
GameObject_SetActive(shadowLayerObject,
!(State.FreeCam || State.EnableZoom || State.playerToFollow.has_value() || State.Wallhack) && !GetPlayerData(*Game::pLocalPlayer)->fields.IsDead,
!(State.FreeCam || State.EnableZoom || State.playerToFollow.has_value() || State.Wallhack) && !localData->fields.IsDead,
NULL);

if (!State.InMeeting)
{
app::RoleBehaviour *playerRole = GetPlayerData(*Game::pLocalPlayer)->fields.Role;
app::RoleBehaviour *playerRole = localData->fields.Role;
GameObject* ImpostorVentButton = app::Component_get_gameObject((Component_1*)__this->fields.ImpostorVentButton, NULL);

if (playerRole->fields.Role == RoleTypes__Enum::Engineer && State.UnlockVents)
{
Expand All @@ -44,10 +46,13 @@ void dHudManager_Update(HudManager* __this, MethodInfo* method) {
engineerRole->fields.cooldownSecondsRemaining = 0.01f; //This will be deducted below zero on the next FixedUpdate call
engineerRole->fields.inVentTimeRemaining = 30.0f; //Can be anything as it will always be written
}
else if(playerRole->fields.Role == RoleTypes__Enum::GuardianAngel)
{
app::GameObject_SetActive(ImpostorVentButton, false, nullptr);
}
else
{
GameObject* ImpostorVentButton = app::Component_get_gameObject((Component_1*)__this->fields.ImpostorVentButton, NULL);
app::GameObject_SetActive(ImpostorVentButton, State.UnlockVents || PlayerIsImpostor(GetPlayerData(*Game::pLocalPlayer)), nullptr);
app::GameObject_SetActive(ImpostorVentButton, State.UnlockVents || PlayerIsImpostor(localData), nullptr);
}
}
}
Expand Down

0 comments on commit 6611044

Please sign in to comment.