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]
- Place a generator - Generators are special blocks with NBT data
- Power with energy - Generators consume energy from Energy Producers
- Collect drops - Generators produce items over time
- Sell drops - Use sell wand or
/sellto 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
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¶
- Check energy supply
- Check if generator is broken (
isGenBrokenNBT) - Check global generator toggle
Can't place generator¶
- Check slot availability
- Check if on own island
- Check placement cooldown
Generator disappeared¶
- Check CoreProtect logs
- Check playerdata variables
- May need manual restoration