Lua: location-specific timers

Expose map-location specific timers to lua scripts. For example:

  nh.start_timer_at(x,y, "melt-ice", 10);

Currently only available timer type is "melt-ice".
This commit is contained in:
Pasi Kallinen
2022-03-15 13:46:50 +02:00
parent 006ae67029
commit 957c0fbee0
3 changed files with 131 additions and 0 deletions

View File

@@ -158,6 +158,15 @@ Example:
local t = nh.gettrap(x, y);
=== has_timer_at
Does location at x,y have a timer?
Example:
local has_melttimer = nh.has_timer_at(x,y, "melt-ice");
=== deltrap
Delete a trap at x,y
@@ -245,6 +254,15 @@ Example:
nh.pline("Line: " .. errors[1].line .. ", " .. errors[1].error);
=== peek_timer_at
When does timer at location at x,y trigger?
Example:
local melttime = nh.peek_timer_at(x,y, "melt-ice");
=== pline
Show the text in the message area.
@@ -308,6 +326,24 @@ Example:
end
=== start_timer_at
Start a timer at location x,y, with trigger time of `when` - relative to current turn.
Example:
nh.start_timer_at(x,y, "melt-ice", when);
=== stop_timer_at
Stop a timer at location x,y.
Example:
nh.stop_timer_at(x,y, "melt-ice");
=== verbalize
Show the text in the message area as if someone said it, obeying eg. hero's deafness.