diff options
| author | historia <[not public]> | 2026-06-14 22:38:23 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-14 22:38:23 -0400 |
| commit | a6f0ad79e2e3a5b7c11eef1ffc3233f3a2766f77 (patch) | |
| tree | 89601a502bbfcb50302cf03f09b6febc6040eeb0 /internal/game/cmd_look.go | |
| parent | 1aba2bdd23aebed4032333e74aa553c40a31fcbd (diff) | |
| download | thehouseoficarus-a6f0ad79e2e3a5b7c11eef1ffc3233f3a2766f77.tar.gz | |
feat: fractional ticks and server game_speed implemented. potentially insanely janky.
Diffstat (limited to 'internal/game/cmd_look.go')
| -rw-r--r-- | internal/game/cmd_look.go | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/internal/game/cmd_look.go b/internal/game/cmd_look.go index a840579..3b81f80 100644 --- a/internal/game/cmd_look.go +++ b/internal/game/cmd_look.go @@ -25,8 +25,12 @@ func (g *Game) doLook(sess *net.Session) { room.Name, ) - if p.OptionBool("tinymap") && g.MapWidth > 0 { - descLines := wrapText(room.Description, g.MapWidth) + mapWidth := p.OptionInt("max_room_description_width") + if mapWidth <= 0 { + mapWidth = 70 + } + if p.OptionBool("tinymap") && mapWidth > 0 { + descLines := wrapText(room.Description, mapWidth) mapLines := buildTinyMap(g, p.RoomID) if len(mapLines) == 7 { g.writeLookSideBySide(sess, p, descLines, mapLines) @@ -107,10 +111,10 @@ func (g *Game) doLook(sess *net.Session) { instances = append(instances, instInfo{ idx: i + 1, depleted: st.Depleted, - sharedMax: st.SharedMax, + sharedMax: int(st.SharedMax), sharedCur: st.SharedTimer, - respawnIn: st.DepleteTimer, - quality: st.Quality, + respawnIn: int(st.DepleteTimer), + quality: int(st.Quality), }) } multi := len(instances) > 1 @@ -302,8 +306,10 @@ func (g *Game) doLook(sess *net.Session) { } line += fmt.Sprintf(" (fighting %s)", name) } - } else if desc := playerActionDescription(op); desc != "" { - line += ", " + desc + } else if as, ok := op.ActionState.(*ActionState); ok && as != nil { + if desc := as.Description(); desc != "" { + line += ", " + desc + } } sess.WriteLine(line + ".") } @@ -380,15 +386,15 @@ func (g *Game) doLookTarget(sess *net.Session, input string) { for _, ist := range instances { if ist.Depleted { if len(instances) > 1 { - sess.WriteLine(fmt.Sprintf(" %s %d: depleted, respawns in %d ticks.", def.Name, ist.Index+1, ist.DepleteTimer)) + sess.WriteLine(fmt.Sprintf(" %s %d: depleted, respawns in %d ticks.", def.Name, ist.Index+1, int(ist.DepleteTimer))) } else { - sess.WriteLine(fmt.Sprintf(" Depleted, respawns in %d ticks.", ist.DepleteTimer)) + sess.WriteLine(fmt.Sprintf(" Depleted, respawns in %d ticks.", int(ist.DepleteTimer))) } - } else if ist.SharedMax > 0 && ist.SharedTimer < ist.SharedMax { + } else if ist.SharedMax > 0 && float64(ist.SharedTimer) < ist.SharedMax { if len(instances) > 1 { - sess.WriteLine(fmt.Sprintf(" %s %d: despawn timer %d/%d.", def.Name, ist.Index+1, ist.SharedTimer, ist.SharedMax)) + sess.WriteLine(fmt.Sprintf(" %s %d: despawn timer %d/%.0f.", def.Name, ist.Index+1, ist.SharedTimer, ist.SharedMax)) } else { - sess.WriteLine(fmt.Sprintf(" Despawn timer: %d/%d ticks.", ist.SharedTimer, ist.SharedMax)) + sess.WriteLine(fmt.Sprintf(" Despawn timer: %d/%.0f ticks.", ist.SharedTimer, ist.SharedMax)) } } } @@ -396,7 +402,7 @@ func (g *Game) doLookTarget(sess *net.Session, input string) { for _, ist := range instances { if ist.Quality > 0 { if qdesc, ok := def.Props["quality_description"].(string); ok && qdesc != "" { - qdesc = strings.ReplaceAll(qdesc, "{quality}", fmt.Sprintf("%d", ist.Quality)) + qdesc = strings.ReplaceAll(qdesc, "{quality}", fmt.Sprintf("%.0f", ist.Quality)) sess.WriteLine(fmt.Sprintf(" %s", qdesc)) } } @@ -568,7 +574,11 @@ func (g *Game) writeLookSideBySide(sess *net.Session, p *player.Player, descLine if len(mapLines) > total { total = len(mapLines) } - leftMap := p.OptionBool("left-tinymap") + leftMap := p.OptionBool("left_tinymap") + mapWidth := p.OptionInt("max_room_description_width") + if mapWidth <= 0 { + mapWidth = 70 + } for i := 0; i < total; i++ { desc := "" if i < len(descLines) { @@ -581,7 +591,7 @@ func (g *Game) writeLookSideBySide(sess *net.Session, p *player.Player, descLine if leftMap { sess.WriteLine(fmt.Sprintf("%s %s", mapLine, desc)) } else { - sess.WriteLine(fmt.Sprintf("%-*s %s", g.MapWidth, desc, mapLine)) + sess.WriteLine(fmt.Sprintf("%-*s %s", mapWidth, desc, mapLine)) } } } |
