Example #1
0
def spawn_entities(spawndict):
    """
    Called with a dictionary with at least two keys: 'mapname'
    and 'entities'
    
    Parse the 'entities' string, and for each entity not inhibited 
    for deathmatch, create an engine entity, set its attributes, 
    and run the spawn function for its class.  
    """
    ents = parse_entity_string(spawndict['entities'])
    
    # the first gob of info is for the world (which already exists)
    config_entity(engine.world, ents[0])
    
    # the rest of the data is for new entities
    for e in ents[1:]:
        if e.get('spawnflags', 0) & 2048 != 0:  # flagged as non-deathmatch only
            continue  
        config_entity(engine.spawn(), e)            
Example #2
0
 def spawn(self):
     ent = engine.spawn()
     for f in game_entity_fields:  
         setattr(ent, f[0], f[1])
     return ent