From 9d53b5e235a991458f9c869fb07cea23ee36a560 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Fri, 24 Mar 2017 09:24:04 -0400 Subject: [PATCH] item cooldown --- config/items.xml | 4 ++-- src/player.cpp | 8 ++++---- xml/!town.xml | 1 + xml/entities.xml | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/config/items.xml b/config/items.xml index 3601c18..7e3a1fb 100644 --- a/config/items.xml +++ b/config/items.xml @@ -17,8 +17,8 @@ - - + + diff --git a/src/player.cpp b/src/player.cpp index 1908af4..d9a4a98 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -242,10 +242,10 @@ void PlayerSystem::receive(const UseItemEvent& uie) } } - /*cool.store(false); - std::thread([&](void) { - std::this_thread::sleep_for(std::chrono::milliseconds(uie.item->cooldown)); + cool.store(false); + std::thread([&](unsigned int ms) { + std::this_thread::sleep_for(std::chrono::milliseconds(ms)); cool.store(true); - }).detach();*/ + }, uie.item->cooldown).detach(); } } diff --git a/xml/!town.xml b/xml/!town.xml index d256af9..c50932b 100644 --- a/xml/!town.xml +++ b/xml/!town.xml @@ -13,6 +13,7 @@ + diff --git a/xml/entities.xml b/xml/entities.xml index fb69086..60fe149 100644 --- a/xml/entities.xml +++ b/xml/entities.xml @@ -62,7 +62,7 @@ - + -- 2.39.5