Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed airdrop glitch #341

Merged
merged 5 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions client/src/scripts/managers/uiManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1038,8 +1038,7 @@ export class UIManager {
case KillfeedMessageType.KillLeaderAssigned: {
if (victimId === this.game.activePlayerID) {
classes.push("kill-feed-item-killer");
}
else {
} else {
classes.push("kill-feed-kill-leader");
}

Expand Down Expand Up @@ -1071,11 +1070,9 @@ export class UIManager {
}`;
if (attackerId === this.game.activePlayerID) {
classes.push("kill-feed-item-killer");
}
else if (victimId === this.game.activePlayerID) {
} else if (victimId === this.game.activePlayerID) {
classes.push("kill-feed-item-victim");
}
else {
} else {
classes.push("kill-feed-kill-leader");
}
this.game.soundManager.play("kill_leader_dead");
Expand Down Expand Up @@ -1281,8 +1278,7 @@ class PlayerHealthUI {

if (teammate) {
this.nameLabel.text(teammate.name);
}
else {
} else {
this.nameLabel.text("Loading..");
}
}
Expand Down
14 changes: 7 additions & 7 deletions client/src/scripts/news/newsPosts.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { type NewsPost } from "./newsHelper";

export const news: NewsPost[] = [
{
date: 1717870665000,
author: "HAZEL",
title: "Back in the Saddle",
bannerImage: "../img/news/v0.18.0.png",
content: `After a long break, we're back with some important updates and fun changes. Although we're late, we're celebrating Suroi's 1 year birthday with some new items, and even more exciting, limited edition squads.<br><br>
{
date: 1717870665000,
author: "HAZEL",
title: "Back in the Saddle",
bannerImage: "../img/news/v0.18.0.png",
content: `After a long break, we're back with some important updates and fun changes. Although we're late, we're celebrating Suroi's 1 year birthday with some new items, and even more exciting, limited edition squads.<br><br>

A revamped moderation system is here to combat those cheater pests with improved efficiency. Say hello to our new Game Moderatrs on Discord!<br><br>

There's also a new structure, the large bridge. While huge in proportion, it offers plenty of cover and close quarter combat. It's also a perfect spot to set up your squad in a defensive position!<br><br>

Lots of changes and bug fixes have made it into this update, so check out the full log. Thank you everyone for sticking with us!`,
longContent: `<h2>Suroi v0.18.0</h2>
longContent: `<h2>Suroi v0.18.0</h2>
<h3>New features</h3>
<ul>
<li><strong>Squads!</strong> To celebrate Suroi's 1st birthday, squads will be available for the next week only. They will be back once we have enough players.</li>
Expand Down
4 changes: 2 additions & 2 deletions server/src/data/maps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ const maps = {
beachSize: 8,
oceanSize: 8,
genCallback(map) {
map.game.addLoot("vector", Vec.create(this.width / 2, this.height / 2 - 10));
map.game.addLoot("9mm", Vec.create(this.width / 2, this.height / 2 - 10), { count: Infinity });
map.game.addLoot("radio", Vec.create(this.width / 2, this.height / 2 - 10));
map.game.addLoot("curadell", Vec.create(this.width / 2, this.height / 2 - 10), { count: Infinity });
}
},
gunsTest: (() => {
Expand Down
22 changes: 21 additions & 1 deletion server/src/objects/parachute.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { create } from "domain";

Check failure on line 1 in server/src/objects/parachute.ts

View workflow job for this annotation

GitHub Actions / Lint

'create' is defined but never used

Check failure on line 1 in server/src/objects/parachute.ts

View workflow job for this annotation

GitHub Actions / Lint

'create' is defined but never used

Check failure on line 1 in server/src/objects/parachute.ts

View workflow job for this annotation

GitHub Actions / Lint

'create' is defined but never used

Check failure on line 1 in server/src/objects/parachute.ts

View workflow job for this annotation

GitHub Actions / Lint

'create' is defined but never used
import { GameConstants, KillfeedEventType, ObjectCategory } from "../../../common/src/constants";
import { CircleHitbox } from "../../../common/src/utils/hitbox";
import { Angle, Numeric } from "../../../common/src/utils/math";
import { type FullData } from "../../../common/src/utils/objectsSerializations";
import { type Vector } from "../../../common/src/utils/vector";
import { Vec, type Vector } from "../../../common/src/utils/vector";
import { type Airdrop, type Game } from "../game";
import { Events } from "../pluginManager";
import { Logger } from "../utils/misc";

Check failure on line 9 in server/src/objects/parachute.ts

View workflow job for this annotation

GitHub Actions / Lint

'Logger' is defined but never used

Check failure on line 9 in server/src/objects/parachute.ts

View workflow job for this annotation

GitHub Actions / Lint

'Logger' is defined but never used

Check failure on line 9 in server/src/objects/parachute.ts

View workflow job for this annotation

GitHub Actions / Lint

'Logger' is defined but never used

Check failure on line 9 in server/src/objects/parachute.ts

View workflow job for this annotation

GitHub Actions / Lint

'Logger' is defined but never used
import { Building } from "./building";
import { BaseGameObject } from "./gameObject";
import { Loot } from "./loot";
Expand Down Expand Up @@ -70,6 +72,24 @@
amount: Infinity,
source: crate
});
// Hacky hacky solution probably not the smartest solution atm but fuck it we ball :shrug:
if (object.definition.idString == "airdrop_crate_locked" && object != crate) {
let xDif = crate.position.x - object.position.x;
if (xDif <= 0) {
xDif = xDif + 10;
} else {
xDif = xDif - 10;
}
let yDif = crate.position.y - object.position.y;
if (yDif <= 0) {
yDif = yDif + 10;
} else {
yDif = yDif - 10;
}
const position = Vec.create(xDif, yDif);
crate.hitbox = object.hitbox.transform(position);
crate.position = crate.hitbox.getCenter();
}
break;
}
case object instanceof Building && object.scopeHitbox?.collidesWith(crate.hitbox): {
Expand Down
5 changes: 2 additions & 3 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function removePunishment(ip: string): void {
if (Config.protection?.punishments?.url) {
fetch(
`${Config.protection.punishments.url}/punishments/${ip}`,
{ method: 'DELETE', headers: { "api-key": Config.protection.punishments.password } }
{ method: "DELETE", headers: { "api-key": Config.protection.punishments.password } }
).catch(err => console.error("Error removing punishment from server. Details:", err));
} else {
writeFile(
Expand All @@ -51,7 +51,6 @@ function removePunishment(ip: string): void {
}
}


export const customTeams: Map<string, CustomTeam> = new Map<string, CustomTeam>();

let _maxTeamSize = typeof Config.maxTeamSize === "number" ? Config.maxTeamSize : Config.maxTeamSize.rotation[0];
Expand Down Expand Up @@ -83,7 +82,7 @@ if (isMainThread) {
let response: GetGameResponse;

const punishment = punishments.find(p => p.ip === ip);
console.log(`Punishment is ${punishment?.punishmentType}${punishment?.ip}${punishment?.reason} `)
console.log(`Punishment is ${punishment?.punishmentType}${punishment?.ip}${punishment?.reason} `);
if (punishment) {
if (punishment.punishmentType === "warn") {
const protection = Config.protection;
Expand Down
Loading