aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_look.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-12 23:52:06 -0400
committerhistoria <[not public]>2026-06-12 23:52:06 -0400
commita19e6b6ab01670a5932308c7bd0e0e5eed8cbcad (patch)
tree80a2e46c3e6cc98bb8b4f708cc403949b14742eb /internal/game/cmd_look.go
parentf3a6ae488bbd2128af8356b0da016699c5abb70e (diff)
downloadthehouseoficarus-a19e6b6ab01670a5932308c7bd0e0e5eed8cbcad.tar.gz
feat: firemaking skill implemented. overhauled how ground items and despawn are handled.
Diffstat (limited to 'internal/game/cmd_look.go')
-rw-r--r--internal/game/cmd_look.go65
1 files changed, 54 insertions, 11 deletions
diff --git a/internal/game/cmd_look.go b/internal/game/cmd_look.go
index 6d19023..e0e98fe 100644
--- a/internal/game/cmd_look.go
+++ b/internal/game/cmd_look.go
@@ -96,6 +96,7 @@ func (g *Game) doLook(sess *net.Session) {
sharedMax int
sharedCur int
respawnIn int
+ quality int
}
var instances []instInfo
for i := 0; i < count; i++ {
@@ -109,6 +110,7 @@ func (g *Game) doLook(sess *net.Session) {
sharedMax: st.SharedMax,
sharedCur: st.SharedTimer,
respawnIn: st.DepleteTimer,
+ quality: st.Quality,
})
}
multi := len(instances) > 1
@@ -126,19 +128,35 @@ func (g *Game) doLook(sess *net.Session) {
}
}
+ roomDesc := def.InRoomDescription
+
if len(freshIdxs) > 0 {
+ var line string
+ if roomDesc != "" {
+ line = roomDesc
+ } else if len(freshIdxs) == 1 {
+ line = "A " + def.Name + " is here."
+ } else {
+ line = fmt.Sprintf("%d %ss are here.", len(freshIdxs), def.Name)
+ }
var suffix string
if multi && (len(timed) > 0 || len(depleted) > 0) {
suffix = fmt.Sprintf(" [%s]", intsJoin(freshIdxs))
}
- if len(freshIdxs) == 1 {
- sess.WriteLine(fmt.Sprintf(" A %s is here.%s", def.Name, suffix))
- } else {
- sess.WriteLine(fmt.Sprintf(" %d %ss are here.%s", len(freshIdxs), def.Name, suffix))
+ qualityTimer := ""
+ if showTimers && len(instances) > 0 && instances[0].quality > 0 {
+ qualityTimer = fmt.Sprintf(" (Burning for %d more ticks)", instances[0].quality)
}
+ sess.WriteLine(fmt.Sprintf(" %s%s%s", line, suffix, qualityTimer))
}
for _, ins := range timed {
+ var line string
+ if roomDesc != "" {
+ line = roomDesc
+ } else {
+ line = "A " + def.Name + " is here."
+ }
tag := ""
if multi {
tag = fmt.Sprintf(" [%d]", ins.idx)
@@ -147,10 +165,16 @@ func (g *Game) doLook(sess *net.Session) {
if showTimers {
timer = fmt.Sprintf(" (despawn: %d/%d)", ins.sharedCur, ins.sharedMax)
}
- sess.WriteLine(fmt.Sprintf(" A %s is here.%s%s", def.Name, tag, timer))
+ sess.WriteLine(fmt.Sprintf(" %s%s%s", line, tag, timer))
}
for _, ins := range depleted {
+ var line string
+ if roomDesc != "" {
+ line = roomDesc
+ } else {
+ line = "A " + def.Name + " is here."
+ }
tag := ""
if multi {
tag = fmt.Sprintf(" [%d]", ins.idx)
@@ -159,7 +183,7 @@ func (g *Game) doLook(sess *net.Session) {
if showTimers {
timer = fmt.Sprintf(" (respawns in %d ticks)", ins.respawnIn)
}
- sess.WriteLine(fmt.Sprintf(" 1 depleted %s is here.%s%s", def.Name, tag, timer))
+ sess.WriteLine(fmt.Sprintf(" %s (depleted)%s%s", line, tag, timer))
}
}
}
@@ -203,14 +227,21 @@ func (g *Game) doLook(sess *net.Session) {
if len(prefix) > maxPrefix {
maxPrefix = len(prefix)
}
- reserved := ""
+ var parts []string
if info.ReservedFor != "" {
if p.OptionBool("reserve") {
- reserved = fmt.Sprintf(" (reserved for %s for %d ticks)", info.ReservedFor, info.ReserveTimer)
+ parts = append(parts, fmt.Sprintf("reserved for %s %dt", info.ReservedFor, info.ReserveTimer))
} else {
- reserved = " (reserved)"
+ parts = append(parts, "reserved")
}
}
+ if p.OptionBool("despawn") && !info.IsSpawn {
+ parts = append(parts, fmt.Sprintf("despawns %dt", info.DespawnTimer))
+ }
+ reserved := ""
+ if len(parts) > 0 {
+ reserved = fmt.Sprintf(" (%s)", strings.Join(parts, ", "))
+ }
lines = append(lines, groundLine{prefix, reserved})
}
@@ -362,6 +393,14 @@ 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))
+ sess.WriteLine(fmt.Sprintf(" %s", qdesc))
+ }
+ }
+ }
return
}
@@ -389,12 +428,16 @@ func (g *Game) doLookTarget(sess *net.Session, input string) {
if err != nil || !def.MatchesName(input) {
continue
}
- sess.WriteLines(
+ lines := []string{
"",
def.Name,
fmt.Sprintf(" %s", def.Description),
fmt.Sprintf(" Value: %d credits", def.Value),
- )
+ }
+ if slot.MaxQuality > 0 {
+ lines = append(lines, fmt.Sprintf(" Has %d units of butane left.", slot.Quality))
+ }
+ sess.WriteLines(lines...)
return
}