From 009795d76275c9e9b8eedd05fc428508837bee67 Mon Sep 17 00:00:00 2001 From: Joseph Botosh Date: Thu, 24 Sep 2015 14:26:59 +0300 Subject: add PlayerIsTired function to shovel npc --- npc/items/shovel.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'npc') diff --git a/npc/items/shovel.txt b/npc/items/shovel.txt index c4fcd8fa..2fced1af 100644 --- a/npc/items/shovel.txt +++ b/npc/items/shovel.txt @@ -43,6 +43,18 @@ return 1; } + function PlayerIsTired { + .@tick = gettimetick(1); + if (@ShovelLastUsed + max(10, .PlayerTiredTime - readparam(bStr)) > .@tick) + { + narrator + l("You are exhausted, you should rest a bit."); + return 1; + } + @ShovelLastUsed = .@tick; + return 0; + } + function Dig { getmapxy(.@map$, .@x, .@y, 0); for (.@i = 0; .@i < getarraysize($WorldBuriedTreasures_id); .@i++) @@ -117,9 +129,13 @@ OnUse: switch(.@action) { case 1: + if (PlayerIsTired()) + close; Dig(); break; case 2: + if (PlayerIsTired()) + close; Bury(); break; case 3: @@ -128,7 +144,13 @@ OnUse: } close; +OnHour00: + if (playerattached()) + @ShovelLastUsed = 0; + end; + OnInit: + .PlayerTiredTime = 60; AddDigRect("001-1", 172, 26, 200, 48); end; -- cgit v1.2.3-70-g09d2