Post by laughingdead on Nov 6, 2020 19:23:06 GMT -5
Ok I'm hoping someone might know this. Normally I just figure it out. Can someone tell me if it's normal for debug teleport to take 10 to 15 seconds to complete? I hate it its poo so I coded my own and that takes the same amount of time lol. It does however allow you to teleport non instanced sims and up to 50 at a time. I tested with 1 to about 5 or 6 and each time it takes me 10 or 15 seconds for the sim picker to even pop up! So I'm guesing here that something between the tuning menu option and the class call is a bottleneck... Below is the tuning XML and py code for reference...
The imported stuff I wrote works just fine elsewhere like the dialog, error trap etc. No lag. And I notice other mods that impliment a class call in the tuning don't lag either, just teleport and my custom teleport. Makes no sense really...
<?xml version="1.0" encoding="utf-8"?>
<I c="MassTeleport" i="interaction" m="ld_mass_teleport" n="ldDebug_Teleport" s="16832140005188439260">
<V n="_icon" t="resource_key">
<U n="resource_key">
<T n="key" p="InGame\UI\Icons\InteractionQueue\IconQueueGoHere.png">2f7d0004:00000000:97d318ad9e4da2b3</T>
</U>
</V>
<T n="_multi_surface">False</T>
<V n="_saveable" t="enabled" />
<T n="allow_autonomous">False</T>
<T n="attention_cost">0.5</T>
<V n="content_score" t="disabled" />
<T n="debug">True</T>
<T n="display_name">0xF1583C86<!--Teleport Here--></T>
<U n="display_name_text_tokens">
<L n="tokens">
<V t="participant_type">
<U n="participant_type">
<V n="objects" t="from_participant">
<U n="from_participant">
<E n="participant">Actor</E>
</U>
</V>
</U>
</V>
<V t="participant_type">
<U n="participant_type">
<V n="objects" t="from_participant">
<U n="from_participant">
<E n="participant">Object</E>
</U>
</V>
</U>
</V>
</L>
</U>
<L n="interaction_category_tags">
<E>Interaction_Super</E>
<E>Interaction_All</E>
</L>
<T n="pie_menu_priority">10</T>
<E n="scoring_priority">NORMAL</E>
<T n="subaction_selection_weight">1</T>
<V n="super_affordance_compatibility" t="literal">
<U n="literal">
<V n="default_inclusion" t="exclude_all" />
</U>
</V>
<E n="target_type">OBJECT</E>
<L n="test_globals" />
<T n="time_overhead">0</T>
<U n="visual_type_override_data">
<T n="icon" p="InGame\UI\Icons\InteractionQueue\IconQueueWalking.png">2f7d0004:00000000:7c3ee3d732a8ea1c</T>
</U>
</I>
import random
import placement
import services
from ld_dialog import default_dialog
from objects import ALL_HIDDEN_REASONS, ALL_HIDDEN_REASONS_EXCEPT_UNINITIALIZED, HiddenReasonFlag
from routing import SurfaceIdentifier, SurfaceType
from sims.sim_spawner import SimSpawner
from sims4.math import Location, Transform, Quaternion, Vector3
from objects.terrain import TerrainSuperInteraction
from sims4.utils import classproperty, constproperty
from ld_debug import ld_notice, error_trap
from world.spawn_point import SpawnPointOption
class MassTeleport(TerrainSuperInteraction):
_teleporting = True
def __init__(self, *args, **kwargs):
(super().__init__)(*args, **kwargs)
self.dest_goals = []
def _run_interaction_gen(self, timeline):
def teleport_callback(dialog):
if not dialog.accepted:
return
try:
result_tags = dialog.get_result_tags()
for tags in dialog.get_result_tags():
sim_info = services.sim_info_manager().get(tags)
sim = sim_info.get_sim_instance()
translation = self.target.transform.translation
orientation = self.target.transform.orientation
level = self.target.level
pos = Vector3(translation.x + random.uniform(-2.0, 2.0), translation.y, translation.z + random.uniform(-2.0, 2.0))
zone_id = services.current_zone_id()
routing_surface = SurfaceIdentifier(zone_id, level, SurfaceType.SURFACETYPE_WORLD)
sim_location = Location(Transform(pos, orientation), routing_surface)
if sim_info.is_instanced():
sim = sim_info.get_sim_instance()
sim.destroy()
SimSpawner.spawn_sim(sim_info, sim_location=sim_location, from_load=True,
spawn_point_option=(SpawnPointOption.SPAWN_SAME_POINT))
sim = sim_info.get_sim_instance(allow_hidden_flags=ALL_HIDDEN_REASONS)
sim.location = sim_location
else:
sim = sim_info.get_sim_instance(allow_hidden_flags=ALL_HIDDEN_REASONS_EXCEPT_UNINITIALIZED)
if sim is None:
SimSpawner.spawn_sim(sim_info, sim_location=sim_location, from_load=True,
spawn_point_option=(SpawnPointOption.SPAWN_SAME_POINT))
sim = sim_info.get_sim_instance(allow_hidden_flags=ALL_HIDDEN_REASONS)
sim.location = sim_location
if sim.has_hidden_flags(HiddenReasonFlag.RABBIT_HOLE):
sim.show(HiddenReasonFlag.RABBIT_HOLE)
sim.location = sim_location
#sim.routing_component.on_slot = None
#sim.refresh_los_constraint()
except BaseException as e:
error_trap(e)
default_dialog("Mass Teleport", "Pick up to 50 Sims to Teleport", 50, True, teleport_callback)
@classproperty
def is_teleport_style_injection_allowed(cls):
return False
@constproperty
def should_perform_routing_los_check():
return False
The imported stuff I wrote works just fine elsewhere like the dialog, error trap etc. No lag. And I notice other mods that impliment a class call in the tuning don't lag either, just teleport and my custom teleport. Makes no sense really...