mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-13 03:13:26 -04:00
Fixed vehicles
This commit is contained in:
@@ -1,21 +1,12 @@
|
||||
import sys
|
||||
|
||||
def setup(core, object):
|
||||
#object.setAttachment('vehicleId', core.objectService.generateObjectID())
|
||||
object.setAttachment('radial_filename', 'item')
|
||||
return
|
||||
|
||||
def use(core, actor, object):
|
||||
if object:
|
||||
vehicleId = object.getObjectID()
|
||||
#vehicleId = object.getAttachment('vehicleId')
|
||||
|
||||
if not vehicleId:
|
||||
return
|
||||
|
||||
vehicle = core.objectService.getObject(vehicleId)
|
||||
|
||||
swoop = core.objectService.createObject('object/mobile/vehicles/shared_speederbike_swoop.iff', vehicleId, actor.getPlanet(), actor.getPosition(), actor.getOrientation())
|
||||
if object:
|
||||
swoop = core.objectService.createObject('object/mobile/vehicle/shared_speederbike_swoop.iff', 0, actor.getPlanet(), actor.getPosition(), actor.getOrientation())
|
||||
core.simulationService.add(swoop, swoop.getPosition().x, swoop.getPosition().z, True)
|
||||
|
||||
return
|
||||
@@ -12,16 +12,12 @@ def createRadial(core, owner, target, radials):
|
||||
def handleSelection(core, owner, target, option):
|
||||
if target:
|
||||
if option == 21 or option == 40:
|
||||
#owner.setPosture(16)
|
||||
owner.setMounted(1)
|
||||
#owner.setParent(target)
|
||||
target.initMount(owner)
|
||||
#target.add(owner)
|
||||
#target.setOwner(owner)
|
||||
#Vehicles.testbike(owner,target)
|
||||
if not owner.isMounted():
|
||||
owner.setMounted(1)
|
||||
target.initMount(owner)
|
||||
else:
|
||||
target.unmount(owner)
|
||||
|
||||
#target.unmount(owner)
|
||||
#core.objectService.useObject(owner, target)
|
||||
if option == 60:
|
||||
core.objectService.destroyObject(target)
|
||||
return
|
||||
@@ -68,7 +68,7 @@ import resources.objects.player.PlayerObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import services.command.BaseSWGCommand;
|
||||
|
||||
@Entity(version=7)
|
||||
@Entity(version=8)
|
||||
public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
|
||||
@NotPersistent
|
||||
@@ -188,6 +188,7 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
private ConcurrentHashMap<String, Long> cooldowns = new ConcurrentHashMap<String, Long>();
|
||||
|
||||
public boolean mounted = false;
|
||||
@NotPersistent
|
||||
public CreatureObject mountedVehicle;
|
||||
|
||||
public CreatureObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) {
|
||||
@@ -540,6 +541,7 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
synchronized(objectMutex) {
|
||||
this.ownerId = ownerId;
|
||||
}
|
||||
notifyObservers(messageBuilder.buildOwnerIdDelta(ownerId), true);
|
||||
}
|
||||
|
||||
public float getAccelerationMultiplierBase() {
|
||||
@@ -1797,30 +1799,43 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
}
|
||||
|
||||
public void mount(CreatureObject owner) {
|
||||
boolean remove = false;
|
||||
synchronized(objectMutex) {
|
||||
if ((this.getOptionsBitmask() & Options.MOUNT) == Options.MOUNT){
|
||||
UpdateContainmentMessage updateContainmentMessage= new UpdateContainmentMessage(owner.getObjectID(), this.getObjectID(), -1);
|
||||
owner.getClient().getSession().write(updateContainmentMessage.serialize());
|
||||
owner.setParent(this);
|
||||
remove = true;
|
||||
_add(owner);
|
||||
UpdateContainmentMessage updateContainmentMessage = new UpdateContainmentMessage(owner.getObjectID(), this.getObjectID(), 4);
|
||||
notifyObservers(updateContainmentMessage, true);
|
||||
}
|
||||
}
|
||||
if(remove)
|
||||
NGECore.getInstance().simulationService.remove(owner, owner.getWorldPosition().x, owner.getWorldPosition().z, false);
|
||||
}
|
||||
|
||||
public void unmount(CreatureObject owner) {
|
||||
boolean add = false;
|
||||
synchronized(objectMutex) {
|
||||
if ((this.getOptionsBitmask() & Options.MOUNT) == Options.MOUNT){
|
||||
UpdateContainmentMessage updateContainmentMessage= new UpdateContainmentMessage(owner.getObjectID(), this.getObjectID(), -1);
|
||||
owner.getClient().getSession().write(updateContainmentMessage.serialize());
|
||||
add = true;
|
||||
_remove(owner);
|
||||
UpdateContainmentMessage updateContainmentMessage = new UpdateContainmentMessage(owner.getObjectID(), 0, -1);
|
||||
notifyObservers(updateContainmentMessage, true);
|
||||
}
|
||||
}
|
||||
if(add) {
|
||||
owner.setMounted(false);
|
||||
owner.setMountedVehicle(null);
|
||||
owner.setStateBitmask(0);
|
||||
owner.setPosture((byte) 0);
|
||||
NGECore.getInstance().simulationService.add(owner, getWorldPosition().x, getWorldPosition().z, false);
|
||||
NGECore.getInstance().simulationService.teleport(owner, getWorldPosition(), getOrientation(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void initMount(CreatureObject owner) {
|
||||
synchronized(objectMutex) {
|
||||
this.ownerId = owner.getObjectID();
|
||||
setStateBitmask(0x10000000);
|
||||
owner.setParent(this);
|
||||
owner.getClient().getSession().write(messageBuilder.buildOwnerIdDelta(ownerId));
|
||||
owner.setMountedVehicle(this);
|
||||
this.setOwnerId(owner.getObjectID());
|
||||
//this.add(owner); // NPE at engine.resources.objects.SWGObject.getCorrectArrangementId(kd:844)
|
||||
|
||||
@@ -1012,7 +1012,6 @@ public class ObjectService implements INetworkDispatch {
|
||||
CrcStringTableVisitor crcTable = ClientFileManager.loadFile("misc/object_template_crc_string_table.iff", CrcStringTableVisitor.class);
|
||||
List<BuildingObject> persistentBuildings = new ArrayList<BuildingObject>();
|
||||
Map<Long, Long> duplicate = new HashMap<Long, Long>();
|
||||
Transaction txn = core.getDuplicateIdODB().getEnvironment().beginTransaction(null, null);
|
||||
|
||||
for (int i = 0; i < buildoutTable.getRowCount(); i++) {
|
||||
|
||||
@@ -1092,16 +1091,14 @@ public class ObjectService implements INetworkDispatch {
|
||||
newObjectId = core.getDuplicateIdODB().get(key, String.class, DuplicateId.class).getObjectId();
|
||||
} else {
|
||||
newObjectId = generateObjectID();
|
||||
Transaction txn = core.getDuplicateIdODB().getEnvironment().beginTransaction(null, null);
|
||||
core.getDuplicateIdODB().put(new DuplicateId(key, newObjectId), String.class, DuplicateId.class, txn);
|
||||
txn.commitSync();
|
||||
}
|
||||
|
||||
duplicate.put(objectId, newObjectId);
|
||||
objectId = newObjectId;
|
||||
}
|
||||
if(txn.isValid()) {
|
||||
System.out.println("Committed doid transaction.");
|
||||
txn.commitSync();
|
||||
}
|
||||
|
||||
List<Long> containers = new ArrayList<Long>();
|
||||
SWGObject object;
|
||||
|
||||
Reference in New Issue
Block a user