#Removing merchants from reality

1 messages · Page 1 of 1 (latest)

topaz flax
#

title

#

so import "game/options/IGameOptions" ?

somber light
#

So is the idea to disable NPCs only while the mod is enabled?

topaz flax
#

Pretty much

#

public onInitialize() { runs when its enabled right?

#

even during gameplay?

somber light
#

Once, when the mod is first initialized

#

NPCs being enabled or not is done via a "game option" which is retrieved while the user is playing, so you need to hook into the thing that returns the game options

somber light
#

It does not say executed repeatedly

topaz flax
#

when your mod initializes or becomes enabled, such as when your mod is enabled in the mods menu?

somber light
#

Yeah

#

Initialize is for setting up mod state stuff

topaz flax
#

ah I see

somber light
#

You can't mess with the options of a game at that point bcuz the user can't be in a game yet at that point

topaz flax
#

so we'd use a hook like public onGameScreenVisible() { ?

somber light
#

that also only happens once

#

you could technically put it there but you'd be permanently changing the options for the game rather than making it only when your mod is enabled

topaz flax
#

ah

somber light
#

try putting this inside your mod class:

@Inject(Game, "getGameOptions", InjectionPosition.Post)
public onGetGameOptions(api: IInjectionApi<Game, "getGameOptions">) {
    (api.executingInstance["gameOptionsCached"] as IGameOptions).npcs.merchants.allowSpawning = false;
}
#

okay nvm that doens't work

#

give me a min

topaz flax
#

Ah, alright

#

I would have checked the injection tab on the docs but it wasn't there so I was going to sift through example mods

somber light
#

there

#

try that

#

you still would've needed the exact method to inject into

topaz flax
#

Ah I see what you're doing here

#

yeah

#

might want to add npm install -g typescript to the tutorial, Visual Studio Code includes TypeScript language support but does not include the TypeScript compiler tsc.
Couldn't compile thonk

somber light
topaz flax
#

aaaaaaaaa

#

I'm a double idiot hahaha

#

never worked with any of these things before

#

just scrapped lua together on noita and isaac

somber light
#

Yeah it's kinda uncommon for games to use this stuff

topaz flax
#

soo when I use ctrl+shift+b its not finding my... tsconfig.json file (I think?)

somber light
#

Do you have your mod folder opened in vscode or just your Mod.ts?

#

you should have a folder structure like this in the explorer

topaz flax
#

You can open folders???! :O

#

Following the example here I presumed to open the file

somber light
#

ah

topaz flax
#

Honestly though I haven't read everything thoroughly

somber light
#

I should delete the hello world example thing

#

it's not useful

topaz flax
#

wait

#

forgot to import er

#

"game/options/IGameOptions" I think

#

hmm

topaz flax
somber light
#

no you need to import stuff

topaz flax
#

I'm looking at other forum posts here but ultimately I lack any understanding

somber light
#

you should be able to import stuff automatically, sometimes it doens't work though

#

If I give you code and there's red lines over some names of things, and hovering over it the tooltip says "unknown something" you might need to import it. You can try putting in the name in the search feature here and it should show up: https://waywardgame.github.io/

#

and then your import should be import { IGameOptions } from "game/options/IGameOptions";

#

sometimes you'll get ones that say "default", in that case your import should look something like this: import Register from "mod/ModRegistry";

#

{} in the import means you're importing any number of things from that module, and a thing outside of {} means you're importing the "default" thing in that module as the name you provide

#

whoops failed to upload that pic

#

Anyway if you can't figure out an import feel free to ask and I'll give you the right line

topaz flax
#

I'm importing from "game/utilities/class/Inject" but its saying Cannot find module 'game/utilities/class/Inject'.

somber light
#

utilities/class/Inject

#

Remove the extra game

topaz flax
#

ah, I should have interpreted that via this line in the scripts page here
I assume I only include it if it's defined after game again such as with igameoptions?

#

so anything after src/game/

somber light
#

yep

#

In our internal dev file structure everything is within src/game/

#

that's why it looks like this for you

topaz flax
#

game/game/game.ts
lol my head
thanks for the help its my first time with this kind of language

#

Alright I don't know what to do when its asking to define game

#

import Game from "/game" looks and feels very wrong so its not that

#

This??

#

no

somber light
#

definitely not that

#

import Game from "game/Game";

topaz flax
#

er

somber light
#

does game still look like a word

topaz flax
#

I thought it was whatever is after src/game, wouldn't that just be /game? 😵‍💫

#

doesn't feel like a word anymore yeah lol

somber light
#

everything after src/game, and before .ts

topaz flax
#

crap!

#

so obvious now

#

I really had to game game instead of game, and not game game game ofc

somber light
#

lmfao

topaz flax
#

should have known about the before ts thing from my last import

somber light
#

There was one time in Wayward modding where you didn't need to worry about any of this because it would automatically import anything

#

It was a wonderful time

#

And then Typescript broke it

topaz flax
#

aw

#

omg it compiled

#

Advanced level craft at 1% skill

topaz flax
somber light
#

Add this to your mod.json:

"allowUnlockingMilestones": true,
#

And

"multiplayer": "compatible",
#

And

"unloadable": true,
topaz flax
somber light
#

no there's nothing like that

#

give me a sec

topaz flax
#

I just want to make sure its even working lol

somber light
#

In the console run

for (let i = 0; i < 10000; i++) {
  localIsland.runRandomEvents(localPlayer);
}
#

To open the console go to developer options > enable "developer mode" > click "toggle developer tools", and then in the window that opens it's the "console" tab

#

Oh right yeah you use the devtools

topaz flax
#

Yeah I've got the console open

#

wasn't sure how to browse available commands but I did get my civ score up

#

no merchants! :>

#

ah seems like you can just hook whatever, nice

#

found drathy's steam guide on it

#

How do I upload it? hahaha

somber light
#

click mod info button in mods menu, then there'll be a publish button

topaz flax
#

thank you

#

I really didn't want to ask but I couldn't find it lmao

topaz flax
somber light
#

uhhhh

topaz flax
#

I have a mod.png in my mod folder, is that not how I set the thumbnail....?

literally could not find anything on the discord or example mods

#

I just wanna upload a mod pain
Literally had the code for the mod made for me hours ago and spent all this time figuring all these basics out

#

It's a quick export as png from photoshop at scale 268x268, game seems to have no issue recognizing this as the thumbnail here too, but it fails...???

somber light
#

It's a steam error meaning this:

#

apparently

topaz flax
#

uhhhhhhh

somber light
#

not sure

#

@sturdy whale

topaz flax
#

restarted steam and launched wayward with admin, now its stuck publishing??

#

here's the file itself

somber light
#

I don't think it's the image making publish not working

topaz flax
#

The game is stuck saying it has a cloud error and can't sync inside my library

#

I've restarted steam a few times

somber light
#

sounds like you're having steam issues in general right now then

#

probably related

#

we don't control cloud stuff

topaz flax
#

Restarted PC and still have cloud problems

#

This all started when I uploaded the mod and forgot a thumbnail, deleted it on workshop, removed the added ID line in my mod.json, then tried to reupload it

#

I want to say there's some kind of delay on the next time you can upload stuff on the workshop but I'm struggling to locate any info online about it

#

and I have no idea why it would throw errors about uploading a png

somber light
#

Your mistake is I think that you deleted the mod, then

#

Doing "publish" a second time publishes an update to the mod

#

it sounds like it's getting confused there

#

Remove "publishedFileId" from your mod.json (gets automatically added when uploading a mod)

topaz flax
#

Already have

somber light
#

Ah

#

Yeah might be hitting some kind of limit then?

#

Not sure

#

Never seen anyone mention this before

topaz flax
#

Hm. When a mod is uploaded it has that yellow bar mentioning an approval period

#

I think there has to be some kind of limit

topaz flax
#

no idea what but it just worked now

#

I guess it's 30 minutes if this all started at 10:00 (for me)