Add feature decorator system #13

Merged
murapix merged 18 commits from main into main 2023-04-20 01:28:11 +00:00
2 changed files with 9 additions and 4 deletions
Showing only changes of commit 24fcd3468e - Show all commits

View file

@ -58,6 +58,11 @@ export type GenericBonusCompletionsFeature = Replace<
thepaperpilot commented 2023-03-02 23:30:05 +00:00 (Migrated from github.com)
Review

Please change this back to util/bignum

Please change this back to util/bignum
murapix commented 2023-03-02 23:39:59 +00:00 (Migrated from github.com)
Review

Heh, guess that's what I get for just letting it mass-import everything

Heh, guess that's what I get for just letting it mass-import everything
thepaperpilot commented 2023-03-02 23:42:11 +00:00 (Migrated from github.com)
Review

Trust me, I've made this same mistake so many times. I wish I had a better way to hint to the IDE what the default export is expected to be called

Trust me, I've made this same mistake so many times. I wish I had a better way to hint to the IDE what the default export is expected to be called
thepaperpilot commented 2023-03-02 23:30:05 +00:00 (Migrated from github.com)
Review

Please change this back to util/bignum

Please change this back to util/bignum
murapix commented 2023-03-02 23:39:59 +00:00 (Migrated from github.com)
Review

Heh, guess that's what I get for just letting it mass-import everything

Heh, guess that's what I get for just letting it mass-import everything
thepaperpilot commented 2023-03-02 23:42:11 +00:00 (Migrated from github.com)
Review

Trust me, I've made this same mistake so many times. I wish I had a better way to hint to the IDE what the default export is expected to be called

Trust me, I've made this same mistake so many times. I wish I had a better way to hint to the IDE what the default export is expected to be called
* }), bonusAmountDecorator) as GenericRepeatable & GenericBonusAmountFeature
*/
export const bonusAmountDecorator: Decorator<BonusAmountFeatureOptions, BaseBonusAmountFeature, GenericBonusAmountFeature> = {
preConstruct(feature) {
thepaperpilot commented 2023-03-02 23:30:05 +00:00 (Migrated from github.com)
Review

Please change this back to util/bignum

Please change this back to util/bignum
murapix commented 2023-03-02 23:39:59 +00:00 (Migrated from github.com)
Review

Heh, guess that's what I get for just letting it mass-import everything

Heh, guess that's what I get for just letting it mass-import everything
thepaperpilot commented 2023-03-02 23:42:11 +00:00 (Migrated from github.com)
Review

Trust me, I've made this same mistake so many times. I wish I had a better way to hint to the IDE what the default export is expected to be called

Trust me, I've made this same mistake so many times. I wish I had a better way to hint to the IDE what the default export is expected to be called
if (feature.amount === undefined) {
thepaperpilot commented 2023-03-02 23:30:05 +00:00 (Migrated from github.com)
Review

Please change this back to util/bignum

Please change this back to util/bignum
murapix commented 2023-03-02 23:39:59 +00:00 (Migrated from github.com)
Review

Heh, guess that's what I get for just letting it mass-import everything

Heh, guess that's what I get for just letting it mass-import everything
thepaperpilot commented 2023-03-02 23:42:11 +00:00 (Migrated from github.com)
Review

Trust me, I've made this same mistake so many times. I wish I had a better way to hint to the IDE what the default export is expected to be called

Trust me, I've made this same mistake so many times. I wish I had a better way to hint to the IDE what the default export is expected to be called
console.error(`Decorated feature ${feature.id} does not contain the required 'amount' property"`);
thepaperpilot commented 2023-03-02 23:30:05 +00:00 (Migrated from github.com)
Review

Please change this back to util/bignum

Please change this back to util/bignum
murapix commented 2023-03-02 23:39:59 +00:00 (Migrated from github.com)
Review

Heh, guess that's what I get for just letting it mass-import everything

Heh, guess that's what I get for just letting it mass-import everything
thepaperpilot commented 2023-03-02 23:42:11 +00:00 (Migrated from github.com)
Review

Trust me, I've made this same mistake so many times. I wish I had a better way to hint to the IDE what the default export is expected to be called

Trust me, I've made this same mistake so many times. I wish I had a better way to hint to the IDE what the default export is expected to be called
}
thepaperpilot commented 2023-03-02 23:30:05 +00:00 (Migrated from github.com)
Review

Please change this back to util/bignum

Please change this back to util/bignum
murapix commented 2023-03-02 23:39:59 +00:00 (Migrated from github.com)
Review

Heh, guess that's what I get for just letting it mass-import everything

Heh, guess that's what I get for just letting it mass-import everything
thepaperpilot commented 2023-03-02 23:42:11 +00:00 (Migrated from github.com)
Review

Trust me, I've made this same mistake so many times. I wish I had a better way to hint to the IDE what the default export is expected to be called

Trust me, I've made this same mistake so many times. I wish I had a better way to hint to the IDE what the default export is expected to be called
},
thepaperpilot commented 2023-03-02 23:30:05 +00:00 (Migrated from github.com)
Review

Please change this back to util/bignum

Please change this back to util/bignum
murapix commented 2023-03-02 23:39:59 +00:00 (Migrated from github.com)
Review

Heh, guess that's what I get for just letting it mass-import everything

Heh, guess that's what I get for just letting it mass-import everything
thepaperpilot commented 2023-03-02 23:42:11 +00:00 (Migrated from github.com)
Review

Trust me, I've made this same mistake so many times. I wish I had a better way to hint to the IDE what the default export is expected to be called

Trust me, I've made this same mistake so many times. I wish I had a better way to hint to the IDE what the default export is expected to be called
postConstruct(feature) {
processComputable(feature, "bonusAmount");
if (feature.totalAmount === undefined) {

thepaperpilot commented 2023-03-02 23:30:05 +00:00 (Migrated from github.com)
Review

Please change this back to util/bignum

Please change this back to util/bignum
murapix commented 2023-03-02 23:39:59 +00:00 (Migrated from github.com)
Review

Heh, guess that's what I get for just letting it mass-import everything

Heh, guess that's what I get for just letting it mass-import everything
thepaperpilot commented 2023-03-02 23:42:11 +00:00 (Migrated from github.com)
Review

Trust me, I've made this same mistake so many times. I wish I had a better way to hint to the IDE what the default export is expected to be called

Trust me, I've made this same mistake so many times. I wish I had a better way to hint to the IDE what the default export is expected to be called
thepaperpilot commented 2023-03-02 23:30:05 +00:00 (Migrated from github.com)
Review

Please change this back to util/bignum

Please change this back to util/bignum
murapix commented 2023-03-02 23:39:59 +00:00 (Migrated from github.com)
Review

Heh, guess that's what I get for just letting it mass-import everything

Heh, guess that's what I get for just letting it mass-import everything
thepaperpilot commented 2023-03-02 23:42:11 +00:00 (Migrated from github.com)
Review

Trust me, I've made this same mistake so many times. I wish I had a better way to hint to the IDE what the default export is expected to be called

Trust me, I've made this same mistake so many times. I wish I had a better way to hint to the IDE what the default export is expected to be called

View file

@ -2,11 +2,11 @@ import { Replace, OptionsObject } from "../feature";
thepaperpilot commented 2023-03-02 23:34:07 +00:00 (Migrated from github.com)
Review

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them
thepaperpilot commented 2023-03-02 23:34:07 +00:00 (Migrated from github.com)
Review

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them
import { Computable, GetComputableType, processComputable, ProcessedComputable } from "util/computed";
import { Persistent, State } from "game/persistence";
export type Decorator<FeatureOptions, BaseFeature = Object, GenericFeature = BaseFeature, S extends State = State> = {
thepaperpilot commented 2023-03-02 23:34:07 +00:00 (Migrated from github.com)
Review

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them
export type Decorator<FeatureOptions, BaseFeature = object, GenericFeature = BaseFeature, S extends State = State> = {
thepaperpilot commented 2023-03-02 23:34:07 +00:00 (Migrated from github.com)
Review

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them
getPersistentData?(): Record<string, Persistent<S>>;
preConstruct?(feature: OptionsObject<FeatureOptions,BaseFeature,GenericFeature>): void;
thepaperpilot commented 2023-03-02 23:34:07 +00:00 (Migrated from github.com)
Review

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them
postConstruct?(feature: OptionsObject<FeatureOptions,BaseFeature,GenericFeature>): void;
thepaperpilot commented 2023-03-02 23:34:07 +00:00 (Migrated from github.com)
Review

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them
getGatheredProps?(feature: OptionsObject<FeatureOptions,BaseFeature,GenericFeature>): Partial<OptionsObject<FeatureOptions,BaseFeature,GenericFeature>>
thepaperpilot commented 2023-03-02 23:34:07 +00:00 (Migrated from github.com)
Review

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them
preConstruct?(feature: OptionsObject<FeatureOptions,BaseFeature & {id:string},GenericFeature>): void;
thepaperpilot commented 2023-03-02 23:34:07 +00:00 (Migrated from github.com)
Review

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them
postConstruct?(feature: OptionsObject<FeatureOptions,BaseFeature & {id:string},GenericFeature>): void;
thepaperpilot commented 2023-03-02 23:34:07 +00:00 (Migrated from github.com)
Review

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them
getGatheredProps?(feature: OptionsObject<FeatureOptions,BaseFeature & {id:string},GenericFeature>): Partial<OptionsObject<FeatureOptions,BaseFeature & {id:string},GenericFeature>>
thepaperpilot commented 2023-03-02 23:34:07 +00:00 (Migrated from github.com)
Review

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them
}
export type GenericDecorator = Decorator<unknown>;

thepaperpilot commented 2023-03-02 23:34:07 +00:00 (Migrated from github.com)
Review

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them
thepaperpilot commented 2023-03-02 23:34:07 +00:00 (Migrated from github.com)
Review

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them

I'm not a huge fan of adding these separators and #region comments since nowhere else in the project has them