Post by yungjabo on Jul 4, 2024 13:39:02 GMT -5
I want to get free areas in the game to move families into them. Which command can do this through the game files?
import sims4.commands
import zone
from date_and_time import DateAndTime
from ui.ui_dialog_notification import UiDialogNotification
from sims4.localization import LocalizationHelperTuning
from injector import inject_to
from statistics.trait_statistic_tracker import TraitStatisticTracker
import services
from situations.complex.eviction_situation import EvictionSituation
from time_service import TimeService
from functools import wraps
from world.lot import Lot
def move_household(_connection):
output = sims4.commands.CheatOutput(_connection)
try:
household_manager = services.household_manager()
households = household_manager.get_all()
zone_manager = services.get_zone_manager()
zones = zone_manager.get_all()
for household in households:
output(f"{household.name} - {household.household_net_worth(billable=False)}")
output(f"{zones}")
for zone in zones:
output(f"{zone}")
except BaseException as e:
output(f"Ошибка: {e}")
@sims4.commands.Command('hello_world', command_type=sims4.commands.CommandType.Live)
def myfirstscript(_connection=None):
output = sims4.commands.CheatOutput(_connection)
try:
output("Hello world!")
current_time = services.time_service().sim_now
current_day = current_time.day()
output(f"Текущий день: {current_day}")
move_household(_connection)
except BaseException as e:
output(f"Ошибка: {e}")
# CREDIT: LOT51
@inject_to(TraitStatisticTracker, 'on_day_end')
def lot51_on_loading_screen_lifted(original, self, *args, **kwargs):
result = original(self, *args, **kwargs)
try:
date_and_time = DateAndTime()
current_day = date_and_time.day()
title = LocalizationHelperTuning.get_raw_text("Injection was successful!")
text = LocalizationHelperTuning.get_raw_text(f"Current day is {current_day}.")
dialog = UiDialogNotification.TunableFactory().default(
None,
title=lambda *args, **kwargs: title,
text=lambda *args, **kwargs: text,
)
dialog.show_dialog()
except BaseException as e:
pass
return result
zones = zone_manager.get_all()
As I understand it, zone_manager.get_all() outputs only the active area with my sim