ForTheCrown / FTC

ForTheCrown SMP's plugin code
https://www.forthecrown.net/docs/
3 stars 1 forks source link

Market resetting expansion #35

Open JulieWoolie opened 11 months ago

JulieWoolie commented 11 months ago

The system which resets markets needs to be expanded. Currently it works by copy-pasting a copy of the shop before purchase ~80 blocks below the shop itself. This can get messed up if the shop is messed up before purchase or for a number of other reasons, not to mention the shop below ground stays loaded.

The automatic reset system as well needs to be changed, as at present moment it seems to not work at all.

A new system would be able to evict people for the following reasons:

new auto-evictions.toml config:

# Sets whether the auto-resetter is enabled or disabled
enabled = true

# Interval at which shops would be validated
validation_interval = "1day"

# Criterias for eviction reason selection
[criterias]
too_few_shops = 5
unstocked_shop_percent = 0.33
max_inactive_time = "1months"
irrelevance_time = "2weeks"

# 'aggression' is a 0.0 to 1.0 value calculated based on the percent of occupied 
# shops to total shops, like so:
# agression = base_value + ((occupied_shop_count / total_shop_count) * occupation_percent_multiplier)
#
# Agression determines which reasons the system uses to evict shop owners. It can't modify the
# criterias for each reason, as that might make the rules seem too arbitrary in the eyes of the players
#
[eviction_agression]
base_value = 0.1
occupation_percent_multiplier = 1.0
thresholds = [
  {too_few_shops=0.1},
  {unstocked_shops=0.2},
  {irrelevent_shop=0.5},
  {inactive=0.75}
]

New reset-copy.toml config

# World the shops are copied from
copy_world = "world_void"

# Offset applied to each shop's position before any operations are performed
shop_position_offset = {x=1, y=2, z=3}

# Position at which the shop copies are in the 'copy_world'
# The final position a shop will copied from is:
# final_position = (shop.position + shop_position_offset) + copy_position
# And the paste position will just be the shop's position
copy_position = {x=1, y=2, z=3}