-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the ability to texture blocks.
- Loading branch information
1 parent
5040a33
commit 34b3f1a
Showing
4 changed files
with
185 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Godot; | ||
using System; | ||
|
||
public partial class Texturing : Node3D | ||
{ | ||
[Export] public WorldGen worldGen; | ||
public override void _PhysicsProcess(double delta) | ||
{ | ||
if (PhotoMode.photoModeEnabled || ScrollBar.currentHotbarSelection <= ScrollBar.miningSlot) | ||
{ | ||
return; | ||
} | ||
if (Input.IsActionJustPressed("Action") && Inventory.inventory[ScrollBar.currentHotbarSelection - ScrollBar.miningSlot] > 0) | ||
{ | ||
PhysicsDirectSpaceState3D spaceState = GetWorld3D().DirectSpaceState; | ||
PhysicsRayQueryParameters3D query = PhysicsRayQueryParameters3D.Create(this.GlobalPosition, this.GlobalPosition + (-this.GlobalTransform.Basis.Z * 50)); | ||
query.CollisionMask = 0b00000000_00000000_00000000_00000100; //Brushes | ||
Godot.Collections.Dictionary result = spaceState.IntersectRay(query); | ||
if (result.Count > 0) | ||
{ | ||
int assignment = worldGen.AssignBrushTexture(((Node3D)result["collider"]).GetParent().GetParent() as Node3D, (int)result["face_index"], (uint)(ScrollBar.currentHotbarSelection - ScrollBar.miningSlot)); | ||
if(assignment > -1) | ||
{ | ||
Inventory.inventory[ScrollBar.currentHotbarSelection - ScrollBar.miningSlot]--; | ||
} | ||
if (assignment > 0) | ||
{ | ||
Inventory.inventory[assignment]++; | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.