mcmonkeyprojects / Sentinel

Combat NPCs for Spigot!
MIT License
168 stars 84 forks source link

NPC glitches on Paper #371

Closed SlimeDog closed 3 years ago

SlimeDog commented 3 years ago
>version
[07:18:09] [Server thread/INFO]: This server is running CraftBukkit version 3242-Spigot-6c1c1b2-d3cc412 (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT)
[07:18:09] [Server thread/INFO]: You are running the latest version
>version Citizens
[07:18:14] [Server thread/INFO]: Citizens version 2.0.28-SNAPSHOT (build 2382)
[07:18:14] [Server thread/INFO]: Website: http://www.citizensnpcs.co
[07:18:14] [Server thread/INFO]: Author: fullwall
>version Sentinel
[07:18:18] [Server thread/INFO]: Sentinel version 2.3.5-SNAPSHOT (build 432)
[07:18:18] [Server thread/INFO]: Author: mcmonkey
# Sentinel plugin configuration file
# Default settings for a new NPC
sentinel defaults:
    # Whether 'close quarters' NPCs should chase targets.
    close chase target: true
    # Whether 'ranged attack' NPCs should chase targets.
    ranged chase target: false
    # How much damage to do. -1 for calculated values.
    damage: -1
    # How much armor to have (percentage). -1 for calculated values.
    armor: -1
    # How much health to have.
    health: 20
    # Whether this NPC is invincible.
    invincible: false
    # Attack rate, in ticks.
    attack rate: 30
    # Heal rate, in ticks.
    heal rate: 100
    # Whether this NPC fights back.
    fightback: true
    # Whether this NPC needs ammo to fight with.
    needs ammo: false
    # Whether this NPC will avoid damaging non-targets.
    safe shot: true
    # Default respawn time, in ticks.
    respawn time: 100
    # Whether enemy mobs killed by this NPC should drop items.
    enemy drops: false
    # How long to target temporary enemies for, in ticks. 0 means never-forget. Default 6000 = 5 minutes.
    enemy target time: 6000
    # What movement (chase) speed should be used, as a multiple of the default speed.
    speed: 1.5
    # Whether to automatically switch to the most appropriate available weapon. (Bow at range, or sword up close).
    autoswitch: false
    # Accuracy offset, 0 means perfectly accurate, 5 means pretty inaccurate.
    accuracy: 0
    # "Realistic" logic, don't attack targets we can't see, if enabled.
    realistic: false
    # How far the NPC can reach.
    reach: 3
    # How far the NPC is willing to fire projectiles.
    projectile range: 100
    # How far the NPC should stay away from threats (listed by 'addavoid' command).
    avoid range: 10
    # Whether the NPC should run away when attacked.
    runaway: false
    # How far away the NPC will greet or warn players from.
    greet range: 10
    # How fast the NPC will greet or warn players, in ticks.
    greet rate: 100
    # How long (in ticks) it takes an NPC to react to sighting a new target. 0 = no delay.
    reaction slowdown: 0
    # Whether the NPC can be knocked back when hit. If set false, will try to force the NPC to remain in place after receiving damage.
    allow knockback: true
random:
    # How long (in ticks) NPCs should run away for (when hit or told to avoid threats).
    run away time: 1200
    # What sound to play when the "spectral" attack is used.
    spectral sound: ENTITY_VILLAGER_YES
    # Whether to use 'workaround' mode of melee damage.
    # If enabled, this can cause unwanted side effects, like mobs not aggroing or some armor effects not applying.
    workaround damage: false
    # Whether to enforce drops even when 'keepInventory' or similar are enabled.
    workaround drops: false
    # Whether to block some Bukkit events related to Sentinel NPCs from ever running. Will cause weirdness with basic functionality.
    # Recommended to use this alongside other workaround options.
    workaround bukkit events: false
    # Whether to workaround potential issues with entity-follow pathfinding.
    # Whether to use Sentinel's entity chase pathfinder.
    # If set to 'false', will use the Citizens built-in one instead.
    workaround entity chase pathfinder: true
    # Whether to permit death messages to show for Sentinel NPC deaths.
    death messages: true
    # How fast to try to shoot things (EG arrows).
    shoot speed minimum: 20
    # Whether to force damage through (particularly for ranged attacks).
    # If enabled, this can cause unwanted side effects, like mobs not aggroing or some armor effects not applying.
    enforce damage: false
    # Whether NPCs are protected from damage by ignore targets.
    protected: false
    # Whether skull attack, evoker fang, or shulker bullets are allowed.
    skull allowed: true
    # How many calculation cycles before an NPC will give up on a good target.
    clever ticks: 10
    # Whether to ignore targets that are invisible.
    ignore invisible targets: true
    # Whether to prevent players from damaging NPCs that are guarding them.
    no guard damage: true
    # Distances used for NPCs following their guarded player
    guard follow distance:
        # Maximum possible distance of point to choose (relative to the guarded player)
        selection range: 4
        # Minimum distance before choosing a new point (relative to guarded player)
        minimum: 7
    # How long (in ticks) before Sentinel-fired arrows in the ground are cleaned up. Set to 0 to disable cleanup.
    arrow cleanup time: 200
    # Whether to protect Sentinel NPCs from being burned by the sun.
    block sunburn: true
    # Whether to retain the existing target even when a better one exists.
    # This will persist per individual NPC, but is not user configurable per-NPC at the moment (API configurable only).
    retain target: false
    # Whether to prevent block damage caused by Sentinel weapons.
    prevent explosion block damage: true
    # If set 'true', native (Spigot or NMS) driven attack handlers will be used for melee attacks from some NPC entity types when that NPC's damage value is -1.
    # If the damage value is manually specified, or the NPC is not a supported type, or this config key is set to 'false', a direct damage induction will be used instead.
    # If 'workaround damage' is enabled, neither native nor direct damage will be used, and the workaround hack will apply instead.
    do native attacks: true
# How fast to recalculate, in ticks.
update rate: 10
#----------- Important! -----------
# Your configuration file was outdated.
# It has been automatically updated.
# You may notice some duplicated comments or other minor inconsistencies,
# if these annoy you, you may remove the duplicate comments OR
# delete the config file to allow it to regenerate.
#
# The below value is how many times automatic updates have been applied
# since you last cleaned this file.
# ----------- End Important! -----------
times_changed: 3

Please see https://github.com/CitizensDev/Citizens2/issues/2635.

mcmonkey4eva commented 3 years ago

Unless you can verify that this directly relates to Sentinel (eg do the wolves stop glitching if you just /trait sentinel one of the wolves that was consistently glitching, without changing anything else about it?), it's unlikely to relate to Sentinel.

SlimeDog commented 3 years ago

I'm not sure what you want me to test. Each of the glitched NPCs reports that it is a sentinel. For example, from start-up

[13:35:19] [Server thread/WARN]: UUID of added entity already exists: EntityWolfNPC['Wolf'/593, uuid='62fe6737-fffe-4170-b58f-43aeac0dd8d2', l='ServerLevel[world_city]', x=-558.50, y=65.00, z=82.50, cpos=[-35, 5], tl=0, v=false, rR=null]

At the console

> npc select 16
[13:38:37 INFO]: Selected Murphy (ID 16).
> npc
[13:38:38 INFO]: =====[ Murphy ]=====
[13:38:38 INFO]:     ID: 16
[13:38:38 INFO]:     UUID: 62fe6737-fffe-4170-b58f-43aeac0dd8d2
[13:38:38 INFO]:     Type: WOLF
[13:38:38 INFO]:     Traits
[13:38:38 INFO]:      - sentinel

Normally, that report would include the spawn location (this from my parallel Spigot server)

>npc
[13:38:22] [Server thread/INFO]: =====[ Murphy ]=====
[13:38:22] [Server thread/INFO]:     ID: 16
[13:38:22] [Server thread/INFO]:     UUID: 62fe6737-fffe-4170-b58f-43aeac0dd8d2
[13:38:22] [Server thread/INFO]:     Type: WOLF
[13:38:22] [Server thread/INFO]:     Spawned at -559, 65, 81 in world world_city
[13:38:22] [Server thread/INFO]:     Traits
[13:38:22] [Server thread/INFO]:      - sentinel

As a simple test, if I

all of the nominally-sentinel NPCs spawn normally, other than not having the sentinel(or any other) trait. That is, they are all active. Is that sufficient isolation?

UPDATE: NPCs did not spawn normally. I was fooled by the lack of WARN messages on start-up. However, one of the relevant NPCs does not show spawn data, with Sentinel not in the plugin mix. I have no idea if that means Sentinel can be ruled out as a causal factor, but there it is.

SlimeDog commented 3 years ago

More data...

Note that NPC 16 is the identified patient above. So

> citizens save
[14:58:07 INFO]: Saving Citizens...
[14:58:08 INFO]: Citizens saved.
> citizens reload
[14:58:20 INFO]: WARNING: this command will load all data from disk without saving first. Please retype /citizens reload to confirm. You can disable this warning in settings.
> citizens reload
[14:58:23 INFO]: Reloading Citizens...
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 1.
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 2.
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 3.
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 4.
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 12.
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 13.
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 14.
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 15.
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 18.
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 19.
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 20.
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 21.
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 25.
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 26.
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 27.
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 28.
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 29.
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 30.
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 31.
[14:58:23 ERROR]: [Citizens] The trait sentinel failed to load for NPC ID: 32.

Note that NPC 16 is not reloaded from the save file. It does exist in the save file.