spellbook: ToggleSleep magic word
This commit is contained in:
parent
01751ad10e
commit
48d88e1afe
5 changed files with 22 additions and 0 deletions
etc
otp/avatar
toontown
|
@ -618,6 +618,7 @@ dclass DistributedToon : DistributedPlayer {
|
|||
setNeverStartedPartyRefunded(uint64, int8, uint16) ownrecv;
|
||||
setDISLname(string) ram;
|
||||
setDISLid(uint32) ram db airecv;
|
||||
toggleSleep() ownrecv;
|
||||
};
|
||||
|
||||
dclass DistributedCCharBase : DistributedObject {
|
||||
|
|
|
@ -61,6 +61,7 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
|
|||
self.soundRun = None
|
||||
self.soundWalk = None
|
||||
self.sleepFlag = 0
|
||||
self.noSleep = 0
|
||||
self.isDisguised = 0
|
||||
self.movingFlag = 0
|
||||
self.swimmingFlag = 0
|
||||
|
@ -984,6 +985,8 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
|
|||
return
|
||||
|
||||
def gotoSleep(self):
|
||||
if self.noSleep:
|
||||
return
|
||||
if not self.sleepFlag:
|
||||
self.b_setAnimState('Sleep', self.animMultiplier)
|
||||
self.sleepFlag = 1
|
||||
|
|
|
@ -705,6 +705,15 @@ class Teleport(MagicWord):
|
|||
|
||||
return f"Successfully teleporting {toon.getName()} to zone {zone}."
|
||||
|
||||
class ToggleSleep(MagicWord):
|
||||
aliases = ["sleep", "nosleep", "neversleep", "togglesleeping", "insomnia"]
|
||||
desc = "Toggles sleeping for the target."
|
||||
execLocation = MagicWordConfig.EXEC_LOC_SERVER
|
||||
|
||||
def handleWord(self, invoker, avId, toon, *args):
|
||||
toon.d_toggleSleep()
|
||||
return f"Toggled sleeping for {toon.getName()}."
|
||||
|
||||
class Fireworks(MagicWord):
|
||||
aliases = ["firework"]
|
||||
desc = "Starts a firework show."
|
||||
|
|
|
@ -2589,3 +2589,9 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute
|
|||
|
||||
def getTransitioning(self):
|
||||
return self.transitioning
|
||||
|
||||
def toggleSleep(self):
|
||||
if base.localAvatar.noSleep:
|
||||
base.localAvatar.noSleep = 0
|
||||
else:
|
||||
base.localAvatar.noSleep = 1
|
|
@ -4129,6 +4129,9 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
|
|||
zoneId])
|
||||
self.air.send(dg)
|
||||
|
||||
def d_toggleSleep(self):
|
||||
self.sendUpdate('toggleSleep', [])
|
||||
|
||||
@staticmethod
|
||||
def staticGetLogicalZoneChangeAllEvent():
|
||||
return 'DOLogicalChangeZone-all'
|
||||
|
|
Loading…
Reference in a new issue