Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkwall #2282

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/script_commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9109,12 +9109,15 @@ Example:

*setwall("<map name>", <x>, <y>, <size>, <dir>, <shootable>, "<name>")
*delwall("<name>")
*checkwall("<name>")

Creates an invisible wall, an array of setcell() starting from x,y and
doing a line of the given size in the given direction. The difference with
setcell is this one update client part too to avoid the glitch problem.
Directions are the same as NPC sprite facing directions: (DIR_ constants).

The checkwall() function will return 1 if the wall exists, 0 if not.

---------------------------------------

*readbook(<book id>, <page>)
Expand Down
6 changes: 4 additions & 2 deletions npc/woe-se/agit_main_se.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1699,7 +1699,8 @@ OnBarrierDestroyed:
setd "$agit_"+.@var$+"["+(.@num+1)+"]",1;
setarray .@count$[0],"1st","2nd","3rd";
mapannounce strnpcinfo(NPC_NAME_HIDDEN),"The "+.@count$[.@num-1]+" Fortress Gate is destroyed.",bc_map,"0x00ff00";
delwall .@var$+"_"+strnpcinfo(NPC_NAME_VISIBLE);
if (checkwall(sprintf("%s_%s", .@var$, strnpcinfo(NPC_NAME_VISIBLE))))
delwall(sprintf("%s_%s", .@var$, strnpcinfo(NPC_NAME_VISIBLE)));
}
end;

Expand Down Expand Up @@ -1729,7 +1730,8 @@ OnDisable:
}
}
setcell(strnpcinfo(NPC_NAME_HIDDEN), .@x[0], .@y[0], .@x[1], .@y[1], cell_basilica, false);
delwall substr(strnpcinfo(NPC_NAME_HIDDEN),0,1)+substr(strnpcinfo(NPC_NAME_HIDDEN),8,9)+"_"+strnpcinfo(NPC_NAME_VISIBLE);
if (checkwall(sprintf("%s%s_%s", substr(strnpcinfo(NPC_NAME_HIDDEN), 0, 1), substr(strnpcinfo(NPC_NAME_HIDDEN), 8, 9), strnpcinfo(NPC_NAME_VISIBLE))))
delwall(sprintf("%s%s_%s", substr(strnpcinfo(NPC_NAME_HIDDEN), 0, 1), substr(strnpcinfo(NPC_NAME_HIDDEN), 8, 9), strnpcinfo(NPC_NAME_VISIBLE)));
killmonster strnpcinfo(NPC_NAME_HIDDEN),strnpcinfo(NPC_NAME)+"::OnBarrierDestroyed";
end;
}
Expand Down
11 changes: 11 additions & 0 deletions src/map/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -14261,6 +14261,16 @@ static BUILDIN(delwall)
return true;
}

static BUILDIN(checkwall)
{
const char *name = script_getstr(st, 2);

script_pushint(st, strdb_exists(map->iwall_db, name) ? 1 : 0);

return true;
}


/// Retrieves various information about the specified guardian.
///
/// guardianinfo("<map_name>", <index>, <type>) -> <value>
Expand Down Expand Up @@ -25370,6 +25380,7 @@ static void script_parse_builtin(void)
BUILDIN_DEF(setcell,"siiiiii"),
BUILDIN_DEF(setwall,"siiiiis"),
BUILDIN_DEF(delwall,"s"),
BUILDIN_DEF(checkwall, "s"),
BUILDIN_DEF(searchitem,"rs"),
BUILDIN_DEF(mercenary_create,"ii"),
BUILDIN_DEF(mercenary_heal,"ii"),
Expand Down