feat: add some features
This commit is contained in:
+74
-6
@@ -1,14 +1,71 @@
|
||||
#include "Global.h"
|
||||
|
||||
using namespace ll::schedule;
|
||||
using namespace ll::chrono_literals;
|
||||
|
||||
GameTimeScheduler scheduler;
|
||||
|
||||
namespace Cleaner {
|
||||
|
||||
bool isDeathDrop(ItemActor* itac) {
|
||||
// Todo
|
||||
return false;
|
||||
}
|
||||
|
||||
bool shouldIgnoreMob(Mob* mob) {
|
||||
// Todo
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ShouldClean(Actor* en) {
|
||||
// Players
|
||||
if (en->isType(ActorType::Player)) {
|
||||
return false;
|
||||
}
|
||||
// 过滤
|
||||
// Todo
|
||||
return true;
|
||||
// Tag
|
||||
if (en->hasTag("testtag")) {
|
||||
// Todo
|
||||
}
|
||||
auto type = en->getTypeName();
|
||||
// Items
|
||||
if (en->hasCategory(ActorCategory::Item)) {
|
||||
if (true) { // Todo Config Toggle
|
||||
auto itac = (ItemActor*)en;
|
||||
if (isDeathDrop(itac)) {
|
||||
return false;
|
||||
}
|
||||
auto itemType = itac->item().getTypeName();
|
||||
if (true) { // Todo Config WhiteList
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Mobs
|
||||
else if (en->hasCategory(ActorCategory::Mob)) {
|
||||
if (true) { // Todo Config Toggle
|
||||
auto mob = (Mob*)en;
|
||||
if (shouldIgnoreMob(mob)) {
|
||||
return false;
|
||||
}
|
||||
if (true) { // Todo WhiteList
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Others
|
||||
else {
|
||||
if (true) { // Todo Config Toggle
|
||||
if (true) { // BlackList
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int ExecuteClean() {
|
||||
@@ -34,10 +91,21 @@ int CountEntities() {
|
||||
return clean_count;
|
||||
}
|
||||
|
||||
void CleanSchedule() {
|
||||
using namespace ll::schedule;
|
||||
|
||||
using namespace ll::chrono_literals;
|
||||
|
||||
void CleanTask() {
|
||||
// Todo Schedule
|
||||
auto count = ExecuteClean();
|
||||
// Todo Notice & Console Log
|
||||
logger.info("clean will in {}", 20s);
|
||||
scheduler.add<DelayTask>(20s, [] {
|
||||
auto count = ExecuteClean();
|
||||
logger.info("Successfully cleaned {} entities", count);
|
||||
});
|
||||
}
|
||||
|
||||
void CountEntitiesTask() {
|
||||
//
|
||||
}
|
||||
|
||||
} // namespace Cleaner
|
||||
Reference in New Issue
Block a user