Code Farm: per-plot auto-replant pause and crop-lock check; community sync and node work
DevPlace CI / test (push) Failing after 44m45s
DevPlace CI / test (push) Failing after 44m45s
Continuous Delivery could never be turned off once a crop was planted. Add a one-shot per-plot "stop after harvest" flag (POST /game/plot/stop, Devii tool game_plot_stop, game_plots.stop_after_harvest), cleared by the next plant, autoreplant claim or Refactor. Autoreplant now also respects crop locks through the shared _crop_lock predicate. Plan and measurements in happyplanting.md. Also includes the pending community sync, node network and related work in the tree; the full suite passed (4999) with all of it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
+12
-1
@@ -27,6 +27,7 @@ type Limiter struct {
|
||||
serverLimit ServerLimits
|
||||
serverSet ServerSettings
|
||||
hasServer bool
|
||||
battery *batteryWatch
|
||||
day string
|
||||
used int64
|
||||
active int
|
||||
@@ -38,7 +39,7 @@ func NewLimiter(cfg Config, statePath string, now func() time.Time) (*Limiter, e
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
limiter := &Limiter{cfg: cfg, loc: loc, now: now, statePath: statePath}
|
||||
limiter := &Limiter{cfg: cfg, loc: loc, now: now, statePath: statePath, battery: newBatteryWatch(systemBattery, now)}
|
||||
limiter.load()
|
||||
return limiter, nil
|
||||
}
|
||||
@@ -165,6 +166,13 @@ func (l *Limiter) hoursCode() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (l *Limiter) SetBatteryProbe(probe BatteryProbe, debugf func(format string, args ...any)) {
|
||||
l.mu.Lock()
|
||||
defer l.mu.Unlock()
|
||||
l.battery = newBatteryWatch(probe, l.now)
|
||||
l.battery.debugf = debugf
|
||||
}
|
||||
|
||||
func (l *Limiter) Acquire() string {
|
||||
l.mu.Lock()
|
||||
defer l.mu.Unlock()
|
||||
@@ -172,6 +180,9 @@ func (l *Limiter) Acquire() string {
|
||||
if code := l.hoursCode(); code != "" {
|
||||
return code
|
||||
}
|
||||
if l.serverSet.PauseOnBattery && l.battery.OnBattery() {
|
||||
return RefuseBattery
|
||||
}
|
||||
if l.used >= l.capBytes() {
|
||||
return RefuseBandwidth
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user