def insert_objects(self): '''Insert any objects you want to be present in the zone into the database in this call. This gets called exactly once per database. If you change something here and want it to appear in the zone's database, you will need to clear the database first. Deleting the "Loading Complete" object will only cause duplicates. Do not do this. ''' # Place 10 chickens randomly: for i in xrange(10): obj = ScriptedObject() obj.name = "Chicken #%d" % i obj.resource = 'chicken' obj.loc = IntVector(x=randloc(), y=randloc(), z=randloc()) obj.rot = FloatVector(x=randrot(), y=randrot(), z=randrot()) obj.scale = FloatVector(x=randscale(), y=randscale(), z=randscale()) obj.vel = FloatVector(x=0, y=0, z=0) obj.states.extend(['alive', 'whole', 'clickable']) obj.scripts = ['games.objects.chicken'] obj.save() print [o.name for o in Object.objects()]
def create(cls): obj = ScriptedObject() obj.name = "Linnea" obj.resource = 'girl' obj.loc = IntVector(x=0, y=0, z=0) obj.rot = FloatVector(x=0, y=0, z=0) obj.scale = FloatVector(x=1, y=1, z=1) obj.vel = FloatVector(x=0, y=0, z=0) obj.states.extend(['alive', 'whole', 'clickable']) obj.scripts = ['games.objects.chatbot'] obj.save() return obj
def create(cls, number=0): obj = ScriptedObject() obj.name = "Chicken #%d" % number obj.resource = 'chicken' obj.loc = IntVector(x=randloc(), y=randloc(), z=randloc()) obj.rot = FloatVector(x=randrot(), y=randrot(), z=randrot()) obj.scale = FloatVector(x=randscale(), y=randscale(), z=randscale()) obj.vel = FloatVector(x=0, y=0, z=0) obj.states.extend(['alive', 'whole', 'clickable']) obj.scripts = ['games.objects.chicken'] obj.save() return obj