Adjusted script command progressbar_npc behavior (#2381)

* Players are no longer detached from the script.
* Players can't walk, attack, use items, or use skills while progress bar is active.

Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
Co-authored-by: Atemo <Atemo@users.noreply.github.com>
This commit is contained in:
Aleos 2020-07-20 13:34:43 -04:00 committed by GitHub
parent 5ba29be2a3
commit 7bdf67e3d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View File

@ -6864,9 +6864,6 @@ given amount of seconds passes, the script resumes. The color format
is in RGB (RRGGBB). The color is currently ignored by the client and
appears always green.
Note: If a player is attached to the NPC, they are detached from the NPC
as soon as the progress bar activates.
---------------------------------------
//
5,1.- End of time-related commands

View File

@ -21014,6 +21014,7 @@ BUILDIN_FUNC(progressbar)
* progressbar_npc "<color>",<seconds>{,<"NPC Name">};
*/
BUILDIN_FUNC(progressbar_npc){
map_session_data *sd = map_id2sd(st->rid);
struct npc_data* nd = NULL;
if( script_hasdata(st, 4) ){
@ -21042,8 +21043,10 @@ BUILDIN_FUNC(progressbar_npc){
return SCRIPT_CMD_FAILURE;
}
// detach the player
script_detach_rid(st);
if (sd) { // Player attached - keep them from doing other things
sd->state.workinprogress = WIP_DISABLE_ALL;
sd->state.block_action |= (PCBLOCK_MOVE | PCBLOCK_ATTACK | PCBLOCK_SKILL);
}
// sleep for the target amount of time
st->state = RERUNLINE;
@ -21055,6 +21058,11 @@ BUILDIN_FUNC(progressbar_npc){
// Second call(by timer after sleeping time is over)
} else {
// Continue the script
if (sd) { // Player attached - remove restrictions
sd->state.workinprogress = WIP_DISABLE_NONE;
sd->state.block_action &= ~(PCBLOCK_MOVE | PCBLOCK_ATTACK | PCBLOCK_SKILL);
}
st->state = RUN;
st->sleep.tick = 0;
nd->progressbar.timeout = nd->progressbar.color = 0;