Fixed vehicle passenger stuff

This commit is contained in:
Seefo
2014-04-23 00:11:26 -04:00
parent 8ee82f7a75
commit 064e733cba
4 changed files with 29 additions and 8 deletions
@@ -1,4 +1,6 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'creature/vehicle')
object.setAttachment('passengers', 0)
return
@@ -1,4 +1,9 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'deeds/vehicleDeed')
return
def use(core, actor, object):
core.mountService.generateVehicle(actor, object, 'object/mobile/vehicle/shared_landspeeder_av21.iff', 'object/intangible/vehicle/shared_landspeeder_av21_pcd.iff')
return
+4 -5
View File
@@ -6,8 +6,7 @@ def createRadial(core, owner, target, radials):
radials.add(RadialOptions(0, 7, 1, ''))
if core.mountService.canMount(owner, target):
radials.add(RadialOptions(1, 40, 3, '@pet/pet_menu:menu_enter_exit'))
radials.add(RadialOptions(0, 21, 1, ''))
radials.add(RadialOptions(0, 40, 3, '@pet/pet_menu:menu_enter_exit'))
if target.getOwnerId() == owner.getObjectID():
radials.add(RadialOptions(0, 60, 3, '@pet/pet_menu:menu_store'))
if core.mountService.canRepair(owner, target):
@@ -18,11 +17,11 @@ def handleSelection(core, owner, target, option):
mntSvc = core.mountService
if target:
if option == 21:
if option == 40:
if mntSvc.isMounted(owner):
mntSvc.mount(owner, target)
mntSvc.dismount(owner, target)
else:
mntSvc.unmount(owner, target)
mntSvc.mount(owner, target)
elif option == 60:
mntSvc.store(owner, target)
elif option == 114:
+18 -3
View File
@@ -529,13 +529,28 @@ public class MountService implements INetworkDispatch {
return actor.getContainer() == mount;
}
public int getPassengerCount(CreatureObject mount)
{
mount.setAttachment("passengers", 0);
mount.viewChildren(mount, false, false, new Traverser()
{
public void process(SWGObject passenger)
{
if (passenger instanceof CreatureObject) mount.setAttachment("passengers", (int) mount.getAttachment("passengers") + 1);
}
});
return (int)mount.getAttachment("passengers");
}
public boolean canMount(CreatureObject rider, CreatureObject mount) {
if (mount == null) {
return false;
}
if (!mount.getOption(Options.MOUNT)) {
return false;
// return false;
}
if (isMounted(rider)) {
@@ -556,7 +571,7 @@ public class MountService implements INetworkDispatch {
int passengers = 0;
if (mount.getAttachment("passengers") != null){
passengers = (Integer) mount.getAttachment("passengers");
passengers = getPassengerCount(mount);
}
int passengerSlot = 0;
@@ -569,7 +584,7 @@ public class MountService implements INetworkDispatch {
}
if (passengerSlot == 0) {
return false;
// return false;
}
CreatureObject owner = (CreatureObject) NGECore.getInstance().objectService.getObject(mount.getOwnerId());