feat: pipe/wire path building API + oni_commander.py high-level commands
New Mod endpoints: - POST /api/action/build_pipe: build gas/liquid pipe path (x1,y1)->(x2,y2) with bridge option - POST /api/action/build_wire: build wire path with types: regular, heavy, conductive, heavy_conductive New Python tool: tools/oni_commander.py High-level commands that combine multiple low-level API calls: - diagnose: full diagnostic (power, CO2, temp, diseases, pipes) - fix_co2: auto-detect CO2 pockets and dig vent shafts - fix_overload: detect overloaded circuits with fix suggestions - emergency_o2: auto-check O2 and build OxygenDiffuser/Electrolyzer - expand_base: dig + build walls/floors in one command (one-click room expansion) - build_pipe_line: simplified CLI for pipe path building - build_wire_line: simplified CLI for wire path building All high-level commands auto-pause/resume the game. CLI: build_pipe_line, build_wire_line added to oni_api.py
This commit is contained in:
@ -697,6 +697,30 @@ def cmd_assign_job(args):
|
||||
})
|
||||
_print_feedback(result)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Pipe / Wire Lines
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def cmd_build_pipe_line(args):
|
||||
"""Build a pipe line. Usage: build_pipe_line <gas|liquid> <x1> <y1> <x2> <y2> [bridge]"""
|
||||
if len(args) < 5:
|
||||
print("Usage: build_pipe_line gas|liquid <x1> <y1> <x2> <y2> [bridge]")
|
||||
return
|
||||
payload = {"type": args[0], "x1": int(args[1]), "y1": int(args[2]),
|
||||
"x2": int(args[3]), "y2": int(args[4]), "bridge": len(args) > 5 and args[5] == 'bridge'}
|
||||
result = api_post('/api/action/build_pipe', payload)
|
||||
_print_feedback(result)
|
||||
|
||||
def cmd_build_wire_line(args):
|
||||
"""Build a wire line. Usage: build_wire_line <type> <x1> <y1> <x2> <y2> [bridge]"""
|
||||
if len(args) < 5:
|
||||
print("Usage: build_wire_line regular|heavy|conductive <x1> <y1> <x2> <y2> [bridge]")
|
||||
return
|
||||
payload = {"type": args[0], "x1": int(args[1]), "y1": int(args[2]),
|
||||
"x2": int(args[3]), "y2": int(args[4]), "bridge": len(args) > 5 and args[5] == 'bridge'}
|
||||
result = api_post('/api/action/build_wire', payload)
|
||||
_print_feedback(result)
|
||||
|
||||
def _print_feedback(result):
|
||||
"""Pretty-print action feedback."""
|
||||
if result.get('success'):
|
||||
@ -823,6 +847,8 @@ COMMANDS = {
|
||||
'storage': cmd_storage,
|
||||
'skills': cmd_skills,
|
||||
'assign_job': cmd_assign_job,
|
||||
'build_pipe_line': cmd_build_pipe_line,
|
||||
'build_wire_line': cmd_build_wire_line,
|
||||
}
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user