# Fix Interactable Points

This guide explains how to use the `FixShellOffsets` configuration option to fix interactable points that are incorrectly positioned on the Z-axis (vertical axis) in shell properties.

## What is FixShellOffsets?

{% hint style="danger" %}

## Create a database backup before running the command!!!!

{% endhint %}

The `FixShellOffsets` feature is a migration tool designed to fix interactable points (such as inventory, wardrobe, etc.) that are positioned incorrectly on the Z-axis in shell properties. This issue can occur when upgrading from older versions of nolag\_properties to version 2.4.0 or later.

## When to Enable FixShellOffsets

Enable this feature if:

* You are upgrading from an older version to 2.4.0+ — this is a one-time migration that should be run after updating.
* Interactable points are positioned incorrectly — if you notice that interactable points (inventory, wardrobe, etc.) appear higher or lower than they should be in shell properties.
* Points are floating or underground — when interactable points are not aligned with the shell's interior floor level.

## Configuration

Enable the feature in your `config.lua`:

{% code title="config.lua" %}

```lua
FixShellOffsets = true, -- Enable the shell offsets fix
```

{% endcode %}

{% hint style="info" %}
Important: After running the fix command, you can disable this setting again as it's only needed for the one-time migration.
{% endhint %}

## How to Use

{% stepper %}
{% step %}

### Enable the Configuration

Make sure `FixShellOffsets` is set to `true` in your `config.lua` file.
{% endstep %}

{% step %}

### Restart the Resource

Restart the `nolag_properties` resource to load the configuration:

{% code title="Server console" %}

```
restart nolag_properties
```

{% endcode %}
{% endstep %}

{% step %}

### Run the Fix Command In-Game

Join your server and run the command in-game (chat or F8 console):

{% code title="In-game command" %}

```
/getShellOffsetsFixed
```

{% endcode %}

This command will:

* Spawn all shell types at the configured Z-level (`Config.ShellZLevel`)
* Calculate the offset difference between shells spawned with and without offset
* Automatically send the calculated offsets to the server
* Fix all shell properties with incorrect interactable point positions

Note: The command will spawn shells temporarily to calculate offsets. This may cause brief visual effects in-game.
{% endstep %}

{% step %}

### Wait for Completion

The command will process all shell properties and fix their interactable points. You'll see progress messages in the server console:

{% code title="Server console output" %}

```
Fixing offsets for all properties
Updated offset for point X in property Y with coords {...}
Finished fixing offsets for all properties
```

{% endcode %}

You'll also receive an in-game notification when the process completes.
{% endstep %}

{% step %}

### Disable the Feature (Optional)

After successfully running the fix, you can disable `FixShellOffsets` in your config:

{% code title="config.lua" %}

```lua
FixShellOffsets = false, -- Disable after migration is complete
```

{% endcode %}
{% endstep %}
{% endstepper %}

## What Gets Fixed

The fix command:

* Processes all properties with type `shell`
* Updates interactable points that have `coords` stored (old format)
* Converts them to use `offset` format (new format)
* Applies the correct shell offset to ensure points are positioned correctly on the Z-axis
* Saves the updated property metadata to the database

## Troubleshooting

<details>

<summary>Error: "Shell offset data not found for shell [shellType]"</summary>

If you encounter this error, it means the offset calculation failed for a specific shell type. This can happen if:

1. The shell model cannot be loaded
2. The shell hash is invalid or missing

To fix this:

1. Verify the shell exists in your `ShellsData` configuration
2. Check that the shell's hash/model is valid
3. Ensure the shell model is available in your game files
4. Run `/getShellOffsetsFixed` again - the command will skip shells that fail to load and continue with others

The command automatically calculates offsets for all available shells and only processes properties with successfully calculated offsets.

</details>

<details>

<summary>Points Still Not Fixed</summary>

If points are still incorrectly positioned after running the fix:

1. Verify that the property type is `shell` (not `ipl` or `mlo`).
2. Check that the interactable points have the `type == 'inside'` in the configuration.
3. Ensure the shell was successfully calculated during the offset finder process (check server console for errors).
4. Verify that the points had `coords` stored (old format) - if they already use `offset` format, they won't be modified.
5. Check server console for any error messages during the fix process.

</details>

## Related Commands

* `/getShellOffsetsFixed` - In-game command to calculate shell offsets and automatically fix all shell properties (only available when `FixShellOffsets` is enabled)

## See Also

* [Physical Keys Setup Guide](https://docs.teamsgg.dev/paid-scripts/properties/guides/broken-reference)
