forked from MagicBane/Server
Project cleanup pre merge.
This commit is contained in:
@@ -19,74 +19,74 @@ import engine.objects.AbstractWorldObject;
|
||||
|
||||
|
||||
public class PowerProjectileMsg extends ClientNetMsg {
|
||||
private AbstractWorldObject source;
|
||||
private AbstractWorldObject target;
|
||||
private float range = 10;
|
||||
private AbstractWorldObject source;
|
||||
private AbstractWorldObject target;
|
||||
private float range = 10;
|
||||
|
||||
/**
|
||||
* This constructor is used by NetMsgFactory. It attempts to deserialize the
|
||||
* ByteBuffer into a message. If a BufferUnderflow occurs (based on reading
|
||||
* past the limit) then this constructor Throws that Exception to the
|
||||
* caller.
|
||||
*/
|
||||
/**
|
||||
* This constructor is used by NetMsgFactory. It attempts to deserialize the
|
||||
* ByteBuffer into a message. If a BufferUnderflow occurs (based on reading
|
||||
* past the limit) then this constructor Throws that Exception to the
|
||||
* caller.
|
||||
*/
|
||||
|
||||
public PowerProjectileMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ARCPOWERPROJECTILE, origin, reader);
|
||||
}
|
||||
public PowerProjectileMsg(AbstractConnection origin, ByteBufferReader reader) {
|
||||
super(Protocol.ARCPOWERPROJECTILE, origin, reader);
|
||||
}
|
||||
|
||||
public PowerProjectileMsg() {
|
||||
super(Protocol.ARCPOWERPROJECTILE);
|
||||
}
|
||||
public PowerProjectileMsg() {
|
||||
super(Protocol.ARCPOWERPROJECTILE);
|
||||
}
|
||||
|
||||
public PowerProjectileMsg(AbstractWorldObject source,AbstractWorldObject target) {
|
||||
super(Protocol.ARCPOWERPROJECTILE);
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
}
|
||||
public PowerProjectileMsg(AbstractWorldObject source, AbstractWorldObject target) {
|
||||
super(Protocol.ARCPOWERPROJECTILE);
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
/**
|
||||
* Deserializes the subclass specific items from the supplied NetMsgReader.
|
||||
*/
|
||||
@Override
|
||||
protected void _deserialize(ByteBufferReader reader) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Pre-cache and configure values so they are available when we serialize
|
||||
// Pre-cache and configure values so they are available when we serialize
|
||||
|
||||
public void configure() {
|
||||
public void configure() {
|
||||
|
||||
if (this.source == null)
|
||||
return;
|
||||
if (this.source == null)
|
||||
return;
|
||||
|
||||
if (this.target == null)
|
||||
return;
|
||||
if (this.target == null)
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
/**
|
||||
* Serializes the subclass specific items to the supplied NetMsgWriter.
|
||||
*/
|
||||
@Override
|
||||
protected void _serialize(ByteBufferWriter writer) throws SerializationException {
|
||||
|
||||
engine.math.Vector3fImmutable faceDir = this.source.getLoc().subtract2D(target.getLoc()).normalize();
|
||||
engine.math.Vector3fImmutable newLoc =faceDir.scaleAdd(range, target.getLoc());
|
||||
engine.math.Vector3fImmutable faceDir = this.source.getLoc().subtract2D(target.getLoc()).normalize();
|
||||
engine.math.Vector3fImmutable newLoc = faceDir.scaleAdd(range, target.getLoc());
|
||||
|
||||
newLoc = newLoc.setY(newLoc.getY() + range);
|
||||
newLoc = newLoc.setY(newLoc.getY() + range);
|
||||
|
||||
writer.putInt(this.source.getObjectType().ordinal());
|
||||
writer.putInt(this.source.getObjectUUID());
|
||||
writer.putVector3f(newLoc);
|
||||
writer.putInt(this.source.getObjectType().ordinal());
|
||||
writer.putInt(this.source.getObjectUUID());
|
||||
writer.putVector3f(newLoc);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public float getRange() {
|
||||
return range;
|
||||
}
|
||||
public float getRange() {
|
||||
return range;
|
||||
}
|
||||
|
||||
public void setRange(float range) {
|
||||
this.range = range;
|
||||
}
|
||||
public void setRange(float range) {
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user