Skip to content

Commit 31ad8e8

Browse files
committed
Fix static NPCs in houses not being hidden at night
1 parent bf53071 commit 31ad8e8

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

Assets/Scripts/Game/PlayerActivate.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ public class PlayerActivate : MonoBehaviour
8787
public const float MobileNPCActivationDistance = 256 * MeshReader.GlobalScale;
8888

8989
// Opening and closing hours by building type
90-
public static byte[] openHours = { 7, 8, 9, 8, 0, 9, 10, 10, 9, 6, 9, 11, 9, 9, 0, 0, 10, 0 };
91-
public static byte[] closeHours = { 22, 16, 19, 15, 25, 21, 19, 20, 18, 23, 23, 23, 20, 20, 25, 25, 16, 0 };
90+
public static byte[] openHours = { 7, 8, 9, 8, 0, 9, 10, 10, 9, 6, 9, 11, 9, 9, 0, 0, 10, 0, 6, 6, 6, 6, 6, 6 };
91+
public static byte[] closeHours = { 22, 16, 19, 15, 25, 21, 19, 20, 18, 23, 23, 23, 20, 20, 25, 25, 16, 0, 18, 18 ,18, 18, 18, 18 };
9292

9393
const int PrivatePropertyId = 37;
9494

@@ -1284,10 +1284,9 @@ public bool BuildingIsUnlocked(BuildingSummary buildingSummary)
12841284
// Handle House1 through House4
12851285
// TODO: Figure out the rest of house door calculations.
12861286
// TODO: Need to lock doors if quest target for stealing, and unlock for other quests.
1287-
else if (type >= DFLocation.BuildingTypes.House1 && type <= DFLocation.BuildingTypes.House4
1288-
&& DaggerfallUnity.Instance.WorldTime.Now.IsDay)
1287+
else if (type >= DFLocation.BuildingTypes.House1 && type <= DFLocation.BuildingTypes.House4)
12891288
{
1290-
unlocked = true;
1289+
unlocked = IsBuildingOpen(type);
12911290
}
12921291
// Handle stores
12931292
else if (RMBLayout.IsShop(type))

Assets/Scripts/Internal/DaggerfallInterior.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Source Code: https://github.com/Interkarma/daggerfall-unity
66
// Original Author: Gavin Clayton ([email protected])
77
// Contributors: Nystul, Hazelnut, Numidium, Ferital
8-
//
8+
//
99
// Notes:
1010
//
1111

@@ -346,7 +346,7 @@ public void UpdateNpcPresence()
346346
PlayerEnterExit playerEnterExit = GameManager.Instance.PlayerEnterExit;
347347
DFLocation.BuildingTypes buildingType = playerEnterExit.BuildingType;
348348
if ((RMBLayout.IsShop(buildingType) && !playerEnterExit.IsPlayerInsideOpenShop) ||
349-
(!RMBLayout.IsShop(buildingType) && buildingType <= DFLocation.BuildingTypes.Palace && buildingType != DFLocation.BuildingTypes.HouseForSale))
349+
(!RMBLayout.IsShop(buildingType) && buildingType <= DFLocation.BuildingTypes.House4 && buildingType != DFLocation.BuildingTypes.HouseForSale))
350350
{
351351
Transform npcTransforms = transform.Find(peopleFlats);
352352
if (PlayerActivate.IsBuildingOpen(buildingType))
@@ -1202,16 +1202,10 @@ private void AddPeople(PlayerGPS.DiscoveredBuilding buildingData)
12021202
StaticNPC npc = go.AddComponent<StaticNPC>();
12031203
npc.SetLayoutData(obj, entryDoor.buildingKey);
12041204

1205-
// Disable people if shop or building is closed
12061205
DFLocation.BuildingTypes buildingType = buildingData.buildingType;
1207-
if ((RMBLayout.IsShop(buildingType) && !GameManager.Instance.PlayerEnterExit.IsPlayerInsideOpenShop) ||
1208-
(buildingType <= DFLocation.BuildingTypes.Palace && !RMBLayout.IsShop(buildingType)
1209-
&& !(PlayerActivate.IsBuildingOpen(buildingType) || buildingType == DFLocation.BuildingTypes.GuildHall && guild.HallAccessAnytime())))
1210-
{
1211-
go.SetActive(false);
1212-
}
1206+
12131207
// Disable people if player owns this house
1214-
else if (DaggerfallBankManager.IsHouseOwned(buildingData.buildingKey))
1208+
if (DaggerfallBankManager.IsHouseOwned(buildingData.buildingKey))
12151209
{
12161210
go.SetActive(false);
12171211
}
@@ -1220,6 +1214,13 @@ private void AddPeople(PlayerGPS.DiscoveredBuilding buildingData)
12201214
{
12211215
go.SetActive(false);
12221216
}
1217+
// Disable people if shop or building is closed
1218+
else if ((RMBLayout.IsShop(buildingType) && !GameManager.Instance.PlayerEnterExit.IsPlayerInsideOpenShop) ||
1219+
(buildingType <= DFLocation.BuildingTypes.House4 && !RMBLayout.IsShop(buildingType)
1220+
&& !(PlayerActivate.IsBuildingOpen(buildingType) || buildingType == DFLocation.BuildingTypes.GuildHall && guild.HallAccessAnytime())))
1221+
{
1222+
go.SetActive(false);
1223+
}
12231224
else
12241225
{
12251226
QuestMachine.Instance.SetupIndividualStaticNPC(go, obj.FactionID);
@@ -1264,7 +1265,7 @@ private void AddActionDoors()
12641265
{
12651266
boxCollider.center = meshRenderer.bounds.center;
12661267
boxCollider.size = meshRenderer.bounds.size;
1267-
}
1268+
}
12681269

12691270
// Update climate
12701271
DaggerfallMesh dfMesh = go.GetComponent<DaggerfallMesh>();

0 commit comments

Comments
 (0)