Fix issues
This commit is contained in:
parent
7cf33b9f1a
commit
a4bab29d84
7 changed files with 30 additions and 14 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "declared-server",
|
||||
"version": "0.0.13",
|
||||
"version": "0.0.15",
|
||||
"description": "Game server for decla.red",
|
||||
"keywords": [],
|
||||
"author": "András Schmelczer <andras@schmelczer.dev> (https://schmelczer.dev/)",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ export const defaultOptions: Options = {
|
|||
port: 3000,
|
||||
name: 'Test server',
|
||||
playerLimit: 16,
|
||||
npcCount: 12,
|
||||
npcCount: 16,
|
||||
seed: Math.random(),
|
||||
scoreLimit: 1000,
|
||||
worldSize: 8000,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { Circle, CommandReceiver, GameObject, serializesTo } from 'shared';
|
||||
import {
|
||||
Circle,
|
||||
CommandExecutors,
|
||||
CommandReceiver,
|
||||
GameObject,
|
||||
serializesTo,
|
||||
} from 'shared';
|
||||
import { BoundingBox } from '../physics/bounding-boxes/bounding-box';
|
||||
import { BoundingBoxBase } from '../physics/bounding-boxes/bounding-box-base';
|
||||
import { moveCircle } from '../physics/functions/move-circle';
|
||||
|
|
@ -17,6 +23,10 @@ export class CirclePhysical extends CommandReceiver implements Circle, DynamicPh
|
|||
|
||||
private _boundingBox: BoundingBox;
|
||||
|
||||
protected commandExecutors: CommandExecutors = {
|
||||
[ReactToCollisionCommand.type]: this.onCollision.bind(this),
|
||||
};
|
||||
|
||||
constructor(
|
||||
private _center: vec2,
|
||||
private _radius: number,
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ export class PlanetPhysical extends PlanetBase implements StaticPhysical {
|
|||
|
||||
public getForce(position: vec2): vec2 {
|
||||
const diff = vec2.subtract(vec2.create(), this.center, position);
|
||||
const dist = Math.max(0, vec2.length(diff) - 600);
|
||||
const dist = Math.max(0, vec2.length(diff) - this.radius);
|
||||
vec2.normalize(diff, diff);
|
||||
const scale = clamp(
|
||||
settings.maxGravityQ * ((settings.maxGravityDistance / dist) ** 1.5 - 1),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue