mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-16 08:56:04 +01:00
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:
committed by
GitHub
parent
21ff749dca
commit
08fdcf6ed4
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user