goonscape/types/types.go

64 lines
1.3 KiB
Go

package types
import (
"sync"
"time"
pb "gitea.boner.be/bdnugget/goonserver/actions"
rl "github.com/gen2brain/raylib-go/raylib"
)
type Tile struct {
X, Y int
Height float32
Walkable bool
}
type Player struct {
sync.Mutex
PosActual rl.Vector3
PosTile Tile
TargetPath []Tile
ActionQueue []*pb.Action
Speed float32
Model rl.Model
Texture rl.Texture2D
ID int32
CurrentTick int64
LastUpdateTime time.Time
InterpolationProgress float32
UserData interface{} // Used to store reference to game
FloatingMessage *FloatingMessage
}
type ModelAsset struct {
Model rl.Model
Texture rl.Texture2D
}
type ChatMessage struct {
PlayerID int32
Content string
Time time.Time
}
type FloatingMessage struct {
Content string
ExpireTime time.Time
ScreenPos rl.Vector2 // Store the screen position for 2D rendering
}
const (
MapWidth = 50
MapHeight = 50
TileSize = 32
TileHeight = 2.0
// RuneScape-style tick rate (600ms)
ServerTickRate = 600 * time.Millisecond
ClientTickRate = 50 * time.Millisecond
MaxTickDesync = 5
// ServerAddr = "localhost:6969"
ServerAddr = "boner.be:6969"
)