duncgibbs 14e2073322
All checks were successful
linting & formatting / build (push) Successful in 25s
itch.io publish action / build (web, html) (push) Successful in 3m51s
mostly implements networked board state; but also adds voting and a few buildings
2026-04-24 12:19:34 -05:00

46 lines
1.1 KiB
GDScript

class_name Player extends Resource
var id: int = randi()
var name: String = "Player"
var money: int = 10:
set(value):
money = value
changed.emit(self)
var votes: int = 0:
set(value):
votes = value
changed.emit(self)
var build_actions_taken: int = 0:
set(value):
build_actions_taken = value
changed.emit(self)
var building_permits: int = 2:
set(value):
building_permits = value
changed.emit(self)
var color: Color = Color(randf(), randf(), randf())
func serialize() -> Dictionary:
var result = {}
result["id"] = id
result["name"] = name
result["color"] = color
result["money"] = money
result["votes"] = votes
result["building_permits"] = building_permits
result["build_actions_taken"] = build_actions_taken
return result
static func deserialize(data: Dictionary) -> Player:
var result = Player.new()
result.id = data["id"]
result.name = data["name"]
result.color = data["color"]
result.money = data["money"]
result.votes = data["votes"]
result.building_permits = data["building_permits"]
result.build_actions_taken = data["build_actions_taken"]
return result