Avorion

Avorion

42 ratings
War Zone / Hazard Zone Tweaks
   
Award
Favorite
Favorited
Unfavorite
Mods: Mod
File Size
Posted
Updated
55.994 KB
14 Feb, 2020 @ 2:29am
31 Jul @ 6:10pm
9 Change Notes ( view )

Subscribe to download
War Zone / Hazard Zone Tweaks

Description
What does it do?
Fixes a rather wide variety of annoyances and even outright bugs with so-called "Hazard Zones" ("war zones" in the game code).

In particular:
  • Explicitly restricts war zone score increases to the destruction of specific entity types (ships, stations, turrets, and fighters). The vanilla code looked... wonky in that regard.

  • A sector defending itself against an attacker will not cause the war zone score to increase just because the defenders blew up one of the attackers. This should cut down on all those situations where Head Hunters turn player-owned sectors into war zones and scare away all the merchant ships.

  • The player is no longer special; ship destruction (when eligible to increase the war zone score) will bump the score by 10 points, no matter who owned it or who blew it to smithereens.

  • Turrets and fighters only contribute 5 points to the war zone score when destroyed.

  • The war zone score starts decaying after 5 minutes instead of 60 (per the comments in the mod's code: "An hour? Ain't nobody got time for that!").

  • The threshold for declaring a sector to be a "Hazard Zone" is now 75 points instead of 60. To compensate for this and the shorter decay period, the threshold for clearing that status / declaring a sector to be peaceful again is now 25 points instead of 40.

What might it do in the future?
I'm just spitballing here, but here are some neat things I'd like to do that (as far as I can tell) are well within the realm of possibility (though whether or not they're possible without tanking performance is another question entirely...):
  • Overhaul the hazard zones to account for the factions involved (e.g. if faction Foo has stations being visited by factions Bar and Baz, and faction Bam (who is hostile to Foo and Bar but not to Baz) comes in and starts blowing up Foo's and Bar's ships, Baz shouldn't necessarily care unless/until one of its own ships gets hit in the crossfire).

  • Enforce higher minimum scores or lower maximum scores in certain situations (e.g. each hostile ship in the sector should increase the minimum score).

  • Make the "Hazard Zone" designation more of a spectrum rather than an all-or-nothing proposition (e.g. inverse relationship between war zone score and the number/frequency of civil ships spawned, potentially adjusted further by the number of friendly v. hostile ships in the sector).

  • Apply war zone rules to ships other than cargo ships (for example: the mobile merchants that occasionally warp in; they should probably wait until the fighting's over to warp in, and/or warp out as soon as they can if there's ongoing fighting).

  • Other things, I'm sure.

Is this compatible with other mods?
It should be. I play with a lot of mods, and this doesn't seem to impact them at all (at least at the moment).

Will this break my saves?


Due to a bug (or perhaps merely an oversight on Boxelware's part), the vanilla code controlling the war zone checking loads the decay cooldown and thresholds (from what I can tell) on a per-sector basis, and has no means to override this should those values have changed for some reason (e.g. by this mod). Conversely, in order for this mod to set these values for already-generated sectors, it has to override WarZoneCheck.restore() with a version that explicitly overwrites those values (namely: noDecayTime, warZoneThreshold, pacefulThreshold [sic], and maxScore in self.data). Until/unless Boxelware fixes this (might I recommend a certain mod which implements this more robustly? ;) ) or someone (perhaps myself) adds a cleanup mod specifically for this purpose, be aware that these changes are effectively permanent for sectors loaded with this mod active.

All the other changes this mod makes happen in real-time and do not involve any modification to saved data.

Can we see the source code?
Yep! Source code / manual downloads for all my Avorion mods are available here[fsl.yellowapple.us].
65 Comments
YellowApple  [author] 25 Jul @ 3:31pm 
🍾
Vertu 25 Jul @ 1:39pm 
It seems its fixed! Fighter related logs are being spat out and no hazard zone triggered in the rift.
YellowApple  [author] 24 Jul @ 10:48pm 
@Vertu: Just pushed version 0.3.1. This should detect if the entity has a mothership (i.e. because it's a fighter) and, if so, re-run the entity checks. Xsotan carriers themselves do have the is_xsotan value set, so this should hopefully fix the issue.

If not, then plan B will have to be to check against the entity's faction - which is easy enough in the Xsotan case, but for other factions (pirates, persecutors, bosses, etc.) things get trickier.

@maniac1168: the version on GitHub is still 0.2, so you can unsubscribe from the Workshop version and manually install the GitHub version (and then uninstall the GitHub version and re-subscribe to the Workshop version if/when that server updates to 0.3.x). Download: https://github.com/YellowApple/WarZoneTweaks/archive/refs/heads/master.zip
Vertu 23 Jul @ 1:07pm 
Successfully ignores xsotan "Victim is Xsotan" for ships.
Logs successfully ignore large xsotan breeder. Victim is Xsotan.
Torpedoes ignored.
Fighters do not appear in the log. When the hazard zone is propped, there is no mention to what caused it and no signs of fighters involved.
When selecting a xsotan fighter, its indicated just like any normal fighter except its of the xsotan faction. I would not be surprised if it lacks the "is_xsotan" flag.
Also, weren't Xsotan carriers only introduced ever since the Into The Rift update? If so, then I would be willing to bet the fighters lack the "is_xsotan" flag,
I can provide a quick video of the logs while in the rift until the hazard zone is declared if you wish.
maniac1168 23 Jul @ 11:47am 
a server I'm trying to join is using .2

is there a way to roll the mod back to a previous version?
Vertu 22 Jul @ 9:28pm 
Ah shoot I forgot to check for that. Will get to it when I can.
YellowApple  [author] 22 Jul @ 9:20pm 
Yep, 0.3 is the correct/updated version.

Can you post the logs from when those hazard zones popped? There should be a bunch of log entries like "WarZoneCheck: blah blah blah" whenever a ship or station is destroyed or boarded.
Vertu 22 Jul @ 4:20pm 
Went into my testing save. The mod version was 0.3 and in my experience, updating mods has not been the easiest of tasks with avorion so let me know if this is the incorrect version number.
Shot a few fighters (from small breeders) than destroyed I believe the 3rd large breeder and hazard zone popped. This was seemingly due to the large breeder dying but it could of had fighters out which died upon its destruction and it was them that popped the hazard zone.

Also did a test with just enemy fighters spawned by small breeders, still made it a hazard zone.

Into the rift has evidence of questionable coding practices as though it was not made by the original devs but an off-higher team. It would not surprise me if they did some strange coding with how rift sectors work, making this mod's life very difficult. Though again thankfully, no faction ships spawned due to the hazard zone in any of these tests, which was the main issue with the mod as the spawned faction ships would clean house.
Echo 22 Jul @ 11:52am 
We are a few days away from our first rift missions, but as soon as we get there I'll send what I can find.
YellowApple  [author] 22 Jul @ 3:42am 
@Vertu / @Echo: go ahead and try out the version I just published. It should address the rift sector issue (albeit heavy-handedly, by simply ignoring rift sectors entirely). The mod's also currently setup to output a lot of stuff into the server logs; if y'all can send over log/console output from around the same time that y'all do things like blow up ships/stations, that'd be much appreciated.