aboutsummaryrefslogtreecommitdiff
path: root/internal/game/game.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/game.go')
-rw-r--r--internal/game/game.go30
1 files changed, 21 insertions, 9 deletions
diff --git a/internal/game/game.go b/internal/game/game.go
index 5af35be..49d34b6 100644
--- a/internal/game/game.go
+++ b/internal/game/game.go
@@ -124,6 +124,8 @@ func (g *Game) HandleSession(sess *net.Session, input string) {
g.handleDropAllConfirm(sess, input)
case net.StateCookRecipe:
g.handleCookRecipe(sess, input)
+ case net.StateSmeltRecipe:
+ g.handleSmeltRecipe(sess, input)
case net.StateColorChoice:
g.handleColorChoice(sess, input)
}
@@ -132,18 +134,18 @@ func (g *Game) HandleSession(sess *net.Session, input string) {
func classifyCommand(cmd string) CommandClass {
switch cmd {
case "say", "score", "sc", "inventory", "i", "inv",
- "equipment", "eq", "look", "l", "exits", "help",
+ "look", "l", "exits", "help",
"map", "option", "options", "alias", "unalias",
"description", "desc", "queued", "color", "colors",
"colortable", "prompt", "style":
return ClassInstant
- case "wear", "wield", "remove", "unwear", "unwield":
+ case "equip", "eq", "equipment", "wear", "wield", "remove", "unwear", "unwield":
return ClassFree
case "get", "take", "grab", "pick", "drop",
"attack", "kill",
"north", "n", "south", "s", "east", "e",
"west", "w", "up", "u", "down", "d",
- "quit", "use", "burn", "stoke", "search", "walk", "cook":
+ "quit", "use", "burn", "stoke", "search", "walk", "cook", "smelt":
return ClassActive
case "eat":
return ClassFree
@@ -188,6 +190,16 @@ func (g *Game) handleGameCommand(sess *net.Session, input string) {
parts := strings.Fields(strings.ToLower(input))
cmd := parts[0]
+
+ if len(parts) == 1 {
+ switch cmd {
+ case "equip", "eq", "equipment", "wear", "wield":
+ g.doEquipment(sess)
+ g.writePrompt(sess)
+ return
+ }
+ }
+
class := classifyCommand(cmd)
if class == ClassInstant {
@@ -302,8 +314,6 @@ func (g *Game) executeCommand(sess *net.Session, cmd string, args []string, rawI
g.doScore(sess)
case "i", "inv", "inventory":
g.doInventory(sess)
- case "eq", "equipment":
- g.doEquipment(sess)
case "quit":
g.doQuit(sess)
return
@@ -358,6 +368,9 @@ func (g *Game) executeCommand(sess *net.Session, cmd string, args []string, rawI
case "cook":
g.doCook(sess, strings.Join(args, " "))
return
+ case "smelt":
+ g.doSmelt(sess, strings.Join(args, " "))
+ return
case "eat":
g.doEat(sess, strings.Join(args, " "))
return
@@ -394,7 +407,7 @@ func (g *Game) executeCommand(sess *net.Session, cmd string, args []string, rawI
case "walk":
g.doWalk(sess, args)
return
- case "wear", "wield":
+ case "eq", "equipment", "equip", "wear", "wield":
g.doWear(sess, strings.Join(args, " "))
return
case "remove", "unwear", "unwield":
@@ -446,7 +459,7 @@ func (g *Game) ProcessQueuedCommands() {
}
switch as.Type {
case ActionGathering, ActionCombating, ActionUsing, ActionTalking,
- ActionToggling, ActionBurning, ActionStoking, ActionResting, ActionWalking, ActionCooking:
+ ActionToggling, ActionBurning, ActionStoking, ActionResting, ActionWalking, ActionCooking, ActionSmelting:
default:
if as.Type != ActionMoving || p.MoveTicks <= 0 {
p.ActionState = nil
@@ -488,13 +501,12 @@ func (g *Game) ProcessQueuedCommands() {
if p.MoveTicks > 0 {
p.ClearMoveState()
}
- wasBusy := p.Action != nil || len(p.WalkSequence) > 0 || combat.GetCombat(p.Name) != nil
if len(parts) > 0 {
g.executeCommand(qc.Session, parts[0], parts[1:], qc.Command+" "+qc.Args)
}
isBusy := p.Action != nil || len(p.WalkSequence) > 0 || combat.GetCombat(p.Name) != nil || p.MoveTicks > 0
_, isResting := g.restTimers[p.Name]
- if !isResting && (wasBusy || !isBusy) {
+ if !isResting && !isBusy {
g.writePrompt(qc.Session)
}
}