mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 19:52:37 -06:00
No more updateCoons.
This commit is contained in:
parent
b49683ccd9
commit
1de4367482
3 changed files with 39 additions and 24 deletions
|
@ -683,15 +683,6 @@ class DistributedEstateAI(DistributedObjectAI):
|
||||||
def rentItem(self, rentType, duration):
|
def rentItem(self, rentType, duration):
|
||||||
self.b_setRentalTimeStamp(time.time() + duration * 60)
|
self.b_setRentalTimeStamp(time.time() + duration * 60)
|
||||||
self.b_setRentalType(rentType)
|
self.b_setRentalType(rentType)
|
||||||
|
|
||||||
def updateToons(self):
|
|
||||||
self.d_setSlot0ToonId(self.toons[0])
|
|
||||||
self.d_setSlot1ToonId(self.toons[1])
|
|
||||||
self.d_setSlot2ToonId(self.toons[2])
|
|
||||||
self.d_setSlot3ToonId(self.toons[3])
|
|
||||||
self.d_setSlot4ToonId(self.toons[4])
|
|
||||||
self.d_setSlot5ToonId(self.toons[5])
|
|
||||||
self.sendUpdate('setIdList', [self.toons])
|
|
||||||
|
|
||||||
def setSlot0ToonId(self, id):
|
def setSlot0ToonId(self, id):
|
||||||
self.toons[0] = id
|
self.toons[0] = id
|
||||||
|
|
|
@ -215,20 +215,34 @@ class LoadEstateFSM(FSM):
|
||||||
if self.state != 'CreateEstate':
|
if self.state != 'CreateEstate':
|
||||||
return # We must have aborted or something...
|
return # We must have aborted or something...
|
||||||
self.estateId = estateId
|
self.estateId = estateId
|
||||||
|
self.demand('StoreEstate')
|
||||||
|
|
||||||
# Update our account so we can store this new estate object.
|
def enterStoreEstate(self):
|
||||||
|
# store the estate in account
|
||||||
|
# congrats however wrote this for forgetting it!
|
||||||
|
|
||||||
self.mgr.air.dbInterface.updateObject(
|
self.mgr.air.dbInterface.updateObject(
|
||||||
self.mgr.air.dbId,
|
self.mgr.air.dbId,
|
||||||
self.accountId,
|
self.accountId,
|
||||||
self.mgr.air.dclassesByName['AccountAI'],
|
self.mgr.air.dclassesByName['AccountAI'],
|
||||||
{ 'ESTATE_ID': estateId }
|
{'ESTATE_ID': self.estateId},
|
||||||
)
|
{'ESTATE_ID': 0},
|
||||||
|
self.__handleStoreEstate)
|
||||||
|
|
||||||
|
def __handleStoreEstate(self, fields):
|
||||||
|
if fields:
|
||||||
|
self.notify.warning("Failed to associate Estate %d with account %d, loading anyway." % (self.estateId, self.accountId))
|
||||||
|
|
||||||
self.demand('LoadEstate')
|
self.demand('LoadEstate')
|
||||||
|
|
||||||
def enterLoadEstate(self):
|
def enterLoadEstate(self):
|
||||||
# Activate the estate:
|
# Activate the estate:
|
||||||
self.mgr.air.sendActivate(self.estateId, self.mgr.air.districtId, self.zoneId)
|
fields = {}
|
||||||
|
for i, toon in enumerate(self.toonIds):
|
||||||
|
fields['setSlot%dToonId' % i] = (toon,)
|
||||||
|
|
||||||
|
self.mgr.air.sendActivate(self.estateId, self.mgr.air.districtId, self.zoneId,
|
||||||
|
self.mgr.air.dclassesByName['DistributedEstateAI'], fields)
|
||||||
|
|
||||||
# Now we wait for the estate to show up... We do this by hanging a messenger
|
# Now we wait for the estate to show up... We do this by hanging a messenger
|
||||||
# hook which the DistributedEstateAI throws once it spawns.
|
# hook which the DistributedEstateAI throws once it spawns.
|
||||||
|
@ -238,9 +252,6 @@ class LoadEstateFSM(FSM):
|
||||||
self.estate = estate
|
self.estate = estate
|
||||||
estate.pets = []
|
estate.pets = []
|
||||||
|
|
||||||
self.estate.toons = self.toonIds
|
|
||||||
self.estate.updateToons()
|
|
||||||
|
|
||||||
# Gotcha! Now we need to load houses:
|
# Gotcha! Now we need to load houses:
|
||||||
self.demand('LoadHouses')
|
self.demand('LoadHouses')
|
||||||
|
|
||||||
|
@ -312,6 +323,7 @@ class EstateManagerAI(DistributedObjectAI):
|
||||||
self.estate2toons = {}
|
self.estate2toons = {}
|
||||||
self.toon2estate = {}
|
self.toon2estate = {}
|
||||||
self.estate2timeout = {}
|
self.estate2timeout = {}
|
||||||
|
self.zoneId2owner = {}
|
||||||
|
|
||||||
def getEstateZone(self, avId):
|
def getEstateZone(self, avId):
|
||||||
senderId = self.air.getAvatarIdFromSender()
|
senderId = self.air.getAvatarIdFromSender()
|
||||||
|
@ -375,11 +387,12 @@ class EstateManagerAI(DistributedObjectAI):
|
||||||
|
|
||||||
# And I guess we won't need our zoneId anymore...
|
# And I guess we won't need our zoneId anymore...
|
||||||
self.air.deallocateZone(zoneId)
|
self.air.deallocateZone(zoneId)
|
||||||
|
del self.zoneId2owner[zoneId]
|
||||||
|
|
||||||
toon.loadEstateFSM = None
|
toon.loadEstateFSM = None
|
||||||
|
|
||||||
self.acceptOnce(self.air.getAvatarExitEvent(toon.doId), self._unloadEstate, extraArgs=[toon])
|
self.acceptOnce(self.air.getAvatarExitEvent(toon.doId), self._unloadEstate, extraArgs=[toon])
|
||||||
|
self.zoneId2owner[zoneId] = avId
|
||||||
toon.loadEstateFSM = LoadEstateFSM(self, estateLoaded)
|
toon.loadEstateFSM = LoadEstateFSM(self, estateLoaded)
|
||||||
toon.loadEstateFSM.start(accId, zoneId)
|
toon.loadEstateFSM.start(accId, zoneId)
|
||||||
|
|
||||||
|
@ -443,6 +456,7 @@ class EstateManagerAI(DistributedObjectAI):
|
||||||
|
|
||||||
# Free estate's zone:
|
# Free estate's zone:
|
||||||
self.air.deallocateZone(estate.zoneId)
|
self.air.deallocateZone(estate.zoneId)
|
||||||
|
del self.zoneId2owner[estate.zoneId]
|
||||||
|
|
||||||
def _sendToonsToPlayground(self, estate, reason):
|
def _sendToonsToPlayground(self, estate, reason):
|
||||||
for toon in self.estate2toons.get(estate, []):
|
for toon in self.estate2toons.get(estate, []):
|
||||||
|
@ -451,10 +465,12 @@ class EstateManagerAI(DistributedObjectAI):
|
||||||
|
|
||||||
def _mapToEstate(self, toon, estate):
|
def _mapToEstate(self, toon, estate):
|
||||||
self._unmapFromEstate(toon)
|
self._unmapFromEstate(toon)
|
||||||
|
|
||||||
self.estate2toons.setdefault(estate, []).append(toon)
|
self.estate2toons.setdefault(estate, []).append(toon)
|
||||||
self.toon2estate[toon] = estate
|
self.toon2estate[toon] = estate
|
||||||
|
|
||||||
|
if hasattr(toon, 'enterEstate'):
|
||||||
|
toon.enterEstate(estate.owner.doId, estate.zoneId)
|
||||||
|
|
||||||
def _unmapFromEstate(self, toon):
|
def _unmapFromEstate(self, toon):
|
||||||
estate = self.toon2estate.get(toon)
|
estate = self.toon2estate.get(toon)
|
||||||
if not estate: return
|
if not estate: return
|
||||||
|
@ -464,9 +480,19 @@ class EstateManagerAI(DistributedObjectAI):
|
||||||
self.estate2toons[estate].remove(toon)
|
self.estate2toons[estate].remove(toon)
|
||||||
except (KeyError, ValueError):
|
except (KeyError, ValueError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
if hasattr(toon, 'exitEstate'):
|
||||||
|
toon.exitEstate()
|
||||||
|
|
||||||
def _lookupEstate(self, toon):
|
def _lookupEstate(self, toon):
|
||||||
return self.toon2estate.get(toon)
|
return self.toon2estate.get(toon)
|
||||||
|
|
||||||
def getOwnerFromZone(self, avId):
|
def getOwnerFromZone(self, zoneId):
|
||||||
return False
|
return self.zoneId2owner.get(zoneId, 0)
|
||||||
|
|
||||||
|
def getEstateZones(self, ownerId):
|
||||||
|
estate = self._lookupEstate(self.air.doId2do.get(ownerId))
|
||||||
|
if estate:
|
||||||
|
return [estate.zoneId]
|
||||||
|
|
||||||
|
return []
|
||||||
|
|
|
@ -2942,8 +2942,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
|
||||||
taskMgr.add(self._moveSphere, self._getMoveSphereTaskName(), priority=OTPGlobals.AICollMovePriority)
|
taskMgr.add(self._moveSphere, self._getMoveSphereTaskName(), priority=OTPGlobals.AICollMovePriority)
|
||||||
self.inEstate = 1
|
self.inEstate = 1
|
||||||
self.estateOwnerId = ownerId
|
self.estateOwnerId = ownerId
|
||||||
self.estateZones = simbase.air.estateMgr.getEstateZones(ownerId)
|
self.estateZones = [zoneId]
|
||||||
self.estateHouseZones = simbase.air.estateMgr.getEstateHouseZones(ownerId)
|
|
||||||
self.enterPetLook()
|
self.enterPetLook()
|
||||||
|
|
||||||
def _getPetLookerBodyNode(self):
|
def _getPetLookerBodyNode(self):
|
||||||
|
@ -2967,7 +2966,6 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
|
||||||
self.collNodePath.removeNode()
|
self.collNodePath.removeNode()
|
||||||
del self.collNodePath
|
del self.collNodePath
|
||||||
del self.estateOwnerId
|
del self.estateOwnerId
|
||||||
del self.estateHouseZones
|
|
||||||
del self.inEstate
|
del self.inEstate
|
||||||
self._wasInEstate = 1
|
self._wasInEstate = 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue