setpcblock script command (#4052)

* Added setpcblock and getpcblock script commands.
'setpcblock' command prevents/allows the player from doing the given type of action.
'getpcblock' command return the bit-mask value of the currently enabled block flags.

The available type are:
	PCBLOCK_MOVE
	PCBLOCK_ATTACK
	PCBLOCK_SKILL
	PCBLOCK_USEITEM
	PCBLOCK_CHAT
	PCBLOCK_IMMUNE
	PCBLOCK_SITSTAND
	PCBLOCK_COMMANDS
	PCBLOCK_NPCCLICK
	PCBLOCK_EMOTION
	PCBLOCK_ALL

Thanks to @sigtus, @secretdataz, @Lemongrass3110 and @aleos89 for the help and reviews !
Credit to https://github.com/HerculesWS/Hercules/pull/842 for the idea.
This commit is contained in:
Atemo
2019-03-31 18:28:55 +02:00
committed by GitHub
parent cad9678aa6
commit 7dde174c83
14 changed files with 176 additions and 19 deletions

View File

@@ -1376,7 +1376,7 @@ int unit_can_move(struct block_list *bl) {
if (DIFF_TICK(ud->canmove_tick, gettick()) > 0)
return 0;
if ((sd && (pc_issit(sd) || sd->state.vending || sd->state.buyingstore)) || ud->state.blockedmove)
if ((sd && (pc_issit(sd) || sd->state.vending || sd->state.buyingstore || (sd->state.block_action & PCBLOCK_MOVE))) || ud->state.blockedmove)
return 0; // Can't move
// Status changes that block movement