Post by marquillotuca89 on Apr 22, 2023 21:33:13 GMT -5
Hello modders!
So, Lot51 has helped a lot basically creating this script to inject tooltips to objects that have an specific affordance, paired with the correct tuning file works like a charm.
However, I want to use a list to be able to inject the interaction to specific objects. My attemps have led me to this
But it doesn't work, and I'm pretty sure it's because I don't know the game code very well (and my coding skills are -3 ahaha). Could somebody please help this soul?
Thanks in advance for any help you can provide.
So, Lot51 has helped a lot basically creating this script to inject tooltips to objects that have an specific affordance, paired with the correct tuning file works like a charm.
class TooltipInjector:
AFFORDANCE_TO_INJECT_BY = TunableReference(manager=services.get_instance_manager(Types.INTERACTION))
TOOLTIP_COMPONENT = TooltipComponent.TunableFactory()
@classmethod
def inject(cls, *args, **kwargs):
for obj in services.get_instance_manager(Types.OBJECT).get_ordered_types():
if hasattr(obj, '_super_affordances') and cls.AFFORDANCE_TO_INJECT_BY in obj._super_affordances:
obj._components = obj._components.clone_with_overrides(tooltip_component=cls.TOOLTIP_COMPONENT)
services.get_instance_manager(Types.OBJECT).add_on_load_complete(TooltipInjector.inject)
However, I want to use a list to be able to inject the interaction to specific objects. My attemps have led me to this
class TooltipInjector:
AFFORDANCE_TO_INJECT_BY = TunableList(tunable=Tunable(tunable_type=int, default=0))
TOOLTIP_COMPONENT = TooltipComponent.TunableFactory()
@classmethod
def inject(cls, *args, **kwargs):
for obj in services.get_instance_manager(Types.OBJECT).get_ordered_types():
for affordance in cls.AFFORDANCE_TO_INJECT_BY:
if hasattr(obj, '_super_affordances') and affordance in obj._super_affordances:
obj._components = obj._components.clone_with_overrides(tooltip_component=cls.TOOLTIP_COMPONENT)
services.get_instance_manager(Types.OBJECT).add_on_load_complete(TooltipInjector.inject)
But it doesn't work, and I'm pretty sure it's because I don't know the game code very well (and my coding skills are -3 ahaha). Could somebody please help this soul?
Thanks in advance for any help you can provide.