mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 11:34:19 +01:00
- More work on the new click proc. Added a 1s delay for all hand interactions:
- Added an exception for the application of a delay when you're targeting an item that you are holding. So there is only a 100ms delay when putting items in your backpack, taking them out, juggling stuff in your inventory, etc. It was about 1s before. So the delays between uses are now: - When targeting items that you aren't holding: - - items with USEDELAY: 2s delay - - items with NODELAY: 0.1s delay - - items with neither: 1s delay - When targeting items that you are holding - - all items: 0.1s delay There is one more problem with pathfinding where windows don't properly block clicking. This is the last thing that needs to be addressed, then it should finally be ready. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2446 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
+28
-19
@@ -309,24 +309,33 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl
|
||||
W.attack_self(usr)
|
||||
return
|
||||
|
||||
//Attackby can only be done once every 1 second, unless an object has the NODELAY flag
|
||||
if ( W && !(W.flags & NODELAY) )
|
||||
if(W.flags & USEDELAY)
|
||||
//Objects that use the USEDELAY flag can only attack once every 2 seconds
|
||||
if (usr.next_move < world.time)
|
||||
usr.prev_move = usr.next_move
|
||||
usr.next_move = world.time + 20
|
||||
else
|
||||
return //An item with the USEDELAY flag's already been used this tick
|
||||
//Attackby, attack_hand, afterattack, etc. can only be done once every 1 second, unless an object has the NODELAY or USEDELAY flags set
|
||||
//This segment of code determins this.
|
||||
if(W)
|
||||
if( !( (src.loc && src.loc == usr) || (src.loc.loc && src.loc.loc == usr) ) )
|
||||
//The check above checks that you are not targeting an item which you are holding.
|
||||
//If you are, (example clicking a backpack), the delays are ignored.
|
||||
if(W.flags & USEDELAY)
|
||||
//Objects that use the USEDELAY flag can only attack once every 2 seconds
|
||||
if (usr.next_move < world.time)
|
||||
usr.prev_move = usr.next_move
|
||||
usr.next_move = world.time + 20
|
||||
else
|
||||
return //A click has recently been handled already, you need to wait until the anti-spam delay between clicks passes
|
||||
else if(!(W.flags & NODELAY))
|
||||
//Objects with NODELAY don't have a delay between uses, while most objects have the standard 1 second delay.
|
||||
if (usr.next_move < world.time)
|
||||
usr.prev_move = usr.next_move
|
||||
usr.next_move = world.time + 10
|
||||
else
|
||||
return //A click has recently been handled already, you need to wait until the anti-spam delay between clicks passes
|
||||
else
|
||||
//Empty hand
|
||||
if (usr.next_move < world.time)
|
||||
usr.prev_move = usr.next_move
|
||||
usr.next_move = world.time + 10
|
||||
else
|
||||
//Objects that don't have NODELAY and don't have USEDELAY flags set, can attack once every 1 second, which is the standard.
|
||||
if (usr.next_move < world.time)
|
||||
usr.prev_move = usr.next_move
|
||||
usr.next_move = world.time + 10
|
||||
else
|
||||
return //An item with the USEDELAY flag's already been used this tick
|
||||
|
||||
|
||||
return //A click has recently been handled already, you need to wait until the anti-spam delay between clicks passes
|
||||
|
||||
//Is the object in a valid place?
|
||||
var/valid_place = 0
|
||||
@@ -344,9 +353,9 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl
|
||||
//clicking targets for guns and such. If you are clicking on a target that's not in range
|
||||
//with an item in your hands only afterattack() needs to be performed.
|
||||
//If the range is valid, afterattack() will be handled in the separate mob-type
|
||||
//sections below, just after attackby(). Attack_hand and simmilar procs are handled
|
||||
//sections below, however only after attackby(). Attack_hand and simmilar procs are handled
|
||||
//in the mob-type sections below, as some require you to be in range to work (human, monkey..) while others don't (ai, cyborg)
|
||||
//Also note that afterattack does not differentiate between mob-types.
|
||||
//Also note that afterattack does not differentiate between the holder/attacker's mob-type.
|
||||
if( W && !valid_place)
|
||||
W.afterattack(src, usr, (valid_place ? 1 : 0))
|
||||
return
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@
|
||||
#define SUITSPACE 8 // suit protects against space
|
||||
|
||||
#define USEDELAY 16 // 1 second extra delay on use (Can be used once every 2s)
|
||||
#define NODELAY 32768 // 1 second attackby delay skipped (Can be used once every 0.2s). Most objects have a 1s attackby delay, which doesn't require a flag.
|
||||
#define NODELAY 32768 // 1 second attackby delay skipped (Can be used once every 0.2s). Most objects have a 1s attackby delay, which doesn't require a flag.
|
||||
#define NOSHIELD 32 // weapon not affected by shield
|
||||
#define CONDUCT 64 // conducts electricity (metal etc.)
|
||||
#define ONBELT 128 // can be put in belt slot
|
||||
|
||||
Reference in New Issue
Block a user