fab item work
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
96b59111e8
commit
4c9cad96f2
@ -15,8 +15,14 @@
|
|||||||
"path" : "Models/items/weapons/shovel1.glb"
|
"path" : "Models/items/weapons/shovel1.glb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"clientSidePrimary": "ADD_VOXEL",
|
"primaryUsage" : {
|
||||||
"clientSideSecondary": "OPEN_VOXEL",
|
"clientHook" : "ADD_VOXEL",
|
||||||
|
"suppressServerRequest": true
|
||||||
|
},
|
||||||
|
"secondaryUsage" : {
|
||||||
|
"clientHook" : "OPEN_VOXEL",
|
||||||
|
"suppressServerRequest": true
|
||||||
|
},
|
||||||
"collidable": {
|
"collidable": {
|
||||||
"type" : "CUBE",
|
"type" : "CUBE",
|
||||||
"dimension1" : 0.1,
|
"dimension1" : 0.1,
|
||||||
@ -48,8 +54,14 @@
|
|||||||
"path" : "Models/basic/geometry/unitvector.glb"
|
"path" : "Models/basic/geometry/unitvector.glb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"clientSidePrimary": "LEVEL_EDIT_SPAWN",
|
"primaryUsage" : {
|
||||||
"clientSideSecondary": "OPEN_SPAWN_SELECT",
|
"clientHook" : "LEVEL_EDIT_SPAWN",
|
||||||
|
"suppressServerRequest": true
|
||||||
|
},
|
||||||
|
"secondaryUsage" : {
|
||||||
|
"clientHook" : "OPEN_SPAWN_SELECT",
|
||||||
|
"suppressServerRequest": true
|
||||||
|
},
|
||||||
"collidable": {
|
"collidable": {
|
||||||
"type" : "CUBE",
|
"type" : "CUBE",
|
||||||
"dimension1" : 0.1,
|
"dimension1" : 0.1,
|
||||||
@ -80,7 +92,10 @@
|
|||||||
"path" : "Models/items/weapons/shovel1.glb"
|
"path" : "Models/items/weapons/shovel1.glb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"clientSideSecondary": "INSPECTOR",
|
"secondaryUsage" : {
|
||||||
|
"clientHook" : "INSPECTOR",
|
||||||
|
"suppressServerRequest": true
|
||||||
|
},
|
||||||
"collidable": {
|
"collidable": {
|
||||||
"type" : "CUBE",
|
"type" : "CUBE",
|
||||||
"dimension1" : 0.1,
|
"dimension1" : 0.1,
|
||||||
@ -111,7 +126,10 @@
|
|||||||
"path" : "Models/basic/geometry/unitvector.glb"
|
"path" : "Models/basic/geometry/unitvector.glb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"clientSideSecondary": "SPAWN_WATER",
|
"secondaryUsage" : {
|
||||||
|
"clientHook" : "SPAWN_WATER",
|
||||||
|
"suppressServerRequest": true
|
||||||
|
},
|
||||||
"collidable": {
|
"collidable": {
|
||||||
"type" : "CUBE",
|
"type" : "CUBE",
|
||||||
"dimension1" : 0.1,
|
"dimension1" : 0.1,
|
||||||
@ -142,8 +160,14 @@
|
|||||||
"path" : "Models/basic/geometry/unitvector.glb"
|
"path" : "Models/basic/geometry/unitvector.glb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"clientSidePrimary" : "PLACE_FAB",
|
"primaryUsage" : {
|
||||||
"clientSideSecondary": "SELECT_FAB",
|
"clientHook" : "PLACE_FAB",
|
||||||
|
"suppressServerRequest": true
|
||||||
|
},
|
||||||
|
"secondaryUsage" : {
|
||||||
|
"clientHook" : "SELECT_FAB",
|
||||||
|
"suppressServerRequest": true
|
||||||
|
},
|
||||||
"collidable": {
|
"collidable": {
|
||||||
"type" : "CUBE",
|
"type" : "CUBE",
|
||||||
"dimension1" : 0.1,
|
"dimension1" : 0.1,
|
||||||
@ -174,7 +198,10 @@
|
|||||||
"path" : "Models/basic/geometry/unitvector.glb"
|
"path" : "Models/basic/geometry/unitvector.glb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"clientSideSecondary": "SELECT_ROOM",
|
"secondaryUsage" : {
|
||||||
|
"clientHook" : "SELECT_ROOM",
|
||||||
|
"suppressServerRequest": true
|
||||||
|
},
|
||||||
"collidable": {
|
"collidable": {
|
||||||
"type" : "CUBE",
|
"type" : "CUBE",
|
||||||
"dimension1" : 0.1,
|
"dimension1" : 0.1,
|
||||||
|
|||||||
@ -9,7 +9,11 @@
|
|||||||
"fabData" : {
|
"fabData" : {
|
||||||
"fabPath" : "Data/fab/wood_refined_floor.block"
|
"fabPath" : "Data/fab/wood_refined_floor.block"
|
||||||
},
|
},
|
||||||
"clientSideSecondary" : "PLACE_FAB",
|
"secondaryUsage" : {
|
||||||
|
"clientHook" : "PLACE_FAB",
|
||||||
|
"onlyOnMouseDown" : true,
|
||||||
|
"suppressServerRequest" : true
|
||||||
|
},
|
||||||
"maxStack" : 100,
|
"maxStack" : 100,
|
||||||
"itemAudio": {
|
"itemAudio": {
|
||||||
"uiGrabAudio" : "Audio/ui/items/specific/Pick Up Wood A.wav",
|
"uiGrabAudio" : "Audio/ui/items/specific/Pick Up Wood A.wav",
|
||||||
|
|||||||
@ -15,7 +15,10 @@
|
|||||||
"path" : "Models/items/weapons/shovel1.glb"
|
"path" : "Models/items/weapons/shovel1.glb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"clientSidePrimary": "DIG",
|
"primaryUsage" : {
|
||||||
|
"clientHook" : "DIG",
|
||||||
|
"suppressServerRequest": true
|
||||||
|
},
|
||||||
"collidable": {
|
"collidable": {
|
||||||
"type" : "CUBE",
|
"type" : "CUBE",
|
||||||
"dimension1" : 0.1,
|
"dimension1" : 0.1,
|
||||||
@ -46,7 +49,10 @@
|
|||||||
"path" : "Models/items/weapons/pick1.glb"
|
"path" : "Models/items/weapons/pick1.glb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"clientSidePrimary": "DIG",
|
"primaryUsage" : {
|
||||||
|
"clientHook" : "DIG",
|
||||||
|
"suppressServerRequest": true
|
||||||
|
},
|
||||||
"collidable": {
|
"collidable": {
|
||||||
"type" : "CUBE",
|
"type" : "CUBE",
|
||||||
"dimension1" : 0.1,
|
"dimension1" : 0.1,
|
||||||
|
|||||||
@ -1621,6 +1621,8 @@ Crafting can consume charges
|
|||||||
Products from crafting can add charges to existing items
|
Products from crafting can add charges to existing items
|
||||||
Cache busting when physics sync pulls player entity TELEPORT distances
|
Cache busting when physics sync pulls player entity TELEPORT distances
|
||||||
Lotta inventory work to bugfix charges, crafting, in-inventory items, etc
|
Lotta inventory work to bugfix charges, crafting, in-inventory items, etc
|
||||||
|
Collapse client hooks for item usage into main itemusage class
|
||||||
|
Debounce fab placement
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -76,15 +76,17 @@ public class ItemActions {
|
|||||||
Entity primaryEntity = clientToolbarState.getCurrentPrimaryItem();
|
Entity primaryEntity = clientToolbarState.getCurrentPrimaryItem();
|
||||||
if(primaryEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity) != null){
|
if(primaryEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity) != null){
|
||||||
Item data = Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity);
|
Item data = Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity);
|
||||||
if(data.getClientSidePrimary() != null){
|
|
||||||
ClientScriptUtils.fireSignal(data.getClientSidePrimary());
|
|
||||||
}
|
|
||||||
if(data.getPrimaryUsage() != null){
|
if(data.getPrimaryUsage() != null){
|
||||||
|
if(data.getPrimaryUsage().getClientHook() != null){
|
||||||
|
ClientScriptUtils.fireSignal(data.getPrimaryUsage().getClientHook());
|
||||||
|
}
|
||||||
if(data.getPrimaryUsage().getBlockId() != null){
|
if(data.getPrimaryUsage().getBlockId() != null){
|
||||||
sendServerMessage = false;
|
|
||||||
BlockEditing.destroyBlock();
|
BlockEditing.destroyBlock();
|
||||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.INTERACT_SFX_BLOCK_PLACE, VirtualAudioSourceType.CREATURE, false);
|
Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.INTERACT_SFX_BLOCK_PLACE, VirtualAudioSourceType.CREATURE, false);
|
||||||
}
|
}
|
||||||
|
if(data.getPrimaryUsage().getSuppressServerRequest()){
|
||||||
|
sendServerMessage = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -175,15 +177,17 @@ public class ItemActions {
|
|||||||
Entity primaryEntity = clientToolbarState.getCurrentPrimaryItem();
|
Entity primaryEntity = clientToolbarState.getCurrentPrimaryItem();
|
||||||
if(primaryEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity) != null){
|
if(primaryEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity) != null){
|
||||||
Item data = Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity);
|
Item data = Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity);
|
||||||
if(data.getClientSideSecondary() != null){
|
|
||||||
ClientScriptUtils.fireSignal(data.getClientSideSecondary());
|
|
||||||
}
|
|
||||||
if(data.getSecondaryUsage() != null){
|
if(data.getSecondaryUsage() != null){
|
||||||
|
if(data.getSecondaryUsage().getClientHook() != null){
|
||||||
|
ClientScriptUtils.fireSignal(data.getSecondaryUsage().getClientHook());
|
||||||
|
}
|
||||||
if(data.getSecondaryUsage().getBlockId() != null){
|
if(data.getSecondaryUsage().getBlockId() != null){
|
||||||
sendServerMessage = false;
|
|
||||||
BlockEditing.editBlock((short)(int)data.getSecondaryUsage().getBlockId(),(short)0);
|
BlockEditing.editBlock((short)(int)data.getSecondaryUsage().getBlockId(),(short)0);
|
||||||
Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.INTERACT_SFX_BLOCK_PLACE, VirtualAudioSourceType.CREATURE, false);
|
Globals.virtualAudioSourceManager.createVirtualAudioSource(AssetDataStrings.INTERACT_SFX_BLOCK_PLACE, VirtualAudioSourceType.CREATURE, false);
|
||||||
}
|
}
|
||||||
|
if(data.getSecondaryUsage().getSuppressServerRequest() != null){
|
||||||
|
sendServerMessage = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -211,26 +215,43 @@ public class ItemActions {
|
|||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
||||||
}
|
}
|
||||||
//tell the server we want the secondary hand item to STOP doing something
|
|
||||||
Globals.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientRequestPerformItemActionMessage(
|
|
||||||
"handRight",
|
//send server message if we're not doing a block edit
|
||||||
ITEM_ACTION_CODE_SECONDARY,
|
//client sends custom packets for block editing
|
||||||
ITEM_ACTION_CODE_STATE_REPEAT,
|
boolean sendServerMessage = true;
|
||||||
cursorPos.x,
|
|
||||||
cursorPos.y,
|
|
||||||
cursorPos.z
|
|
||||||
));
|
|
||||||
//TODO: do any immediate client side calculations here (ie start playing an animation until we get response from server)
|
//TODO: do any immediate client side calculations here (ie start playing an animation until we get response from server)
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.playerEntity != null){
|
||||||
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
|
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
|
||||||
Entity primaryEntity = clientToolbarState.getCurrentPrimaryItem();
|
Entity primaryEntity = clientToolbarState.getCurrentPrimaryItem();
|
||||||
if(primaryEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity) != null){
|
if(primaryEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity) != null){
|
||||||
Item data = Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity);
|
Item data = Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity);
|
||||||
if(data.getClientSideSecondary() != null){
|
if(data.getSecondaryUsage() != null){
|
||||||
ClientScriptUtils.fireSignal(data.getClientSideSecondary());
|
if(data.getSecondaryUsage().getOnlyOnMouseDown() != null && data.getSecondaryUsage().getOnlyOnMouseDown() == true){
|
||||||
|
} else {
|
||||||
|
if(data.getSecondaryUsage().getClientHook() != null){
|
||||||
|
ClientScriptUtils.fireSignal(data.getSecondaryUsage().getClientHook());
|
||||||
|
}
|
||||||
|
if(data.getSecondaryUsage().getSuppressServerRequest()){
|
||||||
|
sendServerMessage = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//tell the server we want the secondary hand item to STOP doing something
|
||||||
|
if(sendServerMessage){
|
||||||
|
Globals.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientRequestPerformItemActionMessage(
|
||||||
|
"handRight",
|
||||||
|
ITEM_ACTION_CODE_SECONDARY,
|
||||||
|
ITEM_ACTION_CODE_STATE_REPEAT,
|
||||||
|
cursorPos.x,
|
||||||
|
cursorPos.y,
|
||||||
|
cursorPos.z
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -62,16 +62,6 @@ public class Item extends CommonEntityType {
|
|||||||
*/
|
*/
|
||||||
ItemAudio itemAudio;
|
ItemAudio itemAudio;
|
||||||
|
|
||||||
/**
|
|
||||||
* A hook that should fire client-side when the player uses this as their primary item
|
|
||||||
*/
|
|
||||||
String clientSidePrimary;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A hook that should fire client-side when the player uses this as their primary item
|
|
||||||
*/
|
|
||||||
String clientSideSecondary;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The usage logic for a primary usage of this item
|
* The usage logic for a primary usage of this item
|
||||||
*/
|
*/
|
||||||
@ -223,22 +213,6 @@ public class Item extends CommonEntityType {
|
|||||||
return itemAudio;
|
return itemAudio;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the client side primary hook to fire
|
|
||||||
* @return The hook
|
|
||||||
*/
|
|
||||||
public String getClientSidePrimary(){
|
|
||||||
return clientSidePrimary;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the client side secondary hook to fire
|
|
||||||
* @return The hook
|
|
||||||
*/
|
|
||||||
public String getClientSideSecondary(){
|
|
||||||
return clientSideSecondary;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the secondary usage logic of this item
|
* Gets the secondary usage logic of this item
|
||||||
* @return The secondary usage logic
|
* @return The secondary usage logic
|
||||||
|
|||||||
@ -15,6 +15,16 @@ public class ItemUsage {
|
|||||||
*/
|
*/
|
||||||
Integer blockId;
|
Integer blockId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The hook to fire on the client when this item is used
|
||||||
|
*/
|
||||||
|
String clientHook;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to suppress sending a request to the server to use the item (ie if firing a client hook)
|
||||||
|
*/
|
||||||
|
Boolean suppressServerRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls whether this usage only fires on mouse down
|
* Controls whether this usage only fires on mouse down
|
||||||
*/
|
*/
|
||||||
@ -68,7 +78,37 @@ public class ItemUsage {
|
|||||||
this.onlyOnMouseDown = onlyOnMouseDown;
|
this.onlyOnMouseDown = onlyOnMouseDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the client hook to fire when this item is used
|
||||||
|
* @return The client hook to fire
|
||||||
|
*/
|
||||||
|
public String getClientHook() {
|
||||||
|
return clientHook;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the client hook to fire when this item is used
|
||||||
|
* @param clientHook The client hook to fire
|
||||||
|
*/
|
||||||
|
public void setClientHook(String clientHook) {
|
||||||
|
this.clientHook = clientHook;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets whether the server request should be suppressed or not
|
||||||
|
* @return true if it should be suppressed, false otherwise
|
||||||
|
*/
|
||||||
|
public Boolean getSuppressServerRequest() {
|
||||||
|
return suppressServerRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether the server request should be suppressed or not
|
||||||
|
* @param suppressServerRequest true if it should be suppressed, false otherwise
|
||||||
|
*/
|
||||||
|
public void setSuppressServerRequest(Boolean suppressServerRequest) {
|
||||||
|
this.suppressServerRequest = suppressServerRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user