fixed gadget hp properties and invincibility handling (#1773)

* fixed gadget hp properties and invincibility handling

* Allow killing of hp locked entities, if the damage is higher then the hp

Co-authored-by: hartie95 <mail@hartie95.de>
This commit is contained in:
Alexander Hartmann
2022-09-15 04:26:20 +02:00
committed by GitHub
parent 21ff749dca
commit 08fdcf6ed4
7 changed files with 111 additions and 10 deletions

View File

@@ -68,6 +68,7 @@ public class ResourceLoader {
// Process into depots
GameDepot.load();
// Load spawn data and quests
loadGadgetConfigData();
loadSpawnData();
loadQuests();
loadScriptSceneData();
@@ -493,6 +494,31 @@ public class ResourceLoader {
Grasscutter.getLogger().debug("Loaded " + GameData.getSceneNpcBornData().size() + " SceneNpcBornDatas.");
}
@SneakyThrows
private static void loadGadgetConfigData() {
Files.list(Path.of(RESOURCE("BinOutput/Gadget/"))).forEach(filePath -> {
var file = filePath.toFile();
if (file.isDirectory() || !file.getName().endsWith("json")) {
return;
}
Map<String, ConfigGadget> config;
try {
config = JsonUtils.loadToMap(filePath.toString(), String.class, ConfigGadget.class);
} catch (Exception e) {
Grasscutter.getLogger().error("failed to load ConfigGadget entries for "+filePath, e);
return;
}
for (Entry<String, ConfigGadget> e : config.entrySet()) {
GameData.getGadgetConfigData().put(e.getKey(), e.getValue());
}
});
Grasscutter.getLogger().debug("Loaded {} ConfigGadget entries.", GameData.getGadgetConfigData().size());
}
@SneakyThrows
private static void loadBlossomResources() {
GameDepot.setBlossomConfig(DataLoader.loadClass("BlossomConfig.json", BlossomConfig.class));