Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Ground Storage) Random rotation for SingleCenter layout #48

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions BlockEntity/BEGroundStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,12 @@ public virtual bool OnPlayerInteractStart(IPlayer player, BlockSelection bs)
switch (StorageProps.Layout)
{
case EnumGroundStorageLayout.SingleCenter:
if (StorageProps.RandomizeCenterRotation)
{
double randomX = Api.World.Rand.NextDouble() * 6.28 - 3.14;
double randomZ = Api.World.Rand.NextDouble() * 6.28 - 3.14;
MeshAngle = (float)Math.Atan2(randomX, randomZ);
}
ok = putOrGetItemSingle(inventory[0], player, bs);
break;

Expand Down
2 changes: 2 additions & 0 deletions CollectibleBehavior/BehaviorGroundStorable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class GroundStorageProperties
public int WallOffY = 1;
public AssetLocation PlaceRemoveSound = new AssetLocation("sounds/player/build");
public bool RandomizeSoundPitch;
public bool RandomizeCenterRotation;
public AssetLocation StackingModel;

[Obsolete("Use ModelItemsToStackSizeRatio instead, which is now a float instead of int?")]
Expand Down Expand Up @@ -66,6 +67,7 @@ public GroundStorageProperties Clone()
WallOffY = WallOffY,
PlaceRemoveSound = PlaceRemoveSound,
RandomizeSoundPitch = RandomizeSoundPitch,
RandomizeCenterRotation = RandomizeCenterRotation,
StackingCapacity = StackingCapacity,
StackingModel = StackingModel,
StackingTextures = StackingTextures,
Expand Down