45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
import unreal
|
|
|
|
|
|
def load(path):
|
|
asset = unreal.EditorAssetLibrary.load_asset(path)
|
|
if not asset:
|
|
raise RuntimeError(f"Could not load {path}")
|
|
return asset
|
|
|
|
|
|
def mapping_found(context, action, key_name):
|
|
mapping_data = context.get_editor_property("default_key_mappings")
|
|
for mapping in list(mapping_data.get_editor_property("mappings")):
|
|
mapping_key = mapping.get_editor_property("key")
|
|
if (
|
|
mapping.get_editor_property("action") == action
|
|
and str(mapping_key.get_editor_property("key_name")) == key_name
|
|
):
|
|
return True
|
|
return False
|
|
|
|
|
|
def main():
|
|
action = load("/Game/Input/Actions/IA_Interact")
|
|
context = load("/Game/Input/IMC_Default")
|
|
character_bp = load("/Game/ThirdPerson/Blueprints/BP_ThirdPersonCharacter")
|
|
character_cdo = unreal.get_default_object(character_bp.generated_class())
|
|
|
|
missing = []
|
|
for key_name in ["E", "Gamepad_FaceButton_Left"]:
|
|
if not mapping_found(context, action, key_name):
|
|
missing.append(f"missing mapping {key_name}")
|
|
|
|
assigned_action = character_cdo.get_editor_property("InteractAction")
|
|
if assigned_action != action:
|
|
missing.append("BP_ThirdPersonCharacter InteractAction is not IA_Interact")
|
|
|
|
if missing:
|
|
raise RuntimeError("Interact input verification failed: " + "; ".join(missing))
|
|
|
|
unreal.log("Agrarian interact input verification complete.")
|
|
|
|
|
|
main()
|