You are viewing a potentially older version of this package. View all versions.
sighsorry-FearNoSpear-1.0.2 icon

FearNoSpear

Protects thrown spears from disappearing on long throws and adds a `!myspear` chat command to pin tracked spears on the map. Also removes deathpins when tombstones are recovered.

Date uploaded 2 months ago
Version 1.0.2
Download link sighsorry-FearNoSpear-1.0.2.zip
Downloads 126
Dependency string sighsorry-FearNoSpear-1.0.2

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2333 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured with the correct entry point for mods and preferred defaults for the community.

Preferred version: 5.4.2333

README

FearNoSpear

FearNoSpear prevents thrown spears from disappearing on long throws, zone unloads, and network cleanup. It also adds a chat locator for tracked spears and can clean up vanilla death pins when tombstones are recovered.

Features

  • Protects recoverable thrown spear projectiles.
  • Extends tracked spear projectile TTL to a fixed 60 seconds.
  • Rescues the original spear before TTL expiry or unexpected projectile cleanup.
  • Uses Valheim's own Projectile.SpawnOnHit path first, then verifies that a matching spear drop exists.
  • Falls back to ItemDrop.DropItem only when the native path cannot produce a matching drop.
  • Uses owner-only rescue, a ZDO claim flag, and a 4 meter duplicate check to reduce multiplayer duplicate-spawn risk.
  • Adds a configurable chat command, default !myspear, that pins up to 5 known tracked spear locations.
  • Optionally removes vanilla death pins when the local player's tombstone is recovered, and removes death pins from deaths that create no tombstone.

Chat Locator

Type the configured command in normal in-game chat:

!myspear

The command is consumed locally, so it is not sent as public chat. It creates saved minimap pins for known tracked spear locations and opens the map. A single result is named Spear!; multiple results are named Spear 1, Spear 2, and so on.

Tracked spear positions are updated while the spear is flying and when a matching tracked spear drop is observed. The locator keeps a session-only registry and uses it to answer later chat requests.

The locator is not a generic spear scanner. It only tracks spears observed by this mod. Loaded ItemDrop scanning only refreshes spears that already have a tracked locator record.

When a tracked spear is picked up, locator pins created by the current session are removed and the matching local/server session records are cleared.

Death Pin Cleanup

CleanDeathPins removes the vanilla Death map pin when the local player's tombstone is recovered. It also removes the death pin immediately if the death created no tombstone, such as when there was nothing to drop.

The cleanup only targets saved minimap pins of type Death near the matching death or tombstone position.

Config

Available config options:

[General]
Lock Configuration = On
Enabled = true
ChatCommand = !myspear
CleanDeathPins = true

[Rescue]
TTLRescueWindowSeconds = 1.0
AllowLastKnownOwnerIfZNetViewInvalid = true
LastKnownOwnerGraceSeconds = 2

General

Lock Configuration
Locks synchronized settings to the authoritative config.

Enabled
Master switch for spear tracking, rescue, locator, and death pin cleanup.

ChatCommand
Chat command used to pin known tracked spear locations. The comparison is case-insensitive. Leave empty to disable the chat command.

CleanDeathPins
Enables death pin cleanup for recovered tombstones and deaths that create no tombstone.

Rescue

TTLRescueWindowSeconds
How close to projectile TTL expiry the mod should rescue a still-airborne tracked spear. 1.0 means the final second of projectile lifetime.

AllowLastKnownOwnerIfZNetViewInvalid
Allows the most recent known owner to rescue if the projectile ZNetView has already become invalid.

LastKnownOwnerGraceSeconds
Maximum age, in seconds, for the last-known owner fallback.

Fixed Internal Defaults

These are intentionally not exposed as config options:

  • Minimum tracked spear projectile TTL: 60 seconds.
  • Locator pins per command: 5.
  • Rescue before TTL expiry: enabled.
  • Rescue on unexpected destroy: enabled.
  • ItemDrop fallback: enabled.
  • Owner-only rescue: enabled.
  • ZDO rescue claim flag: enabled.
  • Nearby duplicate cleanup radius: 4 meters.
  • Verbose debug logging: disabled.

Github

https://github.com/sighsorry1029/FearNoSpear

CHANGELOG

Version Update Notes
1.0.6 - Removed destructive same-item duplicate cleanup, simplified rescue and locator state, hardened locator RPC validation, reduced repeated ItemDrop scans, and made no-tombstone death-pin cleanup wait for delayed tombstone creation.
1.0.5 - Reduced locator state and RPC payload complexity by removing stale item-key record storage and inlining the local spear record store.
1.0.4 - Simplified the spear locator around thrower-tagged world ZDO spear drops, fixed thrown spears being skipped when pickedUp is set, and removed stale projectile-location fallback records.
1.0.3 - Use thrower metadata and server-side ZDO scanning as the primary !myspear locator path, with tracked records kept as fallback.
1.0.2 - Fixed tombstone deathpin cleanup patch failing to load on Valheim builds where TombStone.Setup uses ownerUID as the parameter name.
1.0.1 - Deathpin can be removed if tombstone is recovered.
1.0.0 - Initial Release