Extend spawn command (#1777)

* add missing EntityTypes

* small command refactorings and improvements
* move common command patterns and methods to CommandHelpers
* let the spawn command detect the entityType instead of spawning every entity as EntityVehicle
* add extra options for spawning gadgets for better debuging and testing

* More spawn command additions and cleanups+EntityVehicle changes
* Moved remaining patterns from GiveCommand and ClearCommand to CommandHelpers
* Added patterns for hp, maxhp, atk, def and (monster)ai for the spawn command
* Moved intParam parsing via regex to the CommandHelpers
* Read most of EntityVehicle stats from the ConfigGadget instead of hardcoding them

Co-authored-by: hartie95 <mail@hartie95.de>
This commit is contained in:
Alexander Hartmann
2022-09-16 19:04:20 +02:00
committed by GitHub
parent 9671a76af2
commit 08f361954a
9 changed files with 298 additions and 169 deletions

View File

@@ -37,6 +37,8 @@ import emu.grasscutter.utils.Position;
import emu.grasscutter.utils.ProtoHelper;
import it.unimi.dsi.fastutil.ints.Int2FloatMap;
import it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap;
import lombok.Getter;
import lombok.Setter;
public class EntityMonster extends GameEntity {
private final MonsterData monsterData;
@@ -48,6 +50,8 @@ public class EntityMonster extends GameEntity {
private final int level;
private int weaponEntityId;
private int poseId;
@Getter @Setter
private int aiId=-1;
public EntityMonster(Scene scene, MonsterData monsterData, Position pos, int level) {
super(scene);
@@ -289,6 +293,9 @@ public class EntityMonster extends GameEntity {
monsterInfo.addWeaponList(weaponInfo);
}
if(this.aiId!=-1){
monsterInfo.setAiConfigId(aiId);
}
entityInfo.setMonster(monsterInfo);