New WIP achievement definitions

This commit is contained in:
Anuken
2022-10-09 17:47:12 -04:00
parent dfdb4c1c1f
commit 4201106843
20 changed files with 419 additions and 26 deletions

View File

@@ -16,9 +16,13 @@ public class EventType{
//events that occur very often
public enum Trigger{
shock,
phaseDeflectHit,
blastFreeze,
impactPower,
blastGenerator,
shockwaveTowerUse,
forceProjectorBreak,
thoriumReactorOverheat,
neoplasmReact,
fireExtinguish,
acceleratorUse,
newGame,
@@ -33,6 +37,7 @@ public class EventType{
socketConfigChanged,
update,
unitCommandChange,
importMod,
draw,
drawOver,
preDraw,
@@ -127,6 +132,17 @@ public class EventType{
}
}
public static class SectorLaunchLoadoutEvent{
public final Sector sector, from;
public final Schematic loadout;
public SectorLaunchLoadoutEvent(Sector sector, Sector from, Schematic loadout){
this.sector = sector;
this.from = from;
this.loadout = loadout;
}
}
public static class SchematicCreateEvent{
public final Schematic schematic;
@@ -448,6 +464,29 @@ public class EventType{
}
}
/** Called when a neoplasia (or other pressure-based block, from mods) reactor explodes due to pressure.*/
public static class GeneratorPressureExplodeEvent{
public final Building build;
public GeneratorPressureExplodeEvent(Building build){
this.build = build;
}
}
/** Called when a building is directly killed by a bullet. May not fire in all circumstances. */
public static class BuildingBulletDestroyEvent{
public Building build;
public Bullet bullet;
public BuildingBulletDestroyEvent(Building build, Bullet bullet){
this.build = build;
this.bullet = bullet;
}
public BuildingBulletDestroyEvent(){
}
}
public static class UnitDestroyEvent{
public final Unit unit;
@@ -456,6 +495,35 @@ public class EventType{
}
}
/** Called when a unit is directly killed by a bullet. May not fire in all circumstances. */
public static class UnitBulletDestroyEvent{
public Unit unit;
public Bullet bullet;
public UnitBulletDestroyEvent(Unit unit, Bullet bullet){
this.unit = unit;
this.bullet = bullet;
}
public UnitBulletDestroyEvent(){
}
}
/**
* Called when a unit is hit by a bullet.
* This event is REUSED, do not nest invocations of it (e.g. damage units in its event handler)
* */
public static class UnitDamageEvent{
public Unit unit;
public Bullet bullet;
public UnitDamageEvent set(Unit unit, Bullet bullet){
this.unit = unit;
this.bullet = bullet;
return this;
}
}
public static class UnitDrownEvent{
public final Unit unit;

View File

@@ -292,6 +292,10 @@ public class Schematics implements Loadable{
return defaultLoadouts.get(block);
}
public boolean isDefaultLoadout(Schematic schem){
return defaultLoadouts.containsValue(schem, true);
}
/** Checks a schematic for deployment validity and adds it to the cache. */
private void checkLoadout(Schematic s, boolean customSchem){
Stile core = s.tiles.find(t -> t.block instanceof CoreBlock);

View File

@@ -286,6 +286,11 @@ public class Teams{
return buildingTypes.get(block, () -> new Seq<>(false));
}
public int getCount(Block block){
var res = buildingTypes.get(block);
return res == null ? 0 : res.size;
}
/** Destroys this team's presence on the map, killing part of its buildings and converting everything to 'derelict'. */
public void destroyToDerelict(){
@@ -355,6 +360,12 @@ public class Teams{
}
}
//this is just an alias for consistency
@Nullable
public Seq<Unit> getUnits(UnitType type){
return unitCache(type);
}
@Nullable
public Seq<Unit> unitCache(UnitType type){
if(unitsByType == null || unitsByType.length <= type.id || unitsByType[type.id] == null) return null;