<commit_before>package game

import (
	"log"
	"math"

	"buildblast/lib/coords"
	"buildblast/lib/physics"
)

type ControlState struct {
	Forward       bool
	Left          bool
	Right         bool
	Back          bool
	Jump          bool
	ActivateLeft  bool
	ActivateRight bool
	Lat           float64
	Lon           float64

	Timestamp float64 // In ms
}

var PLAYER_HEIGHT = 1.75
var PLAYER_EYE_HEIGHT = 1.6
var PLAYER_BODY_HEIGHT = 1.3
var PLAYER_HALF_EXTENTS = coords.Vec3{
	0.2,
	PLAYER_HEIGHT / 2,
	0.2,
}
var PLAYER_CENTER_OFFSET = coords.Vec3{
	0,
	PLAYER_BODY_HEIGHT/2 - PLAYER_EYE_HEIGHT,
	0,
}

// Gameplay state defaults
var PLAYER_MAX_HP = 100

type Player struct {
	pos      coords.World
	look     coords.Direction
	vy       float64
	box      physics.Box
	controls ControlState
	history  *PlayerHistory
	world    *World
	name     string

	// Gameplay state
	hp        int
	inventory *Inventory
}

func NewPlayer(world *World, name string) *Player {
	return &Player{
		history:   NewPlayerHistory(),
		hp:        PLAYER_MAX_HP,
		inventory: NewInventory(),
		world:     world,
		name:      name,
	}
}

func (p *Player) Pos() coords.World {
	return p.pos
}

func (p *Player) ID() string {
	return p.name
}

func (p *Player) Inventory() *Inventory {
	return p.inventory
}

func (p *Player) Tick(w *World) {}

func (p *Player) ClientTick(controls ControlState) (coords.World, float64, int, *coords.World) {
	dt := (controls.Timestamp - p.controls.Timestamp) / 1000<commit_msg>Don't attempt to simulation anything on player's first frame.<commit_after>package game

import (
	"log"
	"math"

	"buildblast/lib/coords"
	"buildblast/lib/physics"
)

type ControlState struct {
	Forward       bool
	Left          bool
	Right         bool
	Back          bool
	Jump          bool
	ActivateLeft  bool
	ActivateRight bool
	Lat           float64
	Lon           float64

	Timestamp float64 // In ms
}

var PLAYER_HEIGHT = 1.75
var PLAYER_EYE_HEIGHT = 1.6
var PLAYER_BODY_HEIGHT = 1.3
var PLAYER_HALF_EXTENTS = coords.Vec3{
	0.2,
	PLAYER_HEIGHT / 2,
	0.2,
}
var PLAYER_CENTER_OFFSET = coords.Vec3{
	0,
	PLAYER_BODY_HEIGHT/2 - PLAYER_EYE_HEIGHT,
	0,
}

// Gameplay state defaults
var PLAYER_MAX_HP = 100

type Player struct {
	pos      coords.World
	look     coords.Direction
	vy       float64
	box      physics.Box
	controls ControlState
	history  *PlayerHistory
	world    *World
	name     string

	// Gameplay state
	hp        int
	inventory *Inventory
}

func NewPlayer(world *World, name string) *Player {
	return &Player{
		history:   NewPlayerHistory(),
		hp:        PLAYER_MAX_HP,
		inventory: NewInventory(),
		world:     world,
		name:      name,
	}
}

func (p *Player) Pos() coords.World {
	return p.pos
}

func (p *Player) ID() string {
	return p.name
}

func (p *Player) Inventory() *Inventory {
	return p.inventory
}

func (p *Player) Tick(w *World) {}

func (p *Player) ClientTick(controls ControlState) (coords.World, float64, int, *coords.World) {
	// First frame
	if p.controls.Timestamp == 0 {
		p.controls = controls
		return p.pos, 0.0, p.hp, nil
	}

	dt := (controls.Timestamp - p.controls.Timestamp) / 1000
{'fraction_non_alphanumeric': 0.09586405899326707, 'fraction_numerical': 0.022763706316126963, 'mean_word_length': 2.837638376383764, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '721869', 'n_tokens_mistral': 1226, 'n_tokens_neox': 1142, 'n_words': 305}