Skip to content

ResourceSupply

Examples

Example

<ResourceSupply>
  <Max>
    1000
  </Max>
  <Initial>
    1000
  </Initial>
  <Type>
    food.meat
  </Type>
  <KillBeforeGather>
    false
  </KillBeforeGather>
  <MaxGatherers>
    25
  </MaxGatherers>
  <DiminishingReturns>
    0.8
  </DiminishingReturns>
  <Change>
    <AnyName>
      <Value>
        2
      </Value>
      <Interval>
        1000
      </Interval>
    </AnyName>
    <Growth>
      <State>
        alive
      </State>
      <Value>
        2
      </Value>
      <Interval>
        1000
      </Interval>
      <UpperLimit>
        500
      </UpperLimit>
    </Growth>
    <Rotting>
      <State>
        dead notGathered
      </State>
      <Value>
        -2
      </Value>
      <Interval>
        1000
      </Interval>
    </Rotting>
    <Decay>
      <State>
        dead
      </State>
      <Value>
        -1
      </Value>
      <Interval>
        1000
      </Interval>
      <LowerLimit>
        500
      </LowerLimit>
    </Decay>
  </Change>
</ResourceSupply>

XML Elements

The following elements can be used within this component:

ResourceSupply

KillBeforeGather

Whether this entity must be killed (health reduced to 0) before its resources can be gathered

Type: boolean (true or false)

Path: ResourceSupply/KillBeforeGather

Max

Max amount of resources available from this entity.

Path: ResourceSupply/Max

Initial

Initial amount of resources available from this entity, if this is not specified, Max is used.

Path: ResourceSupply/Initial

Type

Type and Subtype of resource available from this entity

Path: ResourceSupply/Type

MaxGatherers

Amount of gatherers who can gather resources from this entity at the same time

Type: non-negative integer (e.g. 0 or 5)

Path: ResourceSupply/MaxGatherers

DiminishingReturns

The relative rate of any new gatherer compared to the previous one (geometric sequence). Leave the element out for no diminishing returns.

Type: positive decimal

Path: ResourceSupply/DiminishingReturns

Change

Optional element containing all the modifications that affects a resource supply

Path: ResourceSupply/Change

{ChangeType}

Element defining whether and how a resource supply regenerates or decays

Path: ResourceSupply/Change/{ChangeType}

Value

The amount of resource added per interval.

Type: integer

Path: ResourceSupply/Change/{ChangeType}/Value

Interval

The interval in milliseconds.

Type: positive integer (e.g. 1 or 5)

Path: ResourceSupply/Change/{ChangeType}/Interval

UpperLimit

The upper limit of the value after which the Change has no effect.

Type: non-negative integer (e.g. 0 or 5)

Path: ResourceSupply/Change/{ChangeType}/UpperLimit

LowerLimit

The bottom limit of the value after which the Change has no effect.

Type: non-negative integer (e.g. 0 or 5)

Path: ResourceSupply/Change/{ChangeType}/LowerLimit

State

What state the entity must be in for the effect to occur.

Path: ResourceSupply/Change/{ChangeType}/State

RELAX NG Grammar

<define name="component.ResourceSupply">
  <element name="ResourceSupply">
    <interleave>
      <element name="KillBeforeGather">
        <data type="boolean"/>
      </element>
      <element name="Max">
        <choice>
          <data type="nonNegativeInteger"/>
          <value>
          </value>
        </choice>
      </element>
      <optional>
        <element name="Initial">
          <choice>
            <data type="nonNegativeInteger"/>
            <value>
            </value>
          </choice>
        </element>
      </optional>
      <element name="Type">
        <choice>
          <value>
          </value>
          <value>
          </value>
          <value>
          </value>
          <value>
          </value>
          <value>
          </value>
          <value>
          </value>
          <value>
          </value>
          <value>
          </value>
          <value>
          </value>
          <value>
          </value>
        </choice>
      </element>
      <element name="MaxGatherers">
        <data type="nonNegativeInteger"/>
      </element>
      <optional>
        <element name="DiminishingReturns">
          <ref name="positiveDecimal"/>
        </element>
      </optional>
      <optional>
        <element name="Change">
          <oneOrMore>
            <element>
              <anyName/>
              <interleave>
                <element name="Value">
                  <data type="integer"/>
                </element>
                <element name="Interval">
                  <data type="positiveInteger"/>
                </element>
                <optional>
                  <element name="UpperLimit">
                    <data type="nonNegativeInteger"/>
                  </element>
                </optional>
                <optional>
                  <element name="LowerLimit">
                    <data type="nonNegativeInteger"/>
                  </element>
                </optional>
                <optional>
                  <element name="State">
                    <list>
                      <oneOrMore>
                        <choice>
                          <value>
                          </value>
                          <value>
                          </value>
                          <value>
                          </value>
                          <value>
                          </value>
                        </choice>
                      </oneOrMore>
                    </list>
                  </element>
                </optional>
              </interleave>
            </element>
          </oneOrMore>
        </element>
      </optional>
    </interleave>
  </element>
</define>