Attack hostile mobs
This commit is contained in:
1 parent
9c0db4e4b0
commit
0a499f901a
4 files changed
+165
-7
No files matched your search
+13
-1
@@ -683,6 +683,8 @@ def refresh_runtime(global_state, reload_managers=False):
|
||||
g = global_state
|
||||
connection = g.get('connection')
|
||||
previous_threat_monitor = g.get('threat_monitor')
|
||||
previous_job = g.get('job')
|
||||
previous_combat = getattr(previous_job, 'combat_states', None)
|
||||
|
||||
_remove_instance_listeners(connection, g.get('chat'))
|
||||
_remove_instance_listeners(connection, g.get('game'))
|
||||
@@ -715,6 +717,11 @@ def refresh_runtime(global_state, reload_managers=False):
|
||||
state_name = getattr(g.get('job'), 'state', None)
|
||||
state_name = getattr(state_name, '__name__', None)
|
||||
g.job = job.JobStates(g)
|
||||
if previous_combat is not None:
|
||||
for attribute in ('hostile_only', 'sleep_first'):
|
||||
if hasattr(previous_combat, attribute):
|
||||
setattr(g.job.combat_states, attribute,
|
||||
getattr(previous_combat, attribute))
|
||||
if state_name and state_name != 'idle':
|
||||
replacement_state = getattr(g.job, state_name, None)
|
||||
if replacement_state is not None:
|
||||
@@ -730,13 +737,18 @@ def refresh_runtime(global_state, reload_managers=False):
|
||||
'safe_sign', 'threats', 'tracked_hostile_ids',
|
||||
'tracked_hostile_positions', 'next_refuge_report_at',
|
||||
'next_refuge_eat_at', 'next_refuge_sleep_at',
|
||||
'resume_job_name', 'job_suspended'):
|
||||
'resume_job_name', 'job_suspended',
|
||||
'combat_response_active', 'combat_response_cancelled',
|
||||
'next_combat_scan_at'):
|
||||
if hasattr(previous_threat_monitor, attribute):
|
||||
setattr(threat_monitor, attribute,
|
||||
getattr(previous_threat_monitor, attribute))
|
||||
threat_monitor.state = getattr(
|
||||
threat_monitor, monitor_state, threat_monitor.watching)
|
||||
g.threat_monitor = threat_monitor
|
||||
if threat_monitor.combat_response_active:
|
||||
g.job.combat_states.allowed_target_ids = (
|
||||
threat_monitor.tracked_hostile_ids)
|
||||
g.commands = commands.Commands(g)
|
||||
if not reload_managers:
|
||||
g.mcdata = DataManager()
|
||||
|
||||
Reference in new issue
Block a user