Skip to content
This repository was archived by the owner on Jul 5, 2025. It is now read-only.

Commit 63228ca

Browse files
fix error on warp from portable to locked secured
1 parent 5f9c267 commit 63228ca

4 files changed

Lines changed: 37 additions & 28 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [UNRELEASED] - ?
8+
## [1.1.2] - 2023-03-05
99

1010
- add conf check when applying warp effects buff
1111
- fix error log interpolation
12+
- fix error on warp from portable to locked secured
13+
- improve debug logging around travel prevention
1214
- remove unnecessary particle rotation reference
1315

1416
## [1.1.1] - 2023-02-24

ModInfo.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Name value="Quantum Elevators" />
44
<Description value="Add infinite distance, vertical-warp elevator panels." />
55
<Author value="Jonathan Robertson (Kanaverum)" />
6-
<Version value="1.1.1" />
6+
<Version value="1.1.2" />
77
<Website value="https://github.com/jonathan-robertson/quantum-elevators" />
88
</ModInfo>
99
</xml>

QuantumElevators.dll

512 Bytes
Binary file not shown.

src/CoreLogic.cs

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -244,36 +244,43 @@ private static bool CanAccess(PlatformUserIdentifierAbs internalId, TileEntitySi
244244
{
245245
if (CanAccess(internalId, target, out var targetHasPassword))
246246
{
247+
_log.Debug($"CAN ACCESS because: player {internalId} already has permission to the target panel.");
247248
return true;
248-
} // targetBlockPos is locked and entityPlayer doesn't have access
249-
if (!targetHasPassword
250-
|| source == null
251-
|| !source.IsLocked()
252-
|| !source.HasPassword())
249+
} // so target is locked and entityPlayer isn't already registered as an authorized user
250+
if (!targetHasPassword)
253251
{
254-
_log.Debug($"CANNOT ACCESS because: !targetHasPassword ({!targetHasPassword}) || source == null({source == null}) || !source.IsLocked()({!source.IsLocked()}) || !source.HasPassword()({!source.HasPassword()})");
252+
_log.Debug("CANNOT ACCESS because: target does not have a password.");
255253
return false;
256-
} // source and targetBlockPos have passwords, source is locked
257-
if (source.GetOwner().Equals(target.GetOwner())
258-
&& source.GetPassword().Equals(target.GetPassword()))
254+
} // so target does have a password set
255+
if (source == null)
259256
{
260-
_log.Debug($"CAN ACCESS because: source.GetOwner() == targetBlockPos.GetOwner()({source.GetOwner() == target.GetOwner()}) && source.GetPassword() == targetBlockPos.GetPassword()({source.GetPassword() == target.GetPassword()})");
261-
target.GetUsers().Add(internalId); // dynamically register this user to targetBlockPos!
262-
target.SetModified();
263-
return true;
264-
} // source/targetBlockPos owners or passwords don't match=
265-
_log.Debug($@"CANNOT ACCESS because: source.GetOwner() != targetBlockPos.GetOwner() || source.GetPassword() != targetBlockPos.GetPassword()
266-
source.owner:
267-
CombinedString:{source.GetOwner().CombinedString}
268-
PlatformIdentifierString:{source.GetOwner().PlatformIdentifierString}
269-
ReadablePlatformUserIdentifier:{source.GetOwner().ReadablePlatformUserIdentifier}
270-
targetBlockPos.owner:
271-
CombinedString:{target.GetOwner().CombinedString}
272-
PlatformIdentifierString:{target.GetOwner().PlatformIdentifierString}
273-
ReadablePlatformUserIdentifier:{target.GetOwner().ReadablePlatformUserIdentifier}
274-
source.pass:{source.GetPassword()}
275-
targetBlockPos.pass:{target.GetPassword()}");
276-
return false;
257+
_log.Debug("CANNOT ACCESS because: source is a portable panel, which we cannot apply a password from.");
258+
return false;
259+
} // so source is not a portable panel and might have a password for us to apply to target
260+
if (!source.IsLocked())
261+
{
262+
_log.Debug("CANNOT ACCESS because: source is not locked, so we know it does NOT have a password we could try applying to target.");
263+
return false;
264+
} // so source is locked
265+
if (!source.HasPassword())
266+
{
267+
_log.Debug("CANNOT ACCESS because: source is locked but has no password, so we have no password to try applying to target.");
268+
return false;
269+
} // so source and target each have passwords and we might be able to apply the password from source to target
270+
if (!source.GetOwner().Equals(target.GetOwner()))
271+
{
272+
_log.Debug("CANNOT ACCESS because: source owner does not match target owner, so a password cannot be applied to target even if it matches.");
273+
return false;
274+
} // so source and target have the same owners...
275+
if (!source.GetPassword().Equals(target.GetPassword()))
276+
{
277+
_log.Debug("CANNOT ACCESS because: source and target do not share the same password.");
278+
return false;
279+
} // so source and target share the same password...
280+
_log.Debug("CAN ACCESS because: source panel shares owner and password with target panel.");
281+
target.GetUsers().Add(internalId); // dynamically register this user to targetBlockPos
282+
target.SetModified();
283+
return true;
277284
}
278285

279286
/// <summary>

0 commit comments

Comments
 (0)