Browse Source

fixed initial spawn not storing positional data

fixed places of death not registering correctly
added suicide not being eligible for returning to the grave command!
development
Christian Voigt 1 month ago
parent
commit
df64d4fafb
5 changed files with 43 additions and 15 deletions
  1. +9
    -3
      bot/modules/locations/actions/edit_location.py
  2. +15
    -8
      bot/modules/locations/commands/take_me_to_my_grave.py
  3. +1
    -1
      bot/modules/locations/templates/manage_locations_widget/view_create_new_control_send_data.html
  4. +15
    -2
      bot/modules/locations/triggers/player_died.py
  5. +3
    -1
      bot/modules/locations/triggers/playerspawn.py

+ 9
- 3
bot/modules/locations/actions/edit_location.py View File

@ -18,11 +18,16 @@ def main_function(module, event_data, dispatchers_steamid):
location_shape = event_data[1].get("location_shape", module.default_options.get("standard_location_shape", None))
location_types = event_data[1].get("location_type", [])
location_coordinates = event_data[1].get("location_coordinates", {})
location_teleport_entry = event_data[1].get("location_teleport_entry", {})
location_coordinates = event_data[1].get("coordinates", {})
location_teleport_entry = event_data[1].get("location_teleport_entry", {
'x': location_coordinates.get("x", '0'),
'y': "-1",
'z': location_coordinates.get("z", '0'),
})
location_dimensions = event_data[1].get("location_dimensions", {})
location_enabled = event_data[1].get("is_enabled", True)
last_changed = event_data[1].get("last_changed", False)
was_suicide = event_data[1].get("was_suicide", False)
if all([
location_name is not None and len(location_name) >= 3,
@ -48,7 +53,8 @@ def main_function(module, event_data, dispatchers_steamid):
"owner": str(location_owner),
"is_enabled": location_enabled,
"selected_by": [],
"last_changed": last_changed
"last_changed": last_changed,
"was_suicide": was_suicide
}
}
}


+ 15
- 8
bot/modules/locations/commands/take_me_to_my_grave.py View File

@ -21,14 +21,21 @@ def main_function(origin_module, module, regex_result):
)
if len(player_dict) >= 1 and len(location_dict) >= 1:
event_data = ['teleport_to_coordinates', {
'coordinates': {
"x": location_dict["coordinates"]["x"],
"y": location_dict["coordinates"]["y"],
"z": location_dict["coordinates"]["z"]
}
}]
module.trigger_action_hook(origin_module, event_data=event_data, dispatchers_steamid=steamid)
if location_dict.get("was_suicide") is True:
event_data = ['say_to_player', {
'steamid': steamid,
'message': '[FFFFFF]If you can suicide, then you can walk![-]'
}]
module.trigger_action_hook(chrani_bot.module_players, event_data=event_data)
else:
event_data = ['teleport_to_coordinates', {
'coordinates': {
"x": location_dict["coordinates"]["x"],
"y": location_dict["coordinates"]["y"],
"z": location_dict["coordinates"]["z"]
}
}]
module.trigger_action_hook(origin_module, event_data=event_data, dispatchers_steamid=steamid)
else:
event_data = ['say_to_player', {
'steamid': steamid,


+ 1
- 1
bot/modules/locations/templates/manage_locations_widget/view_create_new_control_send_data.html View File

@ -43,7 +43,7 @@
'location_identifier': location_identifier,
'location_shape': location_shape,
'location_type': checked_location_types,
'location_coordinates': location_coordinates,
'coordinates': location_coordinates,
'location_teleport_entry': location_teleport_entry,
'location_dimensions': location_dimensions,
'location_name': location_name,


+ 15
- 2
bot/modules/locations/triggers/player_died.py View File

@ -7,7 +7,14 @@ trigger_name = path.basename(path.abspath(__file__))[:-3]
def main_function(origin_module, module, regex_result):
player_name = regex_result.group("player_name")
valid_reasons_for_dying = [
'died', 'killed by \'{}\''.format(player_name)
]
command = regex_result.group("command")
if command not in valid_reasons_for_dying:
return
is_suicide = True if command == 'killed by \'{}\''.format(player_name) else False
active_dataset = chrani_bot.module_dom.get_active_dataset_identifier()
all_players_dict = (
@ -28,17 +35,23 @@ def main_function(origin_module, module, regex_result):
if steamid is None:
return
if command == 'died':
if command in valid_reasons_for_dying:
event_data = ['edit_location', {
'coordinates': {
"x": player_dict["pos"]["x"],
"y": player_dict["pos"]["y"],
"z": player_dict["pos"]["z"]
},
'location_teleport_entry': {
"x": player_dict["pos"]["x"],
"y": player_dict["pos"]["y"],
"z": player_dict["pos"]["z"]
},
'location_name': "Place of Death",
'action': 'edit',
'location_enabled': True,
'last_changed': servertime_player_died
'last_changed': servertime_player_died,
'was_suicide': is_suicide
}]
module.trigger_action_hook(origin_module, event_data=event_data, dispatchers_steamid=steamid)


+ 3
- 1
bot/modules/locations/triggers/playerspawn.py View File

@ -10,7 +10,9 @@ def main_function(origin_module, module, regex_result):
if command == "EnterMultiplayer":
location_name = "Initial Spawn"
location_type = "is_initial_spawn"
elif command == "JoinMultiplayer":
elif command in [
"JoinMultiplayer", "Died"
]:
location_name = "Last Spawn"
location_type = "is_last_spawn"
else:


Loading…
Cancel
Save