Enabled AI stepping with basic velocity adder system

Enabled AI stepping with basic velocity adder system
Created ServerAudio implementation of Audio which ignores Riiablo.audio calls
This commit is contained in:
Collin Smith 2019-12-28 01:25:44 -08:00
parent 788df90239
commit dd6dbca0f6
3 changed files with 33 additions and 2 deletions

View File

@ -172,7 +172,7 @@ public class Npc extends AI {
} else if (actionTimer > 0) {
actionTimer -= delta;
actionPerformed = actionTimer < 0;
if (!actionPerformed) {
if (!actionPerformed && Riiablo.game != null) { // FIXME: checking Riiablo.game != null for server instances
int player = Riiablo.game.player;
Vector2 targetPos = mPosition.get(player).position;
Vector2 entityPos = mPosition.get(entityId).position;

View File

@ -0,0 +1,25 @@
package com.riiablo.audio;
import com.badlogic.gdx.assets.AssetManager;
import com.riiablo.codec.excel.Sounds;
public class ServerAudio extends Audio {
public ServerAudio(AssetManager assets) {
super(assets);
}
@Override
public Instance play(int id, boolean global) {
return null;
}
@Override
public Instance play(String id, boolean global) {
return null;
}
@Override
public synchronized Instance play(Sounds.Entry sound, boolean global) {
return null;
}
}

View File

@ -25,11 +25,13 @@ import com.riiablo.COFs;
import com.riiablo.CharData;
import com.riiablo.Files;
import com.riiablo.Riiablo;
import com.riiablo.audio.ServerAudio;
import com.riiablo.codec.Animation;
import com.riiablo.codec.D2;
import com.riiablo.codec.StringTBLs;
import com.riiablo.engine.Engine;
import com.riiablo.engine.EntityFactory;
import com.riiablo.engine.server.AIStepper;
import com.riiablo.engine.server.AnimDataResolver;
import com.riiablo.engine.server.CofManager;
import com.riiablo.engine.server.ItemInteractor;
@ -39,6 +41,7 @@ import com.riiablo.engine.server.Pathfinder;
import com.riiablo.engine.server.SerializationManager;
import com.riiablo.engine.server.ServerEntityFactory;
import com.riiablo.engine.server.ServerNetworkIdManager;
import com.riiablo.engine.server.VelocityAdder;
import com.riiablo.engine.server.WarpInteractor;
import com.riiablo.engine.server.component.Networked;
import com.riiablo.engine.server.component.Player;
@ -199,6 +202,7 @@ public class D2GS extends ApplicationAdapter {
Riiablo.cofs = new COFs(Riiablo.assets); // TODO: not needed in prod
Riiablo.string = new StringTBLs(Riiablo.mpqs); // TODO: not needed in prod
Riiablo.anim = D2.loadFromFile(Riiablo.mpqs.resolve("data\\global\\eanimdata.d2"));
Riiablo.audio = new ServerAudio(Riiablo.assets);
// set DT1 to headless mode
DT1.loadData = false;
@ -235,9 +239,11 @@ public class D2GS extends ApplicationAdapter {
.with(new ObjectInitializer())
.with(new ObjectInteractor(), new WarpInteractor(), new ItemInteractor())
// .with(new AIStepper())
.with(new AIStepper())
.with(new Pathfinder())
.with(new VelocityAdder()) // FIXME: temp until proper physics implemented
.with(factory)
.with(sync)
.with(new AnimDataResolver())