proper shovel item
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
3338487241
commit
ee28d54342
@ -4,7 +4,8 @@
|
|||||||
],
|
],
|
||||||
"files" : [
|
"files" : [
|
||||||
"Data/entity/items/weapons.json",
|
"Data/entity/items/weapons.json",
|
||||||
"Data/entity/items/tools.json",
|
"Data/entity/items/debug_tools.json",
|
||||||
|
"Data/entity/items/hand_tools.json",
|
||||||
"Data/entity/items/clothing.json",
|
"Data/entity/items/clothing.json",
|
||||||
"Data/entity/items/materials.json"
|
"Data/entity/items/materials.json"
|
||||||
]
|
]
|
||||||
|
|||||||
37
assets/Data/entity/items/hand_tools.json
Normal file
37
assets/Data/entity/items/hand_tools.json
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"items" : [
|
||||||
|
{
|
||||||
|
"id" : "Stone Shovel",
|
||||||
|
"tokens" : [
|
||||||
|
"GRAVITY",
|
||||||
|
"TARGETABLE",
|
||||||
|
"CURSOR"
|
||||||
|
],
|
||||||
|
"equipData": {
|
||||||
|
"equipClass" : "tool"
|
||||||
|
},
|
||||||
|
"graphicsTemplate": {
|
||||||
|
"model": {
|
||||||
|
"path" : "Models/items/weapons/shovel1.glb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"clientSidePrimary": "DIG",
|
||||||
|
"collidable": {
|
||||||
|
"type" : "CUBE",
|
||||||
|
"dimension1" : 0.1,
|
||||||
|
"dimension2" : 0.1,
|
||||||
|
"dimension3" : 0.35,
|
||||||
|
"rotX": 0,
|
||||||
|
"rotY": 0,
|
||||||
|
"rotZ": 0,
|
||||||
|
"rotW": 1,
|
||||||
|
"offsetX" : 0,
|
||||||
|
"offsetY" : 0.05,
|
||||||
|
"offsetZ" : 0
|
||||||
|
},
|
||||||
|
"iconPath" : "Textures/icons/itemIconItemGeneric.png"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"files" : [
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -40,5 +40,11 @@ export const clientHooks: Hook[] = [
|
|||||||
callback: (engine: Engine) => {
|
callback: (engine: Engine) => {
|
||||||
engine.classes.voxelUtils.static.spawnWater()
|
engine.classes.voxelUtils.static.spawnWater()
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
signal: "DIG",
|
||||||
|
callback: (engine: Engine) => {
|
||||||
|
engine.classes.voxelUtils.static.applyEdit()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -13,4 +13,9 @@ export interface ClientVoxelUtils {
|
|||||||
*/
|
*/
|
||||||
readonly spawnWater: () => void
|
readonly spawnWater: () => void
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to dig with whatever tool is equipped
|
||||||
|
*/
|
||||||
|
readonly dig: () => void
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1451,6 +1451,7 @@ Static rocks which harvest into rock items that spawn in forest
|
|||||||
Stone Axe item
|
Stone Axe item
|
||||||
Fix human data for RH sword slash attack moves
|
Fix human data for RH sword slash attack moves
|
||||||
Cursor only for specific items
|
Cursor only for specific items
|
||||||
|
Added shovel (works inversely of how you would expect currently)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -83,4 +83,27 @@ public class ScriptClientVoxelUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to dig with whatever tool is equipped
|
||||||
|
*/
|
||||||
|
@Export
|
||||||
|
public static void dig(){
|
||||||
|
CollisionEngine collisionEngine = Globals.clientSceneWrapper.getCollisionEngine();
|
||||||
|
Entity camera = Globals.playerCamera;
|
||||||
|
if(
|
||||||
|
collisionEngine != null &&
|
||||||
|
camera != null
|
||||||
|
){
|
||||||
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(camera));
|
||||||
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(camera));
|
||||||
|
Vector3d cursorPos = collisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
|
if(cursorPos == null){
|
||||||
|
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
||||||
|
}
|
||||||
|
if(Globals.clientSelectedVoxelType != null){
|
||||||
|
TerrainEditing.removeTerrainGated(cursorPos, 1.1f, Globals.clientSelectedVoxelType.getId(), EDIT_INCREMENT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,5 +65,18 @@ public class TerrainEditing {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to remove terrain with proper game logic checks applied
|
||||||
|
* @param position The position to perform the edit
|
||||||
|
* @param editMagnitude The magnitude of the edit to perform
|
||||||
|
* @param type The type of block to make all edited blocks
|
||||||
|
* @param weight The weight of the sphere to apply the edit to
|
||||||
|
*/
|
||||||
|
public static void removeTerrainGated(Vector3d position, float editMagnitude, int type, float weight){
|
||||||
|
if(position != null){
|
||||||
|
Globals.clientConnection.queueOutgoingMessage(TerrainMessage.constructRequestUseTerrainPaletteMessage(position.x, position.y, position.z, editMagnitude, weight, type));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user