cyphesis/rulesets/deeds/world/objects/undead/Skeleton.py
Erik Ogenvik 39ef952b38 Don't change status too early.
Doing it too early will trigger a deletion of the skeleton, which makes
the bones creation ops fail since the entity has been deleted.
2015-07-13 22:16:50 +02:00

22 lines
963 B
Python

#This file is distributed under the terms of the GNU General Public license.
#Copyright (C) 1999 Al Riddoch (See the file COPYING for details).
from atlas import *
from common import log,const
from physics import Vector3D
from random import *
import server
class Skeleton(server.Thing):
def touch_operation(self, op):
retops = Oplist()
if self.status<0: return
newloc=self.location.copy()
newloc.velocity=Vector3D()
retops = retops + Operation("move", Entity(self.id, location=newloc.copy(), mode="collapsed"), to=self)
for item in ['skull', 'ribcage', 'femur', 'pelvis', 'tibia']:
newloc.coordinates = newloc.coordinates + Vector3D(uniform(-1,1), uniform(-1,1), uniform(-1,1))
retops = retops + Operation("create", Entity(name=item,parents=[item],location=newloc.copy()), to=self)
retops = retops + Operation("set", Entity(self.id, status=-1), to=self)
return retops