Compare commits
1 Commits
66a7b9e7e6
...
fix/insecu
| Author | SHA1 | Date | |
|---|---|---|---|
| 763893c5d9 |
@@ -30,6 +30,10 @@ jobs:
|
||||
|
||||
CREDS="${{ secrets.REGISTRY_USER }}:${{ secrets.REGISTRY_PASSWORD }}"
|
||||
|
||||
echo "=== debug: Www-Authenticate header ==="
|
||||
curl -sk -I https://git.kimchi/v2/ | grep -i www-authenticate || true
|
||||
echo ""
|
||||
|
||||
echo "=== buildah push tag ==="
|
||||
buildah push --tls-verify=false --creds "$CREDS" "$IMAGE_TAG"
|
||||
|
||||
@@ -38,13 +42,15 @@ jobs:
|
||||
|
||||
echo "IMAGE_TAG=$IMAGE_TAG" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Restart deployment on k3s
|
||||
- name: Deploy to k3s
|
||||
run: |
|
||||
mkdir -p ~/.kube
|
||||
echo "${{ secrets.KUBECONFIG }}" | base64 -d > ~/.kube/config
|
||||
echo "${{ secrets.KUBECONFIG }}" > ~/.kube/config
|
||||
chmod 600 ~/.kube/config
|
||||
kubectl delete pod -l app=${{ env.DEPLOYMENT }} -n ${{ env.NAMESPACE }}
|
||||
|
||||
POD_NAME=$(kubectl get pods -l app=jnr-web -n jnr-web -o jsonpath='{.items[0].metadata.name}')
|
||||
echo "Deleting running pod" "$POD_NAME"
|
||||
|
||||
kubectl set image deployment/${{ env.DEPLOYMENT }} \
|
||||
${{ env.DEPLOYMENT }}="${{ env.IMAGE_TAG }}" \
|
||||
-n ${{ env.NAMESPACE }}
|
||||
|
||||
kubectl rollout status deployment/${{ env.DEPLOYMENT }} \
|
||||
-n ${{ env.NAMESPACE }} --timeout=60s
|
||||
17
AGENTS.md
17
AGENTS.md
@@ -256,23 +256,6 @@ incremental progress.
|
||||
- Draw layers: BG → entities → FG → particles → HUD
|
||||
- Camera transforms world coords to screen coords
|
||||
|
||||
## Remote Git Server
|
||||
|
||||
The remote git server is a Gitea instance. Use the **`tea` CLI** (not `gh`) for all remote
|
||||
operations: pull requests, issues, releases, and repository management.
|
||||
|
||||
```bash
|
||||
tea pr create --title "..." --description "..." # Create a pull request
|
||||
tea pr list # List open PRs
|
||||
tea issue list # List issues
|
||||
tea issue create --title "..." --description "..."
|
||||
tea pr merge <number> # Merge a PR
|
||||
```
|
||||
|
||||
Do NOT use `gh` (GitHub CLI) — it will not work with this remote.
|
||||
|
||||
After creating a pull request, always check out the `main` branch (`git checkout main`).
|
||||
|
||||
## Commit Messages
|
||||
- Imperative mood, concise
|
||||
- No co-authored-by or AI attribution
|
||||
|
||||
@@ -530,124 +530,6 @@ void particle_emit_wall_slide_dust(Vec2 pos, int wall_dir) {
|
||||
particle_emit(&dust);
|
||||
}
|
||||
|
||||
void particle_emit_hit_sparks(Vec2 pos) {
|
||||
/* Bright orange-white sparks — fast, short-lived, spray outward */
|
||||
ParticleBurst sparks = {
|
||||
.origin = pos,
|
||||
.count = 8,
|
||||
.speed_min = 60.0f,
|
||||
.speed_max = 180.0f,
|
||||
.life_min = 0.08f,
|
||||
.life_max = 0.2f,
|
||||
.size_min = 1.0f,
|
||||
.size_max = 2.0f,
|
||||
.spread = (float)M_PI,
|
||||
.direction = 0,
|
||||
.drag = 3.0f,
|
||||
.gravity_scale = 0.4f,
|
||||
.color = {255, 200, 100, 255}, /* orange-white */
|
||||
.color_vary = true,
|
||||
};
|
||||
particle_emit(&sparks);
|
||||
|
||||
/* Brief white flash at impact point */
|
||||
ParticleBurst flash = {
|
||||
.origin = pos,
|
||||
.count = 3,
|
||||
.speed_min = 5.0f,
|
||||
.speed_max = 15.0f,
|
||||
.life_min = 0.03f,
|
||||
.life_max = 0.06f,
|
||||
.size_min = 2.0f,
|
||||
.size_max = 3.5f,
|
||||
.spread = (float)M_PI,
|
||||
.direction = 0,
|
||||
.drag = 8.0f,
|
||||
.gravity_scale = 0.0f,
|
||||
.color = {255, 255, 230, 255}, /* bright white */
|
||||
.color_vary = false,
|
||||
};
|
||||
particle_emit(&flash);
|
||||
}
|
||||
|
||||
void particle_emit_metal_explosion(Vec2 pos) {
|
||||
/* Metal shrapnel — fast grey/silver chunks flying outward */
|
||||
ParticleBurst shrapnel = {
|
||||
.origin = pos,
|
||||
.count = 16,
|
||||
.speed_min = 60.0f,
|
||||
.speed_max = 200.0f,
|
||||
.life_min = 0.2f,
|
||||
.life_max = 0.6f,
|
||||
.size_min = 1.5f,
|
||||
.size_max = 3.5f,
|
||||
.spread = (float)M_PI,
|
||||
.direction = 0,
|
||||
.drag = 2.0f,
|
||||
.gravity_scale = 0.5f,
|
||||
.color = {180, 180, 190, 255}, /* silver-grey */
|
||||
.color_vary = true,
|
||||
};
|
||||
particle_emit(&shrapnel);
|
||||
|
||||
/* Hot orange sparks — electrical/mechanical innards */
|
||||
ParticleBurst sparks = {
|
||||
.origin = pos,
|
||||
.count = 10,
|
||||
.speed_min = 40.0f,
|
||||
.speed_max = 150.0f,
|
||||
.life_min = 0.15f,
|
||||
.life_max = 0.35f,
|
||||
.size_min = 1.0f,
|
||||
.size_max = 2.5f,
|
||||
.spread = (float)M_PI,
|
||||
.direction = 0,
|
||||
.drag = 2.5f,
|
||||
.gravity_scale = 0.3f,
|
||||
.color = {255, 160, 40, 255}, /* hot orange */
|
||||
.color_vary = true,
|
||||
};
|
||||
particle_emit(&sparks);
|
||||
|
||||
/* Bright white flash at center — brief pop */
|
||||
ParticleBurst flash = {
|
||||
.origin = pos,
|
||||
.count = 5,
|
||||
.speed_min = 5.0f,
|
||||
.speed_max = 20.0f,
|
||||
.life_min = 0.04f,
|
||||
.life_max = 0.08f,
|
||||
.size_min = 3.0f,
|
||||
.size_max = 5.0f,
|
||||
.spread = (float)M_PI,
|
||||
.direction = 0,
|
||||
.drag = 8.0f,
|
||||
.gravity_scale = 0.0f,
|
||||
.color = {255, 240, 200, 255}, /* bright flash */
|
||||
.color_vary = false,
|
||||
};
|
||||
particle_emit(&flash);
|
||||
|
||||
/* Smoke cloud — slower, lingers */
|
||||
ParticleBurst smoke = {
|
||||
.origin = pos,
|
||||
.count = 8,
|
||||
.speed_min = 15.0f,
|
||||
.speed_max = 50.0f,
|
||||
.life_min = 0.3f,
|
||||
.life_max = 0.7f,
|
||||
.size_min = 2.5f,
|
||||
.size_max = 4.5f,
|
||||
.spread = (float)M_PI,
|
||||
.direction = 0,
|
||||
.drag = 3.5f,
|
||||
.gravity_scale = -0.1f, /* floats up */
|
||||
.color = {120, 120, 130, 180}, /* dark smoke */
|
||||
.color_vary = true,
|
||||
};
|
||||
particle_emit(&smoke);
|
||||
}
|
||||
|
||||
/* Spawn a single dust mote with the given visual properties. */
|
||||
static void spawn_dust_mote(Vec2 pos, Vec2 vel,
|
||||
float life_min, float life_max,
|
||||
|
||||
@@ -89,12 +89,6 @@ void particle_emit_muzzle_flash(Vec2 pos, Vec2 shoot_dir);
|
||||
/* Wall slide dust (small puffs while scraping against a wall) */
|
||||
void particle_emit_wall_slide_dust(Vec2 pos, int wall_dir);
|
||||
|
||||
/* Metal hit sparks (turret/machine takes non-lethal damage) */
|
||||
void particle_emit_hit_sparks(Vec2 pos);
|
||||
|
||||
/* Metal explosion (turret/machine death — shrapnel + flash) */
|
||||
void particle_emit_metal_explosion(Vec2 pos);
|
||||
|
||||
/* Ambient atmosphere dust (call each frame for Mars Surface levels).
|
||||
* Spawns subtle dust motes around the camera viewport that drift with wind.
|
||||
* cam_pos = camera top-left world position, vp = viewport size in pixels. */
|
||||
|
||||
@@ -5,46 +5,9 @@
|
||||
#include "engine/renderer.h"
|
||||
#include "engine/particle.h"
|
||||
#include "engine/audio.h"
|
||||
#include "config.h"
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
/* ── Shared helpers ───────────────────────────────── */
|
||||
|
||||
/* Kill enemy if it fell past the bottom of the level. */
|
||||
static bool enemy_check_level_bottom(Entity *self, const Tilemap *map,
|
||||
EntityManager *em) {
|
||||
float level_bottom = (float)(map->height * TILE_SIZE);
|
||||
if (self->body.pos.y > level_bottom) {
|
||||
self->flags |= ENTITY_DEAD;
|
||||
self->health = 0;
|
||||
entity_destroy(em, self);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check for cliff ahead of a ground enemy. Returns true if cliff detected.
|
||||
* Uses a wider lookahead that scales with speed for fast-moving enemies. */
|
||||
static bool enemy_detect_cliff(const Body *body, float patrol_dir,
|
||||
float speed, const Tilemap *map) {
|
||||
if (!body->on_ground) return false;
|
||||
|
||||
/* Scale lookahead with speed: at least 4px, up to speed/10 */
|
||||
float lookahead = speed * 0.1f;
|
||||
if (lookahead < 4.0f) lookahead = 4.0f;
|
||||
|
||||
float check_x = (patrol_dir > 0) ?
|
||||
body->pos.x + body->size.x + lookahead :
|
||||
body->pos.x - lookahead;
|
||||
float check_y = body->pos.y + body->size.y + 4.0f;
|
||||
|
||||
int tx = world_to_tile(check_x);
|
||||
int ty = world_to_tile(check_y);
|
||||
|
||||
return !tilemap_is_solid(map, tx, ty);
|
||||
}
|
||||
|
||||
/* ════════════════════════════════════════════════════
|
||||
* GRUNT - ground patrol enemy
|
||||
* ════════════════════════════════════════════════════ */
|
||||
@@ -57,9 +20,6 @@ static void grunt_update(Entity *self, float dt, const Tilemap *map) {
|
||||
|
||||
Body *body = &self->body;
|
||||
|
||||
/* Kill if fallen off bottom of level */
|
||||
if (enemy_check_level_bottom(self, map, s_grunt_em)) return;
|
||||
|
||||
/* Death sequence */
|
||||
if (self->flags & ENTITY_DEAD) {
|
||||
animation_set(&self->anim, &anim_grunt_death);
|
||||
@@ -88,10 +48,19 @@ static void grunt_update(Entity *self, float dt, const Tilemap *map) {
|
||||
gd->patrol_dir = -gd->patrol_dir;
|
||||
}
|
||||
|
||||
/* Turn around at ledge */
|
||||
if (enemy_detect_cliff(body, gd->patrol_dir, GRUNT_SPEED, map)) {
|
||||
gd->patrol_dir = -gd->patrol_dir;
|
||||
body->vel.x = 0;
|
||||
/* Turn around at ledge: check if there's ground ahead */
|
||||
if (body->on_ground) {
|
||||
float check_x = (gd->patrol_dir > 0) ?
|
||||
body->pos.x + body->size.x + 2.0f :
|
||||
body->pos.x - 2.0f;
|
||||
float check_y = body->pos.y + body->size.y + 4.0f;
|
||||
|
||||
int tx = world_to_tile(check_x);
|
||||
int ty = world_to_tile(check_y);
|
||||
|
||||
if (!tilemap_is_solid(map, tx, ty)) {
|
||||
gd->patrol_dir = -gd->patrol_dir;
|
||||
}
|
||||
}
|
||||
|
||||
/* Animation */
|
||||
@@ -177,14 +146,12 @@ static Entity *find_player(EntityManager *em) {
|
||||
}
|
||||
|
||||
static void flyer_update(Entity *self, float dt, const Tilemap *map) {
|
||||
(void)map; /* flyers don't collide with tiles */
|
||||
FlyerData *fd = (FlyerData *)self->data;
|
||||
if (!fd) return;
|
||||
|
||||
Body *body = &self->body;
|
||||
|
||||
/* Kill if fallen off bottom of level */
|
||||
if (enemy_check_level_bottom(self, map, s_flyer_em)) return;
|
||||
|
||||
/* Death sequence */
|
||||
if (self->flags & ENTITY_DEAD) {
|
||||
animation_set(&self->anim, &anim_flyer_death);
|
||||
@@ -322,9 +289,6 @@ static void charger_update(Entity *self, float dt, const Tilemap *map) {
|
||||
|
||||
Body *body = &self->body;
|
||||
|
||||
/* Kill if fallen off bottom of level */
|
||||
if (enemy_check_level_bottom(self, map, s_charger_em)) return;
|
||||
|
||||
/* Death sequence */
|
||||
if (self->flags & ENTITY_DEAD) {
|
||||
animation_set(&self->anim, &anim_charger_death);
|
||||
@@ -355,10 +319,14 @@ static void charger_update(Entity *self, float dt, const Tilemap *map) {
|
||||
}
|
||||
|
||||
/* Reverse at ledge */
|
||||
if (enemy_detect_cliff(body, cd->patrol_dir,
|
||||
CHARGER_PATROL_SPEED, map)) {
|
||||
cd->patrol_dir = -cd->patrol_dir;
|
||||
body->vel.x = 0;
|
||||
if (body->on_ground) {
|
||||
float cx = (cd->patrol_dir > 0) ?
|
||||
body->pos.x + body->size.x + 2.0f :
|
||||
body->pos.x - 2.0f;
|
||||
float cy = body->pos.y + body->size.y + 4.0f;
|
||||
if (!tilemap_is_solid(map, world_to_tile(cx), world_to_tile(cy))) {
|
||||
cd->patrol_dir = -cd->patrol_dir;
|
||||
}
|
||||
}
|
||||
|
||||
/* Detect player — horizontal line-of-sight */
|
||||
@@ -542,12 +510,10 @@ static int count_alive_grunts(EntityManager *em) {
|
||||
}
|
||||
|
||||
static void spawner_update(Entity *self, float dt, const Tilemap *map) {
|
||||
(void)map;
|
||||
SpawnerData *sd = (SpawnerData *)self->data;
|
||||
if (!sd) return;
|
||||
|
||||
/* Kill if fallen off bottom of level */
|
||||
if (enemy_check_level_bottom(self, map, s_spawner_em)) return;
|
||||
|
||||
/* Death sequence */
|
||||
if (self->flags & ENTITY_DEAD) {
|
||||
animation_set(&self->anim, &anim_spawner_death);
|
||||
|
||||
@@ -177,45 +177,36 @@ static Camera *s_active_camera = NULL;
|
||||
|
||||
static void damage_entity(Entity *target, int damage) {
|
||||
target->health -= damage;
|
||||
|
||||
Vec2 center = vec2(
|
||||
target->body.pos.x + target->body.size.x * 0.5f,
|
||||
target->body.pos.y + target->body.size.y * 0.5f
|
||||
);
|
||||
|
||||
if (target->health <= 0) {
|
||||
target->flags |= ENTITY_DEAD;
|
||||
|
||||
/* Death particles — turrets get a metal explosion, others a puff */
|
||||
if (target->type == ENT_TURRET || target->type == ENT_LASER_TURRET) {
|
||||
particle_emit_metal_explosion(center);
|
||||
/* Death particles — centered on entity */
|
||||
Vec2 center = vec2(
|
||||
target->body.pos.x + target->body.size.x * 0.5f,
|
||||
target->body.pos.y + target->body.size.y * 0.5f
|
||||
);
|
||||
SDL_Color death_color;
|
||||
if (target->type == ENT_ENEMY_GRUNT) {
|
||||
death_color = (SDL_Color){200, 60, 60, 255}; /* red debris */
|
||||
} else if (target->type == ENT_ENEMY_FLYER) {
|
||||
death_color = (SDL_Color){140, 80, 200, 255}; /* purple puff */
|
||||
} else if (target->type == ENT_TURRET || target->type == ENT_LASER_TURRET) {
|
||||
death_color = (SDL_Color){160, 160, 160, 255}; /* metal scraps */
|
||||
} else if (target->type == ENT_ENEMY_CHARGER) {
|
||||
death_color = (SDL_Color){220, 140, 40, 255}; /* orange spark */
|
||||
} else if (target->type == ENT_SPAWNER) {
|
||||
death_color = (SDL_Color){180, 60, 180, 255}; /* purple burst */
|
||||
} else {
|
||||
SDL_Color death_color;
|
||||
if (target->type == ENT_ENEMY_GRUNT) {
|
||||
death_color = (SDL_Color){200, 60, 60, 255};
|
||||
} else if (target->type == ENT_ENEMY_FLYER) {
|
||||
death_color = (SDL_Color){140, 80, 200, 255};
|
||||
} else if (target->type == ENT_ENEMY_CHARGER) {
|
||||
death_color = (SDL_Color){220, 140, 40, 255};
|
||||
} else if (target->type == ENT_SPAWNER) {
|
||||
death_color = (SDL_Color){180, 60, 180, 255};
|
||||
} else {
|
||||
death_color = (SDL_Color){200, 200, 200, 255};
|
||||
}
|
||||
particle_emit_death_puff(center, death_color);
|
||||
death_color = (SDL_Color){200, 200, 200, 255}; /* grey */
|
||||
}
|
||||
particle_emit_death_puff(center, death_color);
|
||||
|
||||
/* Screen shake on kill — stronger for turret explosions */
|
||||
/* Screen shake on kill */
|
||||
if (s_active_camera) {
|
||||
float intensity = (target->type == ENT_TURRET ||
|
||||
target->type == ENT_LASER_TURRET) ? 3.5f : 2.0f;
|
||||
camera_shake(s_active_camera, intensity, 0.15f);
|
||||
camera_shake(s_active_camera, 2.0f, 0.15f);
|
||||
}
|
||||
|
||||
audio_play_sound_at(s_sfx_enemy_death, 80, center, 0);
|
||||
} else if (target->type == ENT_TURRET || target->type == ENT_LASER_TURRET) {
|
||||
/* Hit marker sparks on non-lethal turret damage */
|
||||
particle_emit_hit_sparks(center);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,14 +228,11 @@ static void damage_player(Entity *player, int damage, Entity *source) {
|
||||
ppd->inv_timer = PLAYER_INV_TIME;
|
||||
player->flags |= ENTITY_INVINCIBLE;
|
||||
|
||||
/* Knockback away from source, scaled by source speed */
|
||||
/* Knockback away from source */
|
||||
if (source) {
|
||||
float knock_dir = (player->body.pos.x < source->body.pos.x) ?
|
||||
-1.0f : 1.0f;
|
||||
float src_speed = fabsf(source->body.vel.x);
|
||||
float knock_str = 150.0f;
|
||||
if (src_speed > knock_str) knock_str = src_speed;
|
||||
player->body.vel.x = knock_dir * knock_str;
|
||||
player->body.vel.x = knock_dir * 150.0f;
|
||||
player->body.vel.y = -150.0f;
|
||||
}
|
||||
}
|
||||
@@ -306,7 +294,8 @@ static void handle_collisions(EntityManager *em) {
|
||||
}
|
||||
|
||||
/* ── Enemy contact damage to player ──── */
|
||||
if (player && entity_is_enemy(a) && !(a->flags & ENTITY_DEAD)) {
|
||||
if (player && !(player->flags & ENTITY_INVINCIBLE) &&
|
||||
entity_is_enemy(a) && !(a->flags & ENTITY_DEAD)) {
|
||||
if (physics_overlap(&a->body, &player->body)) {
|
||||
/* Check if player is stomping (falling onto enemy from above) */
|
||||
bool stomping = (player->body.vel.y > 0) &&
|
||||
@@ -318,16 +307,8 @@ static void handle_collisions(EntityManager *em) {
|
||||
damage_entity(a, 2);
|
||||
if (a->flags & ENTITY_DEAD) stats_record_kill();
|
||||
player->body.vel.y = -PLAYER_JUMP_FORCE * 0.7f;
|
||||
} else if (!(player->flags & ENTITY_INVINCIBLE)) {
|
||||
/* Charger deals extra damage and knockback while charging */
|
||||
int dmg = a->damage;
|
||||
if (a->type == ENT_ENEMY_CHARGER) {
|
||||
ChargerData *cd = (ChargerData *)a->data;
|
||||
if (cd && cd->state == CHARGER_CHARGE) {
|
||||
dmg = 2;
|
||||
}
|
||||
}
|
||||
damage_player(player, dmg, a);
|
||||
} else {
|
||||
damage_player(player, a->damage, a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,8 +308,8 @@ void player_update(Entity *self, float dt, const Tilemap *map) {
|
||||
pd->dash_timer = PLAYER_DASH_DURATION;
|
||||
pd->dash_dir = vec2(0.0f, 1.0f);
|
||||
|
||||
/* Invincibility during dash + short grace period after */
|
||||
pd->inv_timer = PLAYER_DASH_DURATION + PLAYER_DASH_INV_GRACE;
|
||||
/* Brief invincibility during dash */
|
||||
pd->inv_timer = PLAYER_DASH_DURATION;
|
||||
self->flags |= ENTITY_INVINCIBLE;
|
||||
|
||||
/* Jetpack burst downward */
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
|
||||
/* Invincibility after taking damage */
|
||||
#define PLAYER_INV_TIME 1.5f /* seconds of invincibility */
|
||||
#define PLAYER_DASH_INV_GRACE 0.15f /* extra invincibility after dash */
|
||||
|
||||
/* Aim direction (for shooting) */
|
||||
typedef enum AimDir {
|
||||
|
||||
Reference in New Issue
Block a user