Skip to content

Generator System

Generators are the core economy mechanic of Tycoon. They are blocks that automatically produce drops that players can sell.

How It Works

graph LR
    Generator[Generator Block] -->|requires| Energy[Energy]
    Generator -->|produces| Drops[Generator Drops]
    Drops -->|sell| Balance[Balance/Ethea]
    Energy -->|from| Producer[Energy Producer]
  1. Place a generator - Generators are special blocks with NBT data
  2. Power with energy - Generators consume energy from Energy Producers
  3. Collect drops - Generators produce items over time
  4. Sell drops - Use sell wand or /sell to convert to currency

Generator Properties

Each generator has these properties stored in NBT:

NBT Tag Type Description
genID int Generator type identifier
custom;genOwner string UUID of placing player
isGenBroken int 1 if broken, 0 if working

Slot System

Players have limited generator slots:

  • Base slots: 10 (default)
  • Honor upgrades: +slots at Honor 11, 21, 31
  • Premium tiers: Additional slots
Slots used: {playerdata::%uuid%::usedSlots}
Slots max:  {playerdata::%uuid%::maxSlots}

Commands

/togglegens          # Toggle generators globally (admin)
/genstotal <player>  # Check player's slot usage (admin)

Key Files

File Purpose
gens_main.sk Core placement/breaking/drop logic
gens_item.sk Generator item definitions
gens_sell.sk Selling mechanics
gens_display.sk Visual effects
gens_upgrade.sk Upgrade system

Generator Lifecycle

Placement

on place:
    if int tag "genID" of custom nbt of player's tool is set:
        # Check if player owns the island
        # Check slot availability
        # Set NBT on placed block
        # Register in playerdata

Breaking (Shift + Left Click)

on left click:
    if player is sneaking:
        # Verify ownership
        # Remove from playerdata
        # Give generator item back
        # Play break sound

Drop Production

Generators produce drops on a tick-based system. Drops appear at the generator location and can be collected with: - Right-click collection - Auto-collection (premium) - Global drop collection

Broken Generators

Generators can break and require repair:

if {_isGenBroken} is 1:
    # Generator is broken
    # Player must right-click to repair
    # Repair costs currency

Configuration

Generator types are defined in item configuration files. Each generator has: - Display name - Drop type and amount - Energy consumption rate - Sell value

Troubleshooting

Generator not producing drops

  1. Check energy supply
  2. Check if generator is broken (isGenBroken NBT)
  3. Check global generator toggle

Can't place generator

  1. Check slot availability
  2. Check if on own island
  3. Check placement cooldown

Generator disappeared

  1. Check CoreProtect logs
  2. Check playerdata variables
  3. May need manual restoration