def listener_on_entity_spawned(base_entity): if base_entity.classname not in valid_npc_classnames: return entity = Entity(base_entity.index) entity.spawn_flags |= 512 entity.set_key_value_int('sleepstate', 0) entity.call_input('SetRelationship', 'player D_HT 99')
def on_entity_spawned(base_entity): """Remove hostage entities and disable map entity functions as soon as they spawn.""" if base_entity.classname == 'hostage_entity': base_entity.remove() elif base_entity.classname.startswith('func_'): with suppress(ValueError): entity = Entity(base_entity.index) entity.call_input('Disable')
def on_entity_spawned(base_entity): """Remove forbidden entities when they have spawned.""" if base_entity.classname in forbidden_entities: base_entity.remove() # Disable map functions as well elif base_entity.classname in map_functions: entity = Entity(base_entity.index) entity.call_input('Disable')
def level_up(player): player.client_command('play */source-python/wcs/levelup.mp3') pointer = player.give_named_item('env_smokestack', 0, None, False) entity = Entity(index_from_pointer(pointer)) for output in ('basespread 10', 'spreadspeed 60', 'initial 0', 'speed 105', 'rate 50', 'startsize 7', 'endsize 2', 'twist 0', 'jetlength 100', 'angles 0 0 0', 'rendermode 18', 'renderamt 100', 'rendercolor 255 255 3', 'SmokeMaterial effects/yellowflare.vmt'): entity.add_output(output) entity.call_input('TurnOn') entity.set_parent(player.pointer, -1) tick_delays.delay(2, entity.call_input, 'TurnOff') tick_delays.delay(2.1, entity.call_input, 'Kill')
def _remove_model(userid): for inthandle in _game_models: if userid == _game_models[inthandle]: try: index = index_from_inthandle(inthandle) except ValueError: pass else: entity = Entity(index) entity.clear_parent() entity.call_input('FireUser1', '1') finally: del _game_models[inthandle] return inthandle return None
def level_up(player): """Display the level up effect on a player.""" pointer = player.give_named_item('env_smokestack', 0, None, False) entity = Entity(index_from_pointer(pointer)) entity.add_output('basespread 10') entity.add_output('spreadspeed 60') entity.add_output('initial 0') entity.add_output('speed 105') entity.add_output('rate 50') entity.add_output('startsize 7') entity.add_output('endsize 2') entity.add_output('twist 0') entity.add_output('jetlength 100') entity.add_output('angles 0 0 0') entity.add_output('rendermode 18') entity.add_output('renderamt 100') entity.add_output('rendercolor 255 255 3') entity.add_output('SmokeMaterial effects/yellowflare.vmt') entity.call_input('TurnOn') entity.set_parent(player.pointer, -1) tick_delays.delay(2, entity.call_input, 'TurnOff') tick_delays.delay(2.1, entity.call_input, 'Kill')