Skip to content

Commit

Permalink
Small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Volte6 committed Feb 25, 2025
1 parent b3f6225 commit fc0f9d2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
14 changes: 7 additions & 7 deletions internal/events/eventtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type WebClientCommand struct {
Text string
}

func (b WebClientCommand) Type() string { return `WebClientCommand` }
func (w WebClientCommand) Type() string { return `WebClientCommand` }

// GMCP Commands from clients to server
type GMCPIn struct {
Expand All @@ -81,15 +81,15 @@ type GMCPIn struct {
Json []byte
}

func (b GMCPIn) Type() string { return `GMCPIn` }
func (g GMCPIn) Type() string { return `GMCPIn` }

// GMCP Commands from server to client
type GMCPOut struct {
UserId int
Payload any
}

func (b GMCPOut) Type() string { return `GMCPOut` }
func (g GMCPOut) Type() string { return `GMCPOut` }

// Messages that are intended to reach all users on the system
type System struct {
Expand Down Expand Up @@ -127,15 +127,15 @@ type NewRound struct {
Config configs.Config
}

func (r NewRound) Type() string { return `NewRound` }
func (n NewRound) Type() string { return `NewRound` }

type NewTurn struct {
TurnNumber uint64
TimeNow time.Time
Config configs.Config
}

func (r NewTurn) Type() string { return `NewTurn` }
func (n NewTurn) Type() string { return `NewTurn` }

type ItemOwnership struct {
UserId int
Expand All @@ -144,11 +144,11 @@ type ItemOwnership struct {
Gained bool
}

func (r ItemOwnership) Type() string { return `ItemOwnership` }
func (i ItemOwnership) Type() string { return `ItemOwnership` }

type ScriptedEvent struct {
Name string
Data map[string]any
}

func (r ScriptedEvent) Type() string { return `ScriptedEvent` }
func (s ScriptedEvent) Type() string { return `ScriptedEvent` }
9 changes: 6 additions & 3 deletions world.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ func (w *World) MainWorker(shutdown chan bool, wg *sync.WaitGroup) {

roomUpdateTimer := time.NewTimer(roomMaintenancePeriod)
ansiAliasTimer := time.NewTimer(ansiAliasReloadPeriod)
messageTimer := time.NewTimer(time.Millisecond)
eventLoopTimer := time.NewTimer(time.Millisecond)
turnTimer := time.NewTimer(time.Duration(c.TurnMs) * time.Millisecond)
statsTimer := time.NewTimer(time.Duration(10) * time.Second)

Expand Down Expand Up @@ -664,6 +664,7 @@ loop:
break loop
case <-statsTimer.C:

// TODO: Move this to events
util.LockMud()
w.UpdateStats()
util.UnlockMud()
Expand All @@ -673,6 +674,7 @@ loop:
case <-roomUpdateTimer.C:
slog.Debug(`MainWorker`, `action`, `rooms.RoomMaintenance()`)

// TODO: Move this to events
util.LockMud()
rooms.RoomMaintenance()
util.UnlockMud()
Expand All @@ -681,15 +683,16 @@ loop:

case <-ansiAliasTimer.C:

// TODO: Move this to events
util.LockMud()
templates.LoadAliases()
util.UnlockMud()

ansiAliasTimer.Reset(ansiAliasReloadPeriod)

case <-messageTimer.C:
case <-eventLoopTimer.C:

messageTimer.Reset(time.Millisecond)
eventLoopTimer.Reset(time.Millisecond)

util.LockMud()
w.EventLoop()
Expand Down

0 comments on commit fc0f9d2

Please sign in to comment.