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"
|
||||
}
|
||||
},
|
||||
"clientSidePrimary": "ADD_VOXEL",
|
||||
"clientSideSecondary": "OPEN_VOXEL",
|
||||
"primaryUsage" : {
|
||||
"clientHook" : "ADD_VOXEL",
|
||||
"suppressServerRequest": true
|
||||
},
|
||||
"secondaryUsage" : {
|
||||
"clientHook" : "OPEN_VOXEL",
|
||||
"suppressServerRequest": true
|
||||
},
|
||||
"collidable": {
|
||||
"type" : "CUBE",
|
||||
"dimension1" : 0.1,
|
||||
@ -48,8 +54,14 @@
|
||||
"path" : "Models/basic/geometry/unitvector.glb"
|
||||
}
|
||||
},
|
||||
"clientSidePrimary": "LEVEL_EDIT_SPAWN",
|
||||
"clientSideSecondary": "OPEN_SPAWN_SELECT",
|
||||
"primaryUsage" : {
|
||||
"clientHook" : "LEVEL_EDIT_SPAWN",
|
||||
"suppressServerRequest": true
|
||||
},
|
||||
"secondaryUsage" : {
|
||||
"clientHook" : "OPEN_SPAWN_SELECT",
|
||||
"suppressServerRequest": true
|
||||
},
|
||||
"collidable": {
|
||||
"type" : "CUBE",
|
||||
"dimension1" : 0.1,
|
||||
@ -80,7 +92,10 @@
|
||||
"path" : "Models/items/weapons/shovel1.glb"
|
||||
}
|
||||
},
|
||||
"clientSideSecondary": "INSPECTOR",
|
||||
"secondaryUsage" : {
|
||||
"clientHook" : "INSPECTOR",
|
||||
"suppressServerRequest": true
|
||||
},
|
||||
"collidable": {
|
||||
"type" : "CUBE",
|
||||
"dimension1" : 0.1,
|
||||
@ -111,7 +126,10 @@
|
||||
"path" : "Models/basic/geometry/unitvector.glb"
|
||||
}
|
||||
},
|
||||
"clientSideSecondary": "SPAWN_WATER",
|
||||
"secondaryUsage" : {
|
||||
"clientHook" : "SPAWN_WATER",
|
||||
"suppressServerRequest": true
|
||||
},
|
||||
"collidable": {
|
||||
"type" : "CUBE",
|
||||
"dimension1" : 0.1,
|
||||
@ -142,8 +160,14 @@
|
||||
"path" : "Models/basic/geometry/unitvector.glb"
|
||||
}
|
||||
},
|
||||
"clientSidePrimary" : "PLACE_FAB",
|
||||
"clientSideSecondary": "SELECT_FAB",
|
||||
"primaryUsage" : {
|
||||
"clientHook" : "PLACE_FAB",
|
||||
"suppressServerRequest": true
|
||||
},
|
||||
"secondaryUsage" : {
|
||||
"clientHook" : "SELECT_FAB",
|
||||
"suppressServerRequest": true
|
||||
},
|
||||
"collidable": {
|
||||
"type" : "CUBE",
|
||||
"dimension1" : 0.1,
|
||||
@ -174,7 +198,10 @@
|
||||
"path" : "Models/basic/geometry/unitvector.glb"
|
||||
}
|
||||
},
|
||||
"clientSideSecondary": "SELECT_ROOM",
|
||||
"secondaryUsage" : {
|
||||
"clientHook" : "SELECT_ROOM",
|
||||
"suppressServerRequest": true
|
||||
},
|
||||
"collidable": {
|
||||
"type" : "CUBE",
|
||||
"dimension1" : 0.1,
|
||||
|
||||
@ -9,7 +9,11 @@
|
||||
"fabData" : {
|
||||
"fabPath" : "Data/fab/wood_refined_floor.block"
|
||||
},
|
||||
"clientSideSecondary" : "PLACE_FAB",
|
||||
"secondaryUsage" : {
|
||||
"clientHook" : "PLACE_FAB",
|
||||
"onlyOnMouseDown" : true,
|
||||
"suppressServerRequest" : true
|
||||
},
|
||||
"maxStack" : 100,
|
||||
"itemAudio": {
|
||||
"uiGrabAudio" : "Audio/ui/items/specific/Pick Up Wood A.wav",
|
||||
|
||||
@ -15,7 +15,10 @@
|
||||
"path" : "Models/items/weapons/shovel1.glb"
|
||||
}
|
||||
},
|
||||
"clientSidePrimary": "DIG",
|
||||
"primaryUsage" : {
|
||||
"clientHook" : "DIG",
|
||||
"suppressServerRequest": true
|
||||
},
|
||||
"collidable": {
|
||||
"type" : "CUBE",
|
||||
"dimension1" : 0.1,
|
||||
@ -46,7 +49,10 @@
|
||||
"path" : "Models/items/weapons/pick1.glb"
|
||||
}
|
||||
},
|
||||
"clientSidePrimary": "DIG",
|
||||
"primaryUsage" : {
|
||||
"clientHook" : "DIG",
|
||||
"suppressServerRequest": true
|
||||
},
|
||||
"collidable": {
|
||||
"type" : "CUBE",
|
||||
"dimension1" : 0.1,
|
||||
|
||||
@ -1621,6 +1621,8 @@ Crafting can consume charges
|
||||
Products from crafting can add charges to existing items
|
||||
Cache busting when physics sync pulls player entity TELEPORT distances
|
||||
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();
|
||||
if(primaryEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity) != null){
|
||||
Item data = Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity);
|
||||
if(data.getClientSidePrimary() != null){
|
||||
ClientScriptUtils.fireSignal(data.getClientSidePrimary());
|
||||
}
|
||||
if(data.getPrimaryUsage() != null){
|
||||
if(data.getPrimaryUsage().getClientHook() != null){
|
||||
ClientScriptUtils.fireSignal(data.getPrimaryUsage().getClientHook());
|
||||
}
|
||||
if(data.getPrimaryUsage().getBlockId() != null){
|
||||
sendServerMessage = false;
|
||||
BlockEditing.destroyBlock();
|
||||
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();
|
||||
if(primaryEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity) != null){
|
||||
Item data = Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity);
|
||||
if(data.getClientSideSecondary() != null){
|
||||
ClientScriptUtils.fireSignal(data.getClientSideSecondary());
|
||||
}
|
||||
if(data.getSecondaryUsage() != null){
|
||||
if(data.getSecondaryUsage().getClientHook() != null){
|
||||
ClientScriptUtils.fireSignal(data.getSecondaryUsage().getClientHook());
|
||||
}
|
||||
if(data.getSecondaryUsage().getBlockId() != null){
|
||||
sendServerMessage = false;
|
||||
BlockEditing.editBlock((short)(int)data.getSecondaryUsage().getBlockId(),(short)0);
|
||||
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){
|
||||
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",
|
||||
ITEM_ACTION_CODE_SECONDARY,
|
||||
ITEM_ACTION_CODE_STATE_REPEAT,
|
||||
cursorPos.x,
|
||||
cursorPos.y,
|
||||
cursorPos.z
|
||||
));
|
||||
|
||||
|
||||
//send server message if we're not doing a block edit
|
||||
//client sends custom packets for block editing
|
||||
boolean sendServerMessage = true;
|
||||
|
||||
//TODO: do any immediate client side calculations here (ie start playing an animation until we get response from server)
|
||||
if(Globals.playerEntity != null){
|
||||
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
|
||||
Entity primaryEntity = clientToolbarState.getCurrentPrimaryItem();
|
||||
if(primaryEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity) != null){
|
||||
Item data = Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity);
|
||||
if(data.getClientSideSecondary() != null){
|
||||
ClientScriptUtils.fireSignal(data.getClientSideSecondary());
|
||||
if(data.getSecondaryUsage() != null){
|
||||
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;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@ -222,22 +212,6 @@ public class Item extends CommonEntityType {
|
||||
public ItemAudio getItemAudio(){
|
||||
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
|
||||
|
||||
@ -15,6 +15,16 @@ public class ItemUsage {
|
||||
*/
|
||||
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
|
||||
*/
|
||||
@ -68,8 +78,38 @@ public class ItemUsage {
|
||||
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