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/action_burn.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/action_burn.go')
| -rw-r--r-- | internal/game/action_burn.go | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/internal/game/action_burn.go b/internal/game/action_burn.go index d57307a..917a6fe 100644 --- a/internal/game/action_burn.go +++ b/internal/game/action_burn.go @@ -102,6 +102,8 @@ func (g *Game) startBurn(sess *net.Session, p *player.Player, itemID string, fro phase = 0 } + p.ActionState = &ActionState{Type: ActionBurning} + p.Action = &action.Action{ Type: "burn", TargetID: itemID, @@ -138,11 +140,13 @@ func (g *Game) startStoke(sess *net.Session, p *player.Player, itemID string) { sess.WriteLine("You begin to tend to the fire.") + p.ActionState = &ActionState{Type: ActionStoking} + p.Action = &action.Action{ Type: "stoke", TargetID: itemID, TargetName: logDef.Name, - WaitLeft: 10, + WaitLeft: g.computeTicks(10), Data: map[string]any{ "item_id": itemID, "fire_key": fireKey, @@ -155,7 +159,7 @@ func (g *Game) startStoke(sess *net.Session, p *player.Player, itemID string) { func (g *Game) advanceBurn(sess *net.Session, p *player.Player) { data := p.Action.Data itemID := data["item_id"].(string) - toolSpeed := data["tool_speed"].(int) + toolSpeed := data["tool_speed"].(float64) phase := data["phase"].(int) logDef, err := g.ItemStore.Load(itemID) @@ -178,7 +182,7 @@ func (g *Game) advanceBurn(sess *net.Session, p *player.Player) { g.broadcastDrop(p, logDef.Name) data["phase"] = 1 - p.Action.WaitLeft = toolSpeed + p.Action.WaitLeft = g.computeTicks(toolSpeed) return } @@ -192,7 +196,7 @@ func (g *Game) advanceBurn(sess *net.Session, p *player.Player) { if phase == 1 { sess.WriteLine(fmt.Sprintf("You try burning the %s on the ground...", logDef.Name)) data["phase"] = 2 - p.Action.WaitLeft = toolSpeed + p.Action.WaitLeft = g.computeTicks(toolSpeed) return } @@ -236,7 +240,7 @@ func (g *Game) advanceBurn(sess *net.Session, p *player.Player) { sess.WriteLine("You can't seem to get a fire going.") data["phase"] = 1 - p.Action.WaitLeft = toolSpeed + p.Action.WaitLeft = g.computeTicks(toolSpeed) } } @@ -244,7 +248,7 @@ func (g *Game) advanceStoke(sess *net.Session, p *player.Player) { data := p.Action.Data itemID := data["item_id"].(string) fireKey := data["fire_key"].(string) - burnTicks := data["burn_ticks"].(int) + burnTicks := data["burn_ticks"].(float64) xp := data["xp"].(int) st := g.World.GetObjStateByKey(fireKey) @@ -289,10 +293,10 @@ func (g *Game) advanceStoke(sess *net.Session, p *player.Player) { return } - p.Action.WaitLeft = 10 + p.Action.WaitLeft = g.computeTicks(10.0) } -func (g *Game) findFireTool(sess *net.Session, p *player.Player) (toolSpeed int, ok bool) { +func (g *Game) findFireTool(sess *net.Session, p *player.Player) (toolSpeed float64, ok bool) { toolSpeed = -1 var toolItemID string |
