[Feature] Allow any spawn2 spawned mob to path while zone is idle if new flag is set. (#1339)

* Changes to allow any spawn2 to be marked to path even when zone is idle

* Fixed for Kingly review of PR

Co-authored-by: Noudess <noudess@gmail.com>
This commit is contained in:
Paul Coene
2021-05-10 02:21:43 -04:00
committed by GitHub
parent b335568bf9
commit 2edda6e743
7 changed files with 87 additions and 50 deletions
+1
View File
@@ -418,6 +418,7 @@
9162|2021_02_17_server_scheduled_events.sql|SELECT * FROM db_version WHERE version >= 9162|empty|
9163|2021_04_17_zone_safe_heading_changes.sql|SHOW COLUMNS FROM `zone` LIKE 'safe_heading'|empty|
9164|2021_04_23_character_exp_modifiers.sql|SHOW TABLES LIKE 'character_exp_modifiers'|empty|
9165|2021_04_28_idle_pathing.sql|SHOW COLUMNS FROM `spawn2` LIKE 'path_when_zone_idle'|empty|
# Upgrade conditions:
# This won't be needed after this system is implemented, but it is used database that are not
@@ -0,0 +1,13 @@
-- Add new path_when_zone_idle flag to allow some spawns to path in empty zones
ALTER TABLE spawn2 ADD COLUMN path_when_zone_idle tinyint(1) NOT NULL DEFAULT 0 AFTER pathgrid;
-- Update spawns that used to path in empty zones because of their grid type
-- to behave the same using the new mechanism. The code that checked path grid
-- types has been removed as it was coincidentally coupled to idle movement.
-- The new flag path_when_zone_idle is the new mechanism, and allows any moving
-- mob, not just those on grids, to path while the zone is idle.
UPDATE spawn2 s
LEFT JOIN zone z on z.short_name = s.zone
LEFT JOIN grid g on g.id = s.pathgrid AND g.zoneid = z.zoneidnumber
SET path_when_zone_idle = 1
WHERE pathgrid != 0 AND g.type in (4, 6)