Add clear keybinds util, force item action timeout
This commit is contained in:
@@ -440,6 +440,13 @@ function sendAddAccountKeyBindToClient(client, key, keyState) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function sendClearKeyBindsToClient(client, key, keyState) {
|
||||||
|
logToConsole(LOG_DEBUG, `[VRR.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
|
||||||
|
triggerNetworkEvent("vrr.clearKeyBinds", client);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
function sendRemoveAccountKeyBindToClient(client, key) {
|
function sendRemoveAccountKeyBindToClient(client, key) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))})`);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))})`);
|
||||||
triggerNetworkEvent("vrr.delKeyBind", client, toInteger(key));
|
triggerNetworkEvent("vrr.delKeyBind", client, toInteger(key));
|
||||||
@@ -515,6 +522,9 @@ function showPlayerItemTakeDelay(client, itemId) {
|
|||||||
if(delay > 0) {
|
if(delay > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||||
triggerNetworkEvent("vrr.showItemActionDelay", client, delay);
|
triggerNetworkEvent("vrr.showItemActionDelay", client, delay);
|
||||||
|
setTimeout(function() {
|
||||||
|
playerItemActionDelayComplete(client);
|
||||||
|
}, delay+getGlobalConfig().itemActionDelayExtraTimeout);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerTakeItem(client, itemId);
|
playerTakeItem(client, itemId);
|
||||||
@@ -530,6 +540,9 @@ function showPlayerItemUseDelay(client, itemSlot) {
|
|||||||
if(delay > 0) {
|
if(delay > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||||
triggerNetworkEvent("vrr.showItemActionDelay", client, delay);
|
triggerNetworkEvent("vrr.showItemActionDelay", client, delay);
|
||||||
|
setTimeout(function() {
|
||||||
|
playerItemActionDelayComplete(client);
|
||||||
|
}, delay+getGlobalConfig().itemActionDelayExtraTimeout);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerUseItem(client, itemSlot);
|
playerUseItem(client, itemSlot);
|
||||||
@@ -545,6 +558,9 @@ function showPlayerItemDropDelay(client, itemSlot) {
|
|||||||
if(delay > 0) {
|
if(delay > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||||
triggerNetworkEvent("vrr.showItemActionDelay", client, delay);
|
triggerNetworkEvent("vrr.showItemActionDelay", client, delay);
|
||||||
|
setTimeout(function() {
|
||||||
|
playerItemActionDelayComplete(client);
|
||||||
|
}, delay+getGlobalConfig().itemActionDelayExtraTimeout);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerDropItem(client, itemSlot);
|
playerDropItem(client, itemSlot);
|
||||||
@@ -560,6 +576,9 @@ function showPlayerItemPickupDelay(client, itemId) {
|
|||||||
if(delay > 0) {
|
if(delay > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||||
triggerNetworkEvent("vrr.showItemActionDelay", client, delay);
|
triggerNetworkEvent("vrr.showItemActionDelay", client, delay);
|
||||||
|
setTimeout(function() {
|
||||||
|
playerItemActionDelayComplete(client);
|
||||||
|
}, delay+getGlobalConfig().itemActionDelayExtraTimeout);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerPickupItem(client, itemId);
|
playerPickupItem(client, itemId);
|
||||||
@@ -575,6 +594,9 @@ function showPlayerItemPutDelay(client, itemSlot) {
|
|||||||
if(delay > 0) {
|
if(delay > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||||
triggerNetworkEvent("vrr.showItemActionDelay", client, delay);
|
triggerNetworkEvent("vrr.showItemActionDelay", client, delay);
|
||||||
|
setTimeout(function() {
|
||||||
|
playerItemActionDelayComplete(client);
|
||||||
|
}, delay+getGlobalConfig().itemActionDelayExtraTimeout);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerPutItem(client, itemSlot);
|
playerPutItem(client, itemSlot);
|
||||||
@@ -587,8 +609,12 @@ function showPlayerItemPutDelay(client, itemSlot) {
|
|||||||
function showPlayerItemSwitchDelay(client, itemSlot) {
|
function showPlayerItemSwitchDelay(client, itemSlot) {
|
||||||
if(itemSlot != -1) {
|
if(itemSlot != -1) {
|
||||||
if(getPlayerData(client).hotBarItems[itemSlot] != -1) {
|
if(getPlayerData(client).hotBarItems[itemSlot] != -1) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).switchDelay} milliseconds)`);
|
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).switchDelay;
|
||||||
triggerNetworkEvent("vrr.showItemActionDelay", client, getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).switchDelay);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||||
|
triggerNetworkEvent("vrr.showItemActionDelay", client, delay);
|
||||||
|
setTimeout(function() {
|
||||||
|
playerItemActionDelayComplete(client);
|
||||||
|
}, delay+getGlobalConfig().itemActionDelayExtraTimeout);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerSwitchItem(client, itemSlot);
|
playerSwitchItem(client, itemSlot);
|
||||||
|
|||||||
Reference in New Issue
Block a user