Warzone / mars

All-in-one plugin for PGM servers
GNU Affero General Public License v3.0
9 stars 3 forks source link

Compasses for Infection gamemode #17

Closed TBG1000 closed 1 month ago

TBG1000 commented 2 years ago

Issue:

Members of the "Infected" team during an Infection game or map can no longer be provided with a compass that will point towards remaining humans.

Background:

A TGM pull request converted a compass given to a member of the "Infected" team into a human tracker, increasing the chance of winning (necessary for cases where lots of players are online).

It was up to the mapmaker to include a compass in the kit, but compasses could also be given to players through the command /give @a[tag=infected] compass.

Proposed / potential solution:

Note: ince Infection was previously hardcoded for Warzone, compasses were rather "exclusive" of TGM, so it may be undesirable to introduce the feature to upstream PGM.

  1. Mars could read through the loaded map's XML and find if it has been labeled as Infection through the game="" attribute of the root <map> tag, or also through the <game> sub-element.
  2. If true, then check if a compass is provided through a <kit>
  3. Convert such compass into a human tracker

With the power and versatility of PGM, mapmakers could then be able to decide when to give Infected the compass through the use of time filters, making it unecessary to provide it from the beginning or to manually give it through commands.

Example XML snippet:

# Initial Infected kit
    <kit id="infected-kit-start">
        <helmet locked="true" unbreakable="true" color="00FF00" material="leather helmet"/>
        <chestplate locked="true" unbreakable="true" color="00FF00" material="leather chestplate"/>
        <leggings locked="true" unbreakable="true" color="00FF00" material="leather leggings"/>
        <boots locked="true" unbreakable="true" color="00FF00" material="leather boots"/>
        <item slot="0" unbreakable="true" material="iron sword" name="`2`lInfection Sword"/>
    </kit>

# Infected kit with a compass (human tracker)
    <kit id="infected-kit-compass">
        <helmet locked="true" unbreakable="true" color="00FF00" material="leather helmet"/>
        <chestplate locked="true" unbreakable="true" color="00FF00" material="leather chestplate"/>
        <leggings locked="true" unbreakable="true" color="00FF00" material="leather leggings"/>
        <boots locked="true" unbreakable="true" color="00FF00" material="leather boots"/>
        <item slot="0" unbreakable="true" material="iron sword" name="`2`lInfection Sword"/>
        # Include human tracker
        <item slot="1" material="compass" name="`1`lHuman Tracker"/>
    </kit>

# Infected team first spawns with initial kit, no compass
    <spawn filter="before-10s" team="infected-team" kit="infected-kit-start">
        <regions yaw="90">
            <point>-1080.5,40,-1015.5</point>
        </regions>
    </spawn>

# After 6 minutes, infected are given the kit with a compass (human tracker)
    <spawn filter="after-6m" team="infected-team" kit="infected-kit-compass">
        <regions yaw="90">
            <point>-1080.5,40,-1015.5</point>
        </regions>
    </spawn>