Skip to content

Commit

Permalink
Added copyright env flag
Browse files Browse the repository at this point in the history
  • Loading branch information
neki-dev committed Oct 30, 2023
1 parent a97aa84 commit 8def114
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 19 deletions.
10 changes: 7 additions & 3 deletions src/const/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,28 @@ export const ENVIRONMENTS: Record<GamePlatform, GameEnvironment> = {
[GamePlatform.POKI]: {
sdk: 'https://game-cdn.poki.com/scripts/v2/poki-sdk.js',
flags: {
[GameFlag.NO_BLOOD]: true,
[GameFlag.ADS]: true,
[GameFlag.AUTO_ORIENTATION]: true,
},
},
[GamePlatform.CRAZY_GAMES]: {
sdk: 'https://sdk.crazygames.com/crazygames-sdk-v2.js',
flags: {
[GameFlag.NO_BLOOD]: true,
[GameFlag.ADS]: true,
[GameFlag.COPYRIGHT]: true,
},
},
[GamePlatform.VANILLA]: {
flags: {},
flags: {
[GameFlag.BLOOD]: true,
[GameFlag.COPYRIGHT]: true,
},
},
[GamePlatform.DEVELOPMENT]: {
flags: {
[GameFlag.BLOOD]: true,
[GameFlag.ADS]: true,
[GameFlag.COPYRIGHT]: true,
},
},
};
18 changes: 12 additions & 6 deletions src/game/scenes/menu/interface/copyright/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
import React from 'react';

import pkg from '../../../../../../package.json';
import { Environment } from '~lib/environment';
import { GameFlag } from '~type/game';

import {
Wrapper, Icon, About, Discord, Link, Version,
Wrapper, Icon, About, Discord, Author, Link,
} from './styles';

export const Copyright: React.FC = () => (
<Wrapper>
<About>
Created by{' '}
<Link href={pkg.author.url} target="_blank">
{pkg.author.name}
</Link>
<Version>Version {pkg.version}</Version>
{Environment.GetFlag(GameFlag.COPYRIGHT) && (
<Author>
Created by{' '}
<Link href={pkg.author.url} target="_blank">
{pkg.author.name}
</Link>
</Author>
)}
Version {pkg.version}
</About>
<Discord href='https://discord.gg/cnFAdMsRxn' target="_blank">
<Icon src='assets/discord.png' />
Expand Down
14 changes: 7 additions & 7 deletions src/game/scenes/menu/interface/copyright/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ export const About = styled.div`
}
`;

export const Author = styled.div`
margin-bottom: 8px;
@media ${INTERFACE_MOBILE_BREAKPOINT} {
margin-bottom: 5px;
}
`;

export const Link = styled.a`
color: #fff;
pointer-events: all;
Expand All @@ -35,13 +42,6 @@ export const Link = styled.a`
}
`;

export const Version = styled.div`
margin-top: 8px;
@media ${INTERFACE_MOBILE_BREAKPOINT} {
margin-top: 5px;
}
`;

export const Discord = styled.a`
margin-top: 10px;
color: #fff;
Expand Down
2 changes: 1 addition & 1 deletion src/game/scenes/world/entities/npc/variants/enemy/enemy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ export class Enemy extends NPC implements IEnemy {
if (
!this.currentBiome?.solid
|| !this.scene.game.isSettingEnabled(GameSettings.EFFECTS)
|| Environment.GetFlag(GameFlag.NO_BLOOD)
|| !Environment.GetFlag(GameFlag.BLOOD)
) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/scenes/world/entities/sprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ export class Sprite extends Phaser.Physics.Arcade.Sprite implements ISprite {
public onDamage(amount: number) {
if (
!this.scene.game.isSettingEnabled(GameSettings.EFFECTS)
|| Environment.GetFlag(GameFlag.NO_BLOOD)
|| !Environment.GetFlag(GameFlag.BLOOD)
) {
return;
}
Expand Down
3 changes: 2 additions & 1 deletion src/types/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,10 @@ export enum GameDifficulty {
}

export enum GameFlag {
NO_BLOOD = 'NO_BLOOD',
BLOOD = 'BLOOD',
ADS = 'ADS',
AUTO_ORIENTATION = 'AUTO_ORIENTATION',
COPYRIGHT = 'COPYRIGHT',
}

export enum GamePlatform {
Expand Down

0 comments on commit 8def114

Please sign in to comment.