~starkingdoms/starkingdoms

82ad842b7a2e162b6fd9b9869da7afaec5e2c3f6 — ghostlyzsh 1 year, 8 months ago bc65e52 + 98908c1
merge and adjustment to ship editor save structure to match regular save
13 files changed, 30 insertions(+), 175 deletions(-)

M .woodpecker/.backplane.yaml
M .woodpecker/.client.yaml
M .woodpecker/.server.yaml
D ansible/deploy.yml
D ansible/deploy_backplane.yml
D ansible/environments/beta.yml
D ansible/environments/stable.yml
D ansible/environments/unstable.yml
D ansible/global/backplane.yml
M docker/Dockerfile.build_env
A starkingdoms-client/Dockerfile
M starkingdoms-client/src/pages/Play.svelte
M starkingdoms-client/src/pages/ShipEditor.svelte
M .woodpecker/.backplane.yaml => .woodpecker/.backplane.yaml +3 -3
@@ 1,20 1,20 @@
steps:
  - name: backplane_fmt
    image: coresdev/stk_build_env
    image: registry.gitlab.com/starkingdoms.tk/starkingdoms.tk/build_env:2024040603
    commands:
      - cd starkingdoms-backplane
      - rustfmt **/*.rs --check --edition 2021 --color always
    environment:
      CARGO_INCREMENTAL: "0"
  - name: backplane_clippy
    image: coresdev/stk_build_env
    image: registry.gitlab.com/starkingdoms.tk/starkingdoms.tk/build_env:2024040603
    commands:
      - cd starkingdoms-backplane
      - cargo clippy --profile release-ci --color always
    environment:
      CARGO_INCREMENTAL: "0"
  - name: backplane_build
    image: coresdev/stk_build_env
    image: registry.gitlab.com/starkingdoms.tk/starkingdoms.tk/build_env:2024040603
    commands:
      - cd starkingdoms-backplane
      - cargo build --profile release-ci --color always

M .woodpecker/.client.yaml => .woodpecker/.client.yaml +12 -2
@@ 5,6 5,7 @@ steps:
      - cd starkingdoms-client
      - yarn
      - yarn prettier . --check

  - name: client_build
    depends_on:
      - client_fmt


@@ 13,5 14,14 @@ steps:
      - cd starkingdoms-client
      - yarn
      - yarn build
      - cd dist
      - tar cJvf client.tar.xz *
\ No newline at end of file

  - name: build_image
    depends_on:
      - client_build
    image: node
    commands:
      - cd starkingdoms-client
      - docker login registry.gitlab.com -u c0repwn3r -p $GITLAB_TOKEN
      - docker build . -t registry.gitlab.com/starkingdoms.tk/starkingdoms.tk/client:$(git describe --always)
      - docker push registry.gitlab.com/starkingdoms.tk/starkingdoms.tk/client:$(git describe --always)
    secrets: [ gitlab_token ]
\ No newline at end of file

M .woodpecker/.server.yaml => .woodpecker/.server.yaml +3 -3
@@ 1,20 1,20 @@
steps:
  - name: server_fmt
    image: coresdev/stk_build_env
    image: registry.gitlab.com/starkingdoms.tk/starkingdoms.tk/build_env:2024040603
    commands:
      - cd server
      - rustfmt **/*.rs --check --edition 2021 --color always
    environment:
      CARGO_INCREMENTAL: "0"
  - name: server_clippy
    image: coresdev/stk_build_env
    image: registry.gitlab.com/starkingdoms.tk/starkingdoms.tk/build_env:2024040603
    commands:
      - cd server
      - cargo clippy --profile release-ci --color always
    environment:
      CARGO_INCREMENTAL: "0"
  - name: server_build
    image: coresdev/stk_build_env
    image: registry.gitlab.com/starkingdoms.tk/starkingdoms.tk/build_env:2024040603
    commands:
      - cd server
      - cargo build --profile release-ci --color always

D ansible/deploy.yml => ansible/deploy.yml +0 -28
@@ 1,28 0,0 @@
- name: Deploy game servers
  hosts: gameservers
  connection: ssh
  tasks:
    - name: Ensure host connectivity
      ansible.builtin.ping:
    - name: Stop game server
      ansible.builtin.command:
        cmd: sv stop starkingdoms
      become: true
    - name: Download new game server file
      ansible.builtin.get_url:
        url: "{{ server_binary_url }}"
        dest: /opt/starkingdoms/starkingdoms-server
        mode: '0777'
    - name: Remove old client assets
      ansible.builtin.shell:
        cmd: rm -rf assets
        chdir: /opt/starkingdoms/client/
    - name: Download and unpack client package
      ansible.builtin.unarchive:
        src: "{{ client_package_url }}"
        dest: /opt/starkingdoms/client/
        remote_src: yes
    - name: Start game server
      ansible.builtin.command:
        cmd: sv start starkingdoms
      become: true
\ No newline at end of file

D ansible/deploy_backplane.yml => ansible/deploy_backplane.yml +0 -19
@@ 1,19 0,0 @@
- name: Deploy backplane
  hosts: backplaneservers
  connection: ssh
  tasks:
    - name: Ensure host connectivity
      ansible.builtin.ping:
    - name: Stop backplane server
      ansible.builtin.command:
        cmd: sv stop starkingdoms-backplane
      become: true
    - name: Download new game server file
      ansible.builtin.get_url:
        url: "{{ backplane_binary_url }}"
        dest: /opt/starkingdoms-backplane/starkingdoms-backplane
        mode: '0777'
    - name: Start backplane server
      ansible.builtin.command:
        cmd: sv start starkingdoms-backplane
      become: true
\ No newline at end of file

D ansible/environments/beta.yml => ansible/environments/beta.yml +0 -30
@@ 1,30 0,0 @@
gameservers:
  hosts:
    srv01.beta.envs.starkingdoms.io:
      ansible_port: 20451
      ansible_password: !vault |
        $ANSIBLE_VAULT;1.1;AES256
        33386562363537373139313435386332323434366136346166393864336538306634373233323666
        6632646535373462313665663433663533393038353132370a366634323765633031313265313264
        37616232666538383737306461336131623634623534646161623738333861633662613464396232
        3665373430376137640a663435616461323732316632343061353336366538383937363830663132
        61303033353330653065353465663437303030663733646662636539353164396237626435383534
        3765366461396264393563616638393138633233303537303466
      ansible_become_password: !vault |
        $ANSIBLE_VAULT;1.1;AES256
        33386562363537373139313435386332323434366136346166393864336538306634373233323666
        6632646535373462313665663433663533393038353132370a366634323765633031313265313264
        37616232666538383737306461336131623634623534646161623738333861633662613464396232
        3665373430376137640a663435616461323732316632343061353336366538383937363830663132
        61303033353330653065353465663437303030663733646662636539353164396237626435383534
        3765366461396264393563616638393138633233303537303466
  vars:
    ansible_user: stk
apiservers:
  hosts:
    srv02.beta.envs.starkingdoms.io:
      ansible_port: 20551
      ansible_password: TODO
      ansible_become_password: TODO
  vars:
    ansible_user: stk
\ No newline at end of file

D ansible/environments/stable.yml => ansible/environments/stable.yml +0 -30
@@ 1,30 0,0 @@
gameservers:
  hosts:
    srv01.stable.envs.starkingdoms.io:
      ansible_port: 20450
      ansible_password: !vault |
        $ANSIBLE_VAULT;1.1;AES256
        35333334373234333231336333623532656638326438323230656133326362653465613739346636
        6139383536323339343963663763656439396564323633660a666237666537653639636431303664
        39663839623466646233313930306234653039393866336165363763363430393539383138643939
        6438653437373565300a343763373037383265626434316362393866336234633730386664326435
        32666335356338633339353839623539343234393465343061323730623366653563656135366237
        6633653335383836636333393064623139646366383831393430
      ansible_become_password: !vault |
        $ANSIBLE_VAULT;1.1;AES256
        35333334373234333231336333623532656638326438323230656133326362653465613739346636
        6139383536323339343963663763656439396564323633660a666237666537653639636431303664
        39663839623466646233313930306234653039393866336165363763363430393539383138643939
        6438653437373565300a343763373037383265626434316362393866336234633730386664326435
        32666335356338633339353839623539343234393465343061323730623366653563656135366237
        6633653335383836636333393064623139646366383831393430
  vars:
    ansible_user: stk
apiservers:
  hosts:
    srv02.stable.envs.starkingdoms.io:
      ansible_port: 20550
      ansible_password: TODO
      ansible_become_password: TODO
  vars:
    ansible_user: stk
\ No newline at end of file

D ansible/environments/unstable.yml => ansible/environments/unstable.yml +0 -30
@@ 1,30 0,0 @@
gameservers:
  hosts:
    srv01.unstable.envs.starkingdoms.io:
      ansible_port: 20452
      ansible_password: !vault |
        $ANSIBLE_VAULT;1.1;AES256
        30633533383938356363613936373132616565383938343732346462633263383237356364656139
        6564373961356564623930363538616539326562343733390a616564636332373666386531313033
        65623837366639393462333830616562366136343630393833393966663062343438326333393565
        3961663664623962310a663265313036663835636638636561303363373962303139396235633631
        32646362336332356630633138613765616563653164316134306463316466326266623863343631
        3134616435636662666637623638383736343064626564616135
      ansible_become_password: !vault |
        $ANSIBLE_VAULT;1.1;AES256
        30633533383938356363613936373132616565383938343732346462633263383237356364656139
        6564373961356564623930363538616539326562343733390a616564636332373666386531313033
        65623837366639393462333830616562366136343630393833393966663062343438326333393565
        3961663664623962310a663265313036663835636638636561303363373962303139396235633631
        32646362336332356630633138613765616563653164316134306463316466326266623863343631
        3134616435636662666637623638383736343064626564616135
  vars:
    ansible_user: stk
apiservers:
  hosts:
    srv02.unstable.envs.starkingdoms.io:
      ansible_port: 20552
      ansible_password: TODO
      ansible_become_password: TODO
  vars:
    ansible_user: stk
\ No newline at end of file

D ansible/global/backplane.yml => ansible/global/backplane.yml +0 -21
@@ 1,21 0,0 @@
backplaneservers:
  hosts:
    backplane.starkingdoms.io:
      ansible_password: !vault |
        $ANSIBLE_VAULT;1.1;AES256
        33613063633464623864346239346332383035366462393733643765376464363330326464353761
        3138363931396161326338313836303931643066316231650a383134383431316265623763613739
        39336332346130343133613831343533306435396337383663363561623831653230663036343463
        3531386332663837340a363737386338623765326330383738643031623734616538653236623131
        36323438343633323838333961616266643263343334366334346631656363383033383364366262
        6636386161313530646564363131346266393061386563303132
      ansible_become_password: !vault |
        $ANSIBLE_VAULT;1.1;AES256
        33613063633464623864346239346332383035366462393733643765376464363330326464353761
        3138363931396161326338313836303931643066316231650a383134383431316265623763613739
        39336332346130343133613831343533306435396337383663363561623831653230663036343463
        3531386332663837340a363737386338623765326330383738643031623734616538653236623131
        36323438343633323838333961616266643263343334366334346631656363383033383364366262
        6636386161313530646564363131346266393061386563303132
  vars:
    ansible_user: team
\ No newline at end of file

M docker/Dockerfile.build_env => docker/Dockerfile.build_env +3 -3
@@ 1,7 1,7 @@
FROM rust
FROM rust:slim

# Note that we add wget here
RUN apt-get update && apt-get install --yes libpq-dev wget
RUN apt-get update && apt-get install --yes libpq-dev wget build-essential git

# Install sccache to greatly speedup builds in the CI
RUN wget https://github.com/mozilla/sccache/releases/download/v0.7.4/sccache-v0.7.4-x86_64-unknown-linux-musl.tar.gz \


@@ 9,4 9,4 @@ RUN wget https://github.com/mozilla/sccache/releases/download/v0.7.4/sccache-v0.
    && mv sccache-v0.7.4-x86_64-unknown-linux-musl/sccache /usr/local/bin/sccache \
    && chmod +x /usr/local/bin/sccache

RUN rustup component add rustfmt && rustup component add clippy
RUN rustup self update && rustup update && rustup component add rustfmt && rustup component add clippy

A starkingdoms-client/Dockerfile => starkingdoms-client/Dockerfile +5 -0
@@ 0,0 1,5 @@
FROM node:21-alpine

COPY dist .

RUN cd dist && node .

M starkingdoms-client/src/pages/Play.svelte => starkingdoms-client/src/pages/Play.svelte +1 -1
@@ 10,10 10,10 @@
  import { onMount } from "svelte";
  import Popup from "../components/ui/Popup.svelte";
  import Checkbox from "../components/ui/Checkbox.svelte";
  import Button from "../components/ui/Button.svelte";
  import { global } from "../globals.ts";
  import { PacketType } from "../protocol.ts";
  import * as PIXI from "pixi.js";
  import Button from "../components/ui/Button.svelte";

  let config = DEFAULT_CONFIG;


M starkingdoms-client/src/pages/ShipEditor.svelte => starkingdoms-client/src/pages/ShipEditor.svelte +3 -5
@@ 303,8 303,6 @@
    let children = [null, null, null, null];
    let x_dir = Math.round(Math.cos(((rotation + 1) * Math.PI) / 2));
    let y_dir = Math.round(Math.sin(((rotation + 1) * Math.PI) / 2));
    console.log(x_dir + ", " + y_dir + "(" + rotation + ")");
    console.log(grid.get(x)?.get(y + y_dir));
    if (part_type == PartType.Hearty) {
      if (grid.get(x + 1)?.get(y)?.[1] == 1) {
        // right


@@ 343,10 341,10 @@
    }*/
    if (grid.get(x)?.get(y - y_dir)?.[1] == rotation) {
      // up
      children[0] = save_recursive(x, y - y_dir, rotation);
      children[2] = save_recursive(x, y - y_dir, rotation);
    }

    return { part_type: part_type, children: children };
    return [part_type, children];
  }

  function save_btn() {


@@ 360,7 358,7 @@
          unused_modules.push([part_type, unused]);
        }
      }
      let save_data = { children: children, unused_modules: unused_modules };
      let save_data = [children, unused_modules];
      console.log(save_data);
      //window.location.href = "/";
    }