@Command( shortDescription = "Land without breaking a leg", runOnServer = true, requiredPermission = PermissionManager.CHEAT_PERMISSION) public String softLanding(@Sender EntityRef client) { ClientComponent clientComp = client.getComponent(ClientComponent.class); HealthComponent health = clientComp.character.getComponent(HealthComponent.class); if (health != null) { health.fallingDamageSpeedThreshold = 85f; health.excessSpeedDamageMultiplier = 2f; clientComp.character.saveComponent(health); return "Soft landing mode activated"; } return ""; }
@Command( shortDescription = "Restore default collision damage values", runOnServer = true, requiredPermission = PermissionManager.CHEAT_PERMISSION) public String restoreCollisionDamage(@Sender EntityRef client) { ClientComponent clientComp = client.getComponent(ClientComponent.class); Optional<Prefab> prefab = Assets.get(new ResourceUrn("engine:player"), Prefab.class); HealthComponent healthDefault = prefab.get().getComponent(HealthComponent.class); HealthComponent health = clientComp.character.getComponent(HealthComponent.class); if (health != null && healthDefault != null) { health.fallingDamageSpeedThreshold = healthDefault.fallingDamageSpeedThreshold; health.horizontalDamageSpeedThreshold = healthDefault.horizontalDamageSpeedThreshold; health.excessSpeedDamageMultiplier = healthDefault.excessSpeedDamageMultiplier; clientComp.character.saveComponent(health); } return "Normal collision damage values restored"; }