Define baseline running speed
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import unreal
|
||||
|
||||
|
||||
MOVEMENT_DEFAULTS = {
|
||||
"WalkSpeed": 140.0,
|
||||
"SprintSpeed": 550.0,
|
||||
"SprintStaminaCostPerSecond": 28.0,
|
||||
"MinSprintStamina": 5.0,
|
||||
}
|
||||
|
||||
|
||||
def load(path):
|
||||
asset = unreal.EditorAssetLibrary.load_asset(path)
|
||||
if not asset:
|
||||
raise RuntimeError(f"Could not load {path}")
|
||||
return asset
|
||||
|
||||
|
||||
def main():
|
||||
character_bp = load("/Game/ThirdPerson/Blueprints/BP_ThirdPersonCharacter")
|
||||
character_cdo = unreal.get_default_object(character_bp.generated_class())
|
||||
|
||||
for property_name, value in MOVEMENT_DEFAULTS.items():
|
||||
character_cdo.set_editor_property(property_name, value)
|
||||
unreal.log(f"Set {property_name} to {value}")
|
||||
|
||||
unreal.EditorAssetLibrary.save_loaded_asset(character_bp)
|
||||
unreal.log("Agrarian movement baseline setup complete.")
|
||||
|
||||
|
||||
main()
|
||||
@@ -0,0 +1,36 @@
|
||||
import math
|
||||
import unreal
|
||||
|
||||
|
||||
MOVEMENT_DEFAULTS = {
|
||||
"WalkSpeed": 140.0,
|
||||
"SprintSpeed": 550.0,
|
||||
"SprintStaminaCostPerSecond": 28.0,
|
||||
"MinSprintStamina": 5.0,
|
||||
}
|
||||
|
||||
|
||||
def load(path):
|
||||
asset = unreal.EditorAssetLibrary.load_asset(path)
|
||||
if not asset:
|
||||
raise RuntimeError(f"Could not load {path}")
|
||||
return asset
|
||||
|
||||
|
||||
def main():
|
||||
character_bp = load("/Game/ThirdPerson/Blueprints/BP_ThirdPersonCharacter")
|
||||
character_cdo = unreal.get_default_object(character_bp.generated_class())
|
||||
|
||||
mismatches = []
|
||||
for property_name, expected in MOVEMENT_DEFAULTS.items():
|
||||
actual = float(character_cdo.get_editor_property(property_name))
|
||||
if not math.isclose(actual, expected, rel_tol=0.0, abs_tol=0.01):
|
||||
mismatches.append(f"{property_name}: expected {expected}, got {actual}")
|
||||
|
||||
if mismatches:
|
||||
raise RuntimeError("Movement baseline verification failed: " + "; ".join(mismatches))
|
||||
|
||||
unreal.log("Agrarian movement baseline verification complete.")
|
||||
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user