Skip to content

Commit

Permalink
First 1.0 (exp) compatibility
Browse files Browse the repository at this point in the history
- Bumped unity version to 2022.3.29f1
  • Loading branch information
mgreter committed Jun 26, 2024
1 parent d2d0d16 commit 6510f5d
Show file tree
Hide file tree
Showing 11 changed files with 146 additions and 84 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ jobs:

steps:
- name: Check out repository code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Call OCB7D2D compiler action
uses: OCB7D2D/OcbModCompiler@master
with:
v7d2d: 'V1.0'
name: "OcbClaimAutoRepair"
version: "${{ github.ref_name }}"
token: "${{ secrets.GITHUB_TOKEN }}"
Expand Down
8 changes: 4 additions & 4 deletions Config/blocks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<property name="Model" value="#@modfolder:Resources/ClaimAutoRepair.unity3d?ClaimAutoRepairPrefab"/>
<property name="IsTerrainDecoration" value="false"/>
<property name="Collide" value="movement,melee,bullet,arrow,rocket"/>
<property name="LootList" value="storageCrate"/>
<property name="LootList" value="playerIronWritableStorage"/>
<property name="LPHardnessScale" value="8"/>
<property name="Group" value="Storage,Building,advBuilding,Blocks,Player"/>
<property name="DescriptionKey" value="ocbBlockClaimAutoRepairDesc"/>
Expand All @@ -29,12 +29,12 @@
</append>

<modif condition="UndeadLegacy_CoreModule">
<include path="blocks.ulm.xml"/>
<modinc path="blocks.ulm.xml"/>
</modif>
<modelsif condition="DarknessFallsCore">
<include path="blocks.a21.df.xml"/>
<modinc path="blocks.a21.df.xml"/>
</modelsif>
<modelse>
<include path="blocks.a21.xml"/>
<modinc path="blocks.a21.xml"/>
</modelse>
</configs>
4 changes: 2 additions & 2 deletions Config/progression.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<!-- unlocks items via schematics only -->
</modif>
<modelsif condition="DarknessFallsCore">
<include path="progression.a21.df.xml"/>
<modinc path="progression.a21.df.xml"/>
</modelsif>
<modelse>
<include path="progression.a21.xml"/>
<modinc path="progression.a21.xml"/>
</modelse>
</configs>
6 changes: 3 additions & 3 deletions Config/recipes.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<configs patcher-version="4">
<modif condition="UndeadLegacy_CoreModule">
<include path="recipes.ulm.xml"/>
<modinc path="recipes.ulm.xml"/>
</modif>
<modelsif condition="DarknessFallsCore">
<include path="recipes.a21.df.xml"/>
<modinc path="recipes.a21.df.xml"/>
</modelsif>
<modelse>
<include path="recipes.a21.xml"/>
<modinc path="recipes.a21.xml"/>
</modelse>
</configs>
12 changes: 7 additions & 5 deletions Harmony/BlockClaimAutoRepair.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,12 @@ public override BlockActivationCommand[] GetBlockActivationCommands(
}

public override bool OnBlockActivated(
string _commandName,
string _commandName,
WorldBase _world,
int _cIdx,
Vector3i _blockPos,
BlockValue _blockValue,
EntityAlive _player)
EntityPlayerLocal _player)
{
if (!(_world.GetTileEntity(_cIdx, _blockPos) is TileEntityClaimAutoRepair tileEntity)) return false;
if (_commandName == "take")
Expand Down Expand Up @@ -227,7 +227,9 @@ public override bool OnBlockActivated(
return true;
}
else {
return base.OnBlockActivated(_commandName, _world, _cIdx, _blockPos, _blockValue, _player);
Log.Out("OnBlockEntityTransformAfterActivated\n");
Log.Out("OnBlockEntityTransformAfterActivated\n");
return base.OnBlockActivated(_commandName, _world, _cIdx, _blockPos, _blockValue, _player);
}
}

Expand Down Expand Up @@ -264,12 +266,12 @@ public void TakeItemWithTimer(
_blockPos,
_player
};
_eventData.Event += new TimerEventHandler(EventData_Event);
_eventData.Event += new TimerEventHandler(TimedEvent);
childByType.SetTimer(TakeDelay, _eventData);
}
}

private void EventData_Event(TimerEventData timerData)
private void TimedEvent(TimerEventData timerData)
{
World world = GameManager.Instance.World;
object[] data = (object[]) timerData.Data;
Expand Down
17 changes: 9 additions & 8 deletions Harmony/TileEntityClaimAutoRepair.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,13 @@ public void TickRepair(World world)
Chunk chunkFromWorldPos = (Chunk)world.GetChunkFromWorldPos(worldPosI);
if (!IsBlockInsideClaim(world, chunkFromWorldPos, randomPos, playerData, claimSize, true))
{
// Check if the block is close by, which suggests a missing land claim block?
if (Mathf.Abs(randomPos.x - worldPos.x) < claimSize / 2) hadBlockOutside = true;
else if (Mathf.Abs(randomPos.y - worldPos.y) < claimSize / 2) hadBlockOutside = true;
else if (Mathf.Abs(randomPos.z - worldPos.z) < claimSize / 2) hadBlockOutside = true;
// Skip it
continue;
// Check if the block is close by, which suggests a missing land claim block?
if (Mathf.Abs(randomPos.x - worldPos.x) < claimSize / 2 &&
Mathf.Abs(randomPos.y - worldPos.y) < claimSize / 2 &&
Mathf.Abs(randomPos.z - worldPos.z) < claimSize / 2)
hadBlockOutside = true;
// Skip it
continue;
}
// Play simple click indicating we are working on something
world.GetGameManager().PlaySoundAtPositionServer(worldPos,
Expand Down Expand Up @@ -456,7 +457,7 @@ public override void SetUserAccessing(bool _bUserAccessing)
EChatType.Whisper,
player.entityId,
msg,
string.Empty, false,
string.Empty,
new List<int> { player.entityId });
lastMissingItem = null;
}
Expand Down Expand Up @@ -521,7 +522,7 @@ private bool IsBlockInsideClaim(
// Check if allies should be considered and if ACL is there
if (includeAllies == false || playerData.ACL == null) continue;
// Now check the actual ACL if player is allied with ourself
if (!playerData.ACL.Contains(lpRelative.UserIdentifier)) continue;
if (!playerData.ACL.Contains(lpRelative.PrimaryId)) continue;
}

// Get all land-claim blocks of the allied user (or our-self)
Expand Down
11 changes: 11 additions & 0 deletions Harmony/ocbClaimAutoRepair.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,15 @@ public static bool Prefix(TileEntityType type, Chunk _chunk, ref TileEntity __re
}
}

[HarmonyPatch(typeof(XUiC_LootWindowGroup))]
[HarmonyPatch("OnOpen")]
public class ASDASDOnOpen
{
public static bool Prefix(TileEntityLootContainer ___te)
{
Log.Out("FOOOOOOO =====>>> {0}\n", ___te);
return true;
}
}

}
Loading

0 comments on commit 6510f5d

Please sign in to comment.