forked from retoor/devplacepy
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>
29 lines
617 B
Go
29 lines
617 B
Go
//go:build windows
|
|
|
|
package main
|
|
|
|
import (
|
|
"syscall"
|
|
"unsafe"
|
|
)
|
|
|
|
type systemPowerStatus struct {
|
|
ACLineStatus byte
|
|
BatteryFlag byte
|
|
BatteryLifePercent byte
|
|
SystemStatusFlag byte
|
|
BatteryLifeTime uint32
|
|
BatteryFullLifeTime uint32
|
|
}
|
|
|
|
var getSystemPowerStatus = syscall.NewLazyDLL("kernel32.dll").NewProc("GetSystemPowerStatus")
|
|
|
|
func systemBattery() (bool, error) {
|
|
var status systemPowerStatus
|
|
result, _, err := getSystemPowerStatus.Call(uintptr(unsafe.Pointer(&status)))
|
|
if result == 0 {
|
|
return false, err
|
|
}
|
|
return windowsOnBattery(status.ACLineStatus, status.BatteryFlag), nil
|
|
}
|