refactor: silphius app structure

This commit is contained in:
cha0s 2024-11-04 11:37:57 -06:00
parent 4eef129c53
commit 9494e0b901
137 changed files with 109 additions and 109 deletions

View File

@ -1,3 +0,0 @@
import Component from '@/ecs/component.js';
export default class Grabber extends Component {}

View File

@ -1,3 +0,0 @@
import Component from '@/ecs/component.js';
export default class Shop extends Component {}

View File

@ -14,7 +14,7 @@ import { renderToPipeableStream } from "react-dom/server";
const ABORT_DELAY = 5_000;
export async function handleUpgrade(request, socket, head) {
const {handleUpgrade} = await import('./server/websocket.js');
const {handleUpgrade} = await import('./silphius/server/websocket.js');
handleUpgrade(request, socket, head);
}

View File

@ -1,7 +1,7 @@
import {expect, test} from 'vitest';
import Components from '@/ecs/components/index.js';
import Ecs from '@/ecs/ecs.js';
import Components from '@/silphius/ecs/components/index.js';
import Ecs from '@/silphius/ecs/ecs.js';
import {Emitter} from './particles.js';

View File

@ -1,3 +0,0 @@
import Packet from '@/net/packet.js';
export default class Tick extends Packet {}

View File

@ -1,4 +1,4 @@
import Ecs from '@/ecs/ecs.js';
import Ecs from '@/silphius/ecs/ecs.js';
import {readAsset} from '@/lib/resources.js';
export default class ClientEcs extends Ecs {

View File

@ -1,6 +1,6 @@
import {memo, useCallback, useRef} from 'react';
import {DamageTypes} from '@/ecs/components/vulnerable.js';
import {DamageTypes} from '@/silphius/ecs/components/vulnerable.js';
import {useEcsTick} from '@/react/context/ecs.js';
import useAnimationFrame from '@/react/hooks/use-animation-frame.js';
import {easeInOutExpo, easeInQuint, easeOutQuad, linear} from '@/lib/easing.js';

View File

@ -1,5 +1,5 @@
import {Emitter} from '@/lib/particles.js';
import createEcs from '@/server/create/ecs.js';
import createEcs from '@/silphius/server/create/ecs.js';
import ClientEcs from './client-ecs.js';

View File

@ -62,8 +62,8 @@ export default function PlaySpecific() {
}, [ecsRef, Components, Systems]);
useEffect(() => {
async function setEcsStuff() {
const {default: Components} = await import('@/ecs/components/index.js');
const {default: Systems} = await import('@/ecs/systems/index.js');
const {default: Components} = await import('@/silphius/ecs/components/index.js');
const {default: Systems} = await import('@/silphius/ecs/systems/index.js');
setComponents(Components);
setSystems(Systems);
}

View File

@ -13,7 +13,7 @@ settings.ADAPTER.fetch = async (path) => {
};
export async function loader({request}) {
const {juggleSession} = await import('@/server/session.server.js');
const {juggleSession} = await import('@/silphius/server/session.server.js');
const {loadManifest} = await import('@/lib/resources.server.js');
await juggleSession(request);
return json({
@ -43,10 +43,10 @@ export default function Play() {
let Client;
switch (type) {
case 'local':
({default: Client} = await import('@/client/local.js'));
({default: Client} = await import('@/silphius/client/local.js'));
break;
case 'remote':
({default: Client} = await import('@/client/remote.js'));
({default: Client} = await import('@/silphius/client/remote.js'));
break;
}
setClient(() => Client);

View File

@ -2,7 +2,7 @@
import {Form, json, redirect, useLoaderData} from '@remix-run/react';
import {useState} from 'react';
import {commitSession, getSession, juggleSession} from '@/server/session.server.js';
import {commitSession, getSession, juggleSession} from '@/silphius/server/session.server.js';
import NoiseField from './noise-field.jsx';

View File

@ -1,5 +1,5 @@
import Client from '@/net/client.js';
import {decode, encode} from '@/net/packets/index.js';
import Client from '@/silphius/net/client.js';
import {decode, encode} from '@/silphius/net/packets/index.js';
import {CLIENT_INTERPOLATION, CLIENT_PREDICTION} from '@/lib/constants.js';
export default class LocalClient extends Client {

View File

@ -1,6 +1,6 @@
import Components from '@/ecs/components/index.js';
import Ecs from '@/ecs/ecs.js';
import Systems from '@/ecs/systems/index.js';
import Components from '@/silphius/ecs/components/index.js';
import Ecs from '@/silphius/ecs/ecs.js';
import Systems from '@/silphius/ecs/systems/index.js';
import {get, loadResources, readAsset} from '@/lib/resources.js';
class PredictionEcs extends Ecs {

View File

@ -1,5 +1,5 @@
import Client from '@/net/client.js';
import {decode, encode} from '@/net/packets/index.js';
import Client from '@/silphius/net/client.js';
import {decode, encode} from '@/silphius/net/packets/index.js';
import {CLIENT_INTERPOLATION, CLIENT_PREDICTION} from '@/lib/constants.js';
export default class RemoteClient extends Client {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Alive extends Component {
instanceFromSchema() {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Animation extends Component {
static properties = {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Arbitrary extends Component {
instanceFromSchema() {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class AreaSize extends Component {
static properties = {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Behaving extends Component {
instanceFromSchema() {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Camera extends Component {
static properties = {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
import {distance, intersects, transform} from '@/lib/math.js';
import vector2d from './helpers/vector-2d';

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Controlled extends Component {
instanceFromSchema() {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
import {HALF_PI, TAU} from '@/lib/math.js';
export default class Direction extends Component {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Ecs extends Component {
static properties = {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
import {Emitter} from '@/lib/particles.js';
import Ticker from '@/lib/ticker.js';

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Forces extends Component {
instanceFromSchema() {

View File

@ -0,0 +1,3 @@
import Component from '@/silphius/ecs/component.js';
export default class Grabber extends Component {}

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Harmful extends Component {
instanceFromSchema() {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Health extends Component {
static properties = {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Interactive extends Component {
instanceFromSchema() {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Interacts extends Component {
instanceFromSchema() {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Interlocutor extends Component {
mergeDiff(original, update) {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
import {distribute} from '@/lib/inventory.js';

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class ItemStack extends Component {
instanceFromSchema() {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Light extends Component {
static properties = {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Magnet extends Component {
static properties = {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Magnetic extends Component {
}

View File

@ -1,3 +1,3 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class MainEntity extends Component {}

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Owned extends Component {
static properties = {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Plant extends Component {
instanceFromSchema() {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
const State = {
CLOSED: 0,

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Position extends Component {
instanceFromSchema() {

View File

@ -0,0 +1,3 @@
import Component from '@/silphius/ecs/component.js';
export default class Shop extends Component {}

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Sound extends Component {
mergeDiff(original, update) {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Speed extends Component {
static properties = {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
import {hexToHsl, hslToHex} from '@/lib/color.js';
export default class Sprite extends Component {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Tags extends Component {
instanceFromSchema() {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
import {withResolvers} from '@/lib/promise.js';
export default class Ticking extends Component {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
import {CHUNK_SIZE} from '@/lib/constants.js';
import {floodwalk2D, ortho, removeCollinear} from '@/lib/math.js';

View File

@ -1,6 +1,6 @@
import {expect, test} from 'vitest';
import Ecs from '@/ecs/ecs.js';
import Ecs from '@/silphius/ecs/ecs.js';
import TileLayers from './tile-layers.js';

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
import {IRL_MINUTES_PER_GAME_DAY} from '@/lib/constants';
const realSecondsPerGameDay = 60 * IRL_MINUTES_PER_GAME_DAY;

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Ttl extends Component {
instanceFromSchema() {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class VisibleAabb extends Component {
static properties = {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
import * as Math from '@/lib/math.js';
import Ticker from '@/lib/ticker.js';

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Wallet extends Component {
static properties = {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Water extends Component {
static properties = {

View File

@ -1,4 +1,4 @@
import Component from '@/ecs/component.js';
import Component from '@/silphius/ecs/component.js';
export default class Wielder extends Component {
instanceFromSchema() {

View File

@ -1,4 +1,4 @@
import {System} from '@/ecs/index.js';
import {System} from '@/silphius/ecs/index.js';
import {normalizeVector} from '@/lib/math.js';
export default class ApplyControlMovement extends System {

View File

@ -1,4 +1,4 @@
import {System} from '@/ecs/index.js';
import {System} from '@/silphius/ecs/index.js';
import {distance, normalizeVector} from '@/lib/math.js';
export default class Attract extends System {

View File

@ -1,4 +1,4 @@
import {System} from '@/ecs/index.js';
import {System} from '@/silphius/ecs/index.js';
export default class Behave extends System {

View File

@ -1,4 +1,4 @@
import {System} from '@/ecs/index.js';
import {System} from '@/silphius/ecs/index.js';
export default class ClampPositions extends System {

View File

@ -1,4 +1,4 @@
import {System} from '@/ecs/index.js';
import {System} from '@/silphius/ecs/index.js';
export default class Colliders extends System {

View File

@ -1,4 +1,4 @@
import {System} from '@/ecs/index.js';
import {System} from '@/silphius/ecs/index.js';
import {TAU} from '@/lib/math.js';
export default class ControlDirection extends System {

View File

@ -1,4 +1,4 @@
import {System} from '@/ecs/index.js';
import {System} from '@/silphius/ecs/index.js';
// import {RESOLUTION} from '@/lib/constants.js'
// const [hx, hy] = [RESOLUTION.x / 2, RESOLUTION.y / 2];

View File

@ -1,4 +1,4 @@
import {System} from '@/ecs/index.js';
import {System} from '@/silphius/ecs/index.js';
export default class Harm extends System {

View File

@ -1,4 +1,4 @@
import System from '@/ecs/system.js';
import System from '@/silphius/ecs/system.js';
import gather from '@/lib/gather.js';
const gathered = gather(import.meta.glob('./*.js', {eager: true, import: 'default'}));

View File

@ -1,4 +1,4 @@
import {System} from '@/ecs/index.js';
import {System} from '@/silphius/ecs/index.js';
export default class IntegratePhysics extends System {

View File

@ -1,4 +1,4 @@
import {System} from '@/ecs/index.js';
import {System} from '@/silphius/ecs/index.js';
export default class Interactions extends System {

View File

@ -1,4 +1,4 @@
import {System} from '@/ecs/index.js';
import {System} from '@/silphius/ecs/index.js';
import {distance} from '@/lib/math.js';
export default class InventoryCloser extends System {

View File

@ -1,4 +1,4 @@
import {System} from '@/ecs/index.js';
import {System} from '@/silphius/ecs/index.js';
export default class KillPerishable extends System {

View File

@ -1,4 +1,4 @@
import {System} from '@/ecs/index.js';
import {System} from '@/silphius/ecs/index.js';
import SpatialHash from '@/lib/spatial-hash.js';
export default class MaintainColliderHash extends System {

Some files were not shown because too many files have changed in this diff Show More