From ff53f287e634b1c22eb1f6c56fcac4f52b65347e Mon Sep 17 00:00:00 2001 From: 2weiEmu Date: Thu, 5 Feb 2026 15:18:59 +0100 Subject: [PATCH] updated: making the code a bit better --- .obsidian/workspace.json | 7 ++- Nebulous Command/Notes on Mechanics.md | 1 + Nebulous Command/calc.py | 76 +----------------------- Nebulous Command/data.py | 82 ++++++++++++++++++++++++++ Nebulous Command/missile-simulator.py | 1 + 5 files changed, 89 insertions(+), 78 deletions(-) create mode 100644 Nebulous Command/data.py diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index a6b2aaf..db2cc5f 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -177,10 +177,12 @@ }, "active": "04094233c3d02ad2", "lastOpenFiles": [ - "List of things to do.md", - "Nebulous Command/calc.py~", "Nebulous Command/missile-simulator.py~", + "Nebulous Command/calc.py~", + "Nebulous Command/data.py~", "Nebulous Command/4913", + "Nebulous Command/data.py", + "List of things to do.md", "Nebulous Command/calc.py", "Nebulous Command/Notes on Mechanics.md~", "Nebulous Command/Notes on Mechanics.md", @@ -193,7 +195,6 @@ "Nebulous Command/Notes on Nebulous Command.md", "Nebulous Command/ANS/My Fleets", "Nebulous Command/ANS", - "Untitled", "Some cool music perhaps?.md", "System Overview and Links.md", "Thoughts on Politics and Researching, and finding out things that you think are right.md", diff --git a/Nebulous Command/Notes on Mechanics.md b/Nebulous Command/Notes on Mechanics.md index 7daa440..8d3b836 100644 --- a/Nebulous Command/Notes on Mechanics.md +++ b/Nebulous Command/Notes on Mechanics.md @@ -6,6 +6,7 @@ things that I still have to simulate: - missiles separate - new ui with where detected in the combination and where not - better error handling +- better manipulations of settings for everything, perhaps tkinter more? Why does this document exist? Basically I just wanna explore what is the best way to build a solid _combat_ fleet in Nebulous. I.e. capable of winning fair 3000 point on 3000 point 1v1s, and perhapsperforming supporting roles in a match. diff --git a/Nebulous Command/calc.py b/Nebulous Command/calc.py index b515d8f..bcd79bc 100644 --- a/Nebulous Command/calc.py +++ b/Nebulous Command/calc.py @@ -1,4 +1,5 @@ from dataclasses import dataclass +from data import Jammer, Ship, jammers, ships, Radar, radars import math # Data / Data-Sheets basically # --- ships --- @@ -6,81 +7,6 @@ import math padding = 16 -@dataclass -class Jammer: - name: str - range_km: float - radiated_power_kw: int - gain_db: int - - -jammers = [ - Jammer("No Jammer", 0, 0, 0), - Jammer("Self Screening Jammer", 2.5, 5, 2), - Jammer("Boosted Self Screening Jammer", 5, 5, 4) -] - - -@dataclass -class Ship: - name: str - rcs_m2: float - - -ships = [ - Ship("Sprinter", 2601), - Ship("Raines", 3783), - Ship("Keystone", 6281), - Ship("Vauxhall", 11727), - Ship("Axford", 14332), - Ship("Solomon", 27876), - Ship("Ferryman", 2601), - Ship("Draugr", 4685), - Ship("Flathead", 9869), - Ship("Ocello", 15745), - Ship("Marauder", 15745), - Ship("Moorline", 15745), - Ship("SGM-100 Balestra", 156), - Ship("SGM-200 Tempest", 625), - Ship("SGT-300 Pilum", 900), - Ship("SGM-H-200 Cyclone", 625), - Ship("SGM-H-300 Atlatl", 1600), - Ship("CM300 Container", 1600), - Ship("Side / SGM-100 Balestra", 400), - Ship("Side / SGM-200 Tempest", 950), - Ship("Side / SGT-300 Pilum", 2400), - Ship("Side / SGM-H-200 Cyclone", 950), - Ship("Side / SGM-H-300 Atlatl", 3600), - Ship("Side / CM300 Container", 4000), -] - - -@dataclass -class Radar: - name: str - radiated_power_kw: int - gain_db: int - aperture_size_m2: int - sensitivity_dBm: float - noise_filtering_dB: int - burnthrough_multiplier: int - max_range_km: float - - -# for Return Power Density Calculations -radars = [ - Radar("RF101", 1500, 80, 20, 0, 0, 0, 9), - Radar("RM50", 4100, 50, 30, -38.5, 0, 12, 9.5), - Radar("RS35", 3500, 40, 25, -36, 0, 8, 8), - Radar("RS41", 4500, 60, 40, -38.5, 0, 0, 11.5), - Radar("R400", 5000, 70, 100, -38, 0, 0, 14), - Radar("R550", 3500, 50, 250, -36, 0, 0, 18), - Radar("RF44", 1500, 60, 40, 0, 0, 0, 6.5), - Radar("Bulwark Huntress", 4000, 40, 60, -38, 0, 4, 10), - Radar("Ithaca", 3100, 40, 60, -34, 0, 4, 8.5), -] - - def select_ship() -> Ship: print("Select the index of the ship you want") for i, ship in enumerate(ships): diff --git a/Nebulous Command/data.py b/Nebulous Command/data.py new file mode 100644 index 0000000..4885bb6 --- /dev/null +++ b/Nebulous Command/data.py @@ -0,0 +1,82 @@ +from dataclasses import dataclass + + +@dataclass +class Jammer: + name: str + range_km: float + radiated_power_kw: int + gain_db: int + + +jammers = [ + Jammer("No Jammer", 0, 0, 0), + Jammer("Self Screening Jammer", 2.5, 5, 2), + Jammer("Boosted Self Screening Jammer", 5, 5, 4) +] + + +@dataclass +class Ship: + name: str + rcs_m2: float + + +@dataclass +class Missile(Ship): + side_rcs_m2: float + + + +ships = [ + Ship("Sprinter", 2601), + Ship("Raines", 3783), + Ship("Keystone", 6281), + Ship("Vauxhall", 11727), + Ship("Axford", 14332), + Ship("Solomon", 27876), + Ship("Ferryman", 2601), + Ship("Draugr", 4685), + Ship("Flathead", 9869), + Ship("Ocello", 15745), + Ship("Marauder", 15745), + Ship("Moorline", 15745), + Ship("SGM-100 Balestra", 156), + Ship("SGM-200 Tempest", 625), + Ship("SGT-300 Pilum", 900), + Ship("SGM-H-200 Cyclone", 625), + Ship("SGM-H-300 Atlatl", 1600), + Ship("CM300 Container", 1600), + Ship("Side / SGM-100 Balestra", 400), + Ship("Side / SGM-200 Tempest", 950), + Ship("Side / SGT-300 Pilum", 2400), + Ship("Side / SGM-H-200 Cyclone", 950), + Ship("Side / SGM-H-300 Atlatl", 3600), + Ship("Side / CM300 Container", 4000), +] + + +@dataclass +class Radar: + name: str + radiated_power_kw: int + gain_db: int + aperture_size_m2: int + sensitivity_dBm: float + noise_filtering_dB: int + burnthrough_multiplier: int + max_range_km: float + + +# for Return Power Density Calculations +radars = [ + Radar("RF101", 1500, 80, 20, 0, 0, 0, 9), + Radar("RM50", 4100, 50, 30, -38.5, 0, 12, 9.5), + Radar("RS35", 3500, 40, 25, -36, 0, 8, 8), + Radar("RS41", 4500, 60, 40, -38.5, 0, 0, 11.5), + Radar("R400", 5000, 70, 100, -38, 0, 0, 14), + Radar("R550", 3500, 50, 250, -36, 0, 0, 18), + Radar("RF44", 1500, 60, 40, 0, 0, 0, 6.5), + Radar("Bulwark Huntress", 4000, 40, 60, -38, 0, 4, 10), + Radar("Ithaca", 3100, 40, 60, -34, 0, 4, 8.5), +] diff --git a/Nebulous Command/missile-simulator.py b/Nebulous Command/missile-simulator.py index c514518..4f15a7f 100644 --- a/Nebulous Command/missile-simulator.py +++ b/Nebulous Command/missile-simulator.py @@ -1,4 +1,5 @@ from calc import ships, jammers, radars, select_ship, select_jammer, select_radar +from data import Jammer, Ship, jammers, ships, Radar, radars import cv2 as cv import numpy as np import math -- 2.54.0