#Trying to make a codemod to have my custom slugcat get a warmth boost and start glowing

1 messages · Page 2 of 1

fickle rover
#

right now you press the keybind, emit smoke and an explosion light, and you being immune to hypothermia for 15 seconds

#

exactly what i wanted at the start of this thread

still pecan
#

okay so you do need the CWT to make it specific to a player

#

This is what a CWT format looks like.

#

Requirements:

  • A static class to contain the CWT definition
  • A non-static class to server as the CWT data class
  • The long static methods you see in my screenshot
#

Instead of ButtonTemplate, you put the class type you want a CWT for

fickle rover
#

i see

#

so would i use the lantern class or the lightsource class?

#

also would the cwt go outside this public class? (its late and im trying my best to understand at the moment gourmflop)

still pecan
#

You would need one of these for Lantern, or maybe AbstractLantern not sure... if you wanted to implement lantern effect lifetimes.

You want to create one for Player class to make sure the smoke targets the correct player, and the effects apply to the correct player for that matter.

On that last point, it is common for players in coop to share effects. If this is something you want, then you don't have to make it per player

#

You can make the effect apply to every player

#

But if you did that, you should check that at least one of those players is your slug\

fickle rover
#

ill ask more questions in the morning! and try to code it when im not busy

#

thanks

undone flint
#

Askin....

fickle rover
#

eating dinner but these are the errors i got

#

@still pecan

#

@undone flint

#

(srry for ping)

undone flint
#

you can use = new Type() instead of new()

#

and the extension method doesnt need to be on generic class (Class<T>)

still pecan
#

You need to set your LangVersion for your project to 9 or greater to use that syntax

fickle rover
#

where is that?

undone flint
fickle rover
#

uh huh, but how do i get to it exactly?

undone flint
#

do you HAVE the Solution Explorer opened?

fickle rover
#

yes

undone flint
#

good

#

is there

#

the below of the solution

#

is a csproj

fickle rover
#

ok

#

and then?

fickle rover
undone flint
fickle rover
#

(somehow my plugin file is nonexistent)

#

i LITERALLY cannot find it

undone flint
#

is the name
it can be any name

fickle rover
#

oj

#

oh

#

but still

#

i dont see what you guys are seeing

undone flint
#

i still hate my ife

undone flint
fickle rover
#

OH MY GOD

undone flint
fickle rover
#

I KNOW

#

THATS WHAT IM CLICKING

undone flint
#

huh?

#

you can't open it?

fickle rover
#

i cant

undone flint
#

wha

#

but should

fickle rover
#

whenever i double click it hides everything

undone flint
#

but this should work
strange...

still pecan
undone flint
#

wha?

#

I didn't even know it existed

fickle rover
#

it is??

still pecan
fickle rover
undone flint
#

WTH

fickle rover
#

okay then.... what do i do now hunterwtf

undone flint
fickle rover
#

print??

undone flint
#

yeah?

fickle rover
undone flint
fickle rover
#

if you mean screenshot, then yes

undone flint
#

i know nothing about the old way sorry

undone flint
#

screenshot == print

fickle rover
#

o

#

ok

still pecan
#

oohh I didn't realize it was going to be a whole different format.

#

I don't know how to modify that file

undone flint
#

so

#

oof

fickle rover
undone flint
#

but atleast you can just new Thing() instead of new

still pecan
#

If you don't wish to do some personal investigation, just don't use newer style C# syntax

fickle rover
#

about that

still pecan
#

Also you should be using normal project files if you are using the latest version of VS.

fickle rover
#

you said THING??

#

not type??

#

nvm

#

errergrrreheg

undone flint
still pecan
fickle rover
#

ok

undone flint
#

I noticed that you take this literally
I better watch out for what I say rivflabbergasted

undone flint
fickle rover
undone flint
#

you can pass the mouse above and see

#

and just pick this type

#

I see
It's totally annoying and UNNECESSARY IN C#
I agree with this and will not change my opinion

fickle rover
undone flint
#

i mean, the variable

fickle rover
#

oh

undone flint
#

or just copy the type before

#

and use it

#
= new ConditionalWeekTable<LightSource, ButtonTemplateCWT>();

i hate that

undone flint
still pecan
# fickle rover

You need to do new ConditionalWeakTable<LightSource, ButtonTemplateCWT>()

#

also rename the CWT data class to something more relevant please

fickle rover
#

this has got me so irritated and the fact that its also almost 11 pm isn't helping 😭 hunterangy

still pecan
#

you can't do new Type, you need to specify the class you are constructing

fickle rover
undone flint
fickle rover
#

bottom one

#

new LightSource

undone flint
#

LightSource have arguments
so, if you pass your mouse above of the class with the error of arguments, you cna see what is

undone flint
#

like

#

you can use the button one

#

LightSource its from game, so, you can't use that on the new

#

afai

#

k

still pecan
#

You don't create a new LightSource there

fickle rover
#

o

#

h

still pecan
#

That new() is defining your data class

undone flint
#

I hate explaining

still pecan
#

And don't call it ButtonTemplate, that's for my CWT

undone flint
#

thanks fluffball

still pecan
#

you can rename it to whatever you want it to be

fickle rover
#

ohh

#

ok

#

renamed

undone flint
#

new LightSource is still here

still pecan
fickle rover
#

one sec

still pecan
#

The class you put here is the class that you reference where that new is.

fickle rover
undone flint
fickle rover
#

scavwatch i uhh

#

i see

#

my brain is very smoothhunterrip

undone flint
#

I still think this thing of specifying each type for each thing is stupid

#

in C#

still pecan
#

it's optional in c# 11

undone flint
#

var is what i am very familiar with

still pecan
#

but they would have to figure out how to do that with their project

undone flint
#

...indeed

still pecan
#

@undone flint This is in my messages I noticed

fickle rover
undone flint
#

best readme

undone flint
undone flint
fickle rover
#

yayy

undone flint
fickle rover
#

dont know why this is freaking out though, i mean i do.. but it was fine earlier articry

undone flint
#

i really liked this thunder

fickle rover
#

extension?

undone flint
#

I don't even know that much about this method extension thing

fickle rover
#

huh

still pecan
undone flint
#

but afaik, it adds things to existent things

undone flint
still pecan
#

Create a static class for your extension methods

undone flint
#
public static class AA
{
  
}
#

separated

#

any name

fickle rover
#

named it Lenternt lol

undone flint
#

Good

fickle rover
#

ok, im going to sleep scavwatch

undone flint
#

Same

#

00:15 AM

elfin cipher
#

You can just not commit stuff

undone flint
elfin cipher
#

Just, don’t commit changes

undone flint
#

I don't know everything about github btw

elfin cipher
#

Just, don’t touch any of the GitHub stuff in VS, then you have type out the messages

undone flint
#

github stuff in VS??

#

but I don't even open anything from git in VS

elfin cipher
#

Oh

#

Ok ignore me

undone flint
still pecan
still pecan
#

The reset option would reverse the changes made by the selected lines. Be careful with that

#

You can also choose to stage some files, but not others.

undone flint
#

Even if I don't even open that tab in Github and don't even use it?

still pecan
#

Well you should. you want to have commits that reflect a specific purpose or accomplishment in the code.

#

If you finish a task, stage all of the changes for that task, and give it a commit name

undone flint
undone flint
still pecan
#

Commit: Added new medallion sprites to project
Commit: Fix null ref cause by new sprites

undone flint
undone flint
still pecan
#

You should commit more specifically, but you don't have to

undone flint
#

......nah

still pecan
#

I'm a bit confused as to the context then. Were you not complaining that you had to submit all of the changes at once

undone flint
#

kinda useless for my use

undone flint
#

....nvm then
At least there are new things in git that I've never seen but probably won't touch
thanks

fickle rover
#

School started so I can't mod at the moment rivsob slugwhy

still pecan
#

Should have started earlier monkforbidden

undone flint
#

well, I discovered it and found it easy

#

..ah i forgot
(your) school moment see ya

#

but i will let the step here that i made anyways

#
  • Search your .csproj file
#
  • RIght Click and Open it with Notepad
Open With > Notepad
#

after that, you will need to add it there (yeah, it doesnt add it for you when i saw)

#
  • you wull see this message in VS
    just Reload or Ignore if you want
    and then, done
#

now i can make the shorthand version!

#

NOTE: If you dont see the noetpad option, you need add it

  • Choose other app
#
  • More Apps
#

NotePad

#

done

#

..sorry for the big tex

#

oops

fickle rover
#

wow

#

good solution monksilly

fickle rover
#

gonna take a crack at the CWT again

#

i think i just need to add the light that's attached to the body

#

@still pecan i hope you're not busy, if you are, sorry about that (i'm looking at lantern light code at the moment)

elfin cipher
fickle rover
#

o

#

i reordered it

#

awhile ago

#

idk why it wasnt moved

elfin cipher
#

hm

fickle rover
#

lemme grab the screenchots of what i think ill need

#

not too sure

elfin cipher
#

what are you trying to do?

fickle rover
#

attach a light source to the main body chunk

#

this is the last thing i need to do if i remember correctly

still pecan
#

I've mostly forgotten about the state of progress for this, and I am pretty busy these days

fickle rover
#

its alright, we all get busy sometimes

still pecan
#

I recall something about you having to specify a parameter to attach the light source to

fickle rover
#

hmm

#

i don't exactly remember what i wanted to attach it to

#

maybe i was talking about the main body chunk?

fickle rover
#

cough

#

@sand lynx

#

there we go

sand lynx
#

agh

#

so many messages

#

falls asleep

fickle rover
#

lol

brisk patrol
#

// Pioneer glows by default orig(self); if (self.lightSource != null) { self.lightSource.stayAlive = true; self.lightSource.setPos = new Vector2?(self.player.mainBodyChunk.pos); if (self.lightSource.slatedForDeletetion || self.player.room.Darkness(self.player.mainBodyChunk.pos) == 0f) { self.lightSource = null; } } else if (!self.player.DreamState && self.player.SlugCatClass.value == "Pioneer") { self.lightSource = new LightSource(self.player.mainBodyChunk.pos, false, Color.Lerp(new Color(1f, 1f, 1f), (ModManager.MSC && self.player.SlugCatClass == MoreSlugcatsEnums.SlugcatStatsName.Slugpup) ? self.player.ShortCutColor() : Color.cyan, 0.5f), self.player); self.lightSource.requireUpKeep = true; self.lightSource.setRad = new float?(600f); self.lightSource.setAlpha = new float?(1f); self.player.room.AddObject(self.lightSource); }

#

this is how I attached a lightsource to my custom slugcat

#

mess with the numbers and colors & stuff to adapt it to how you want

fickle rover
#

THANK YOU SO MUCH???

brisk patrol
#

you're welcome!

fickle rover
#

All I gotta do is attach this under my timer then?

#

And edit it?

brisk patrol
#

I dunno, this works for attaching a lightsource

#

you're gonna have to try it out

#

oh just so you know, this is in a hook to PlayerGraphicsUpdate

fickle rover
#

Oh

#

I gotta find an ss of my timer

#

I'd open my file again but this is from me scrolling back

fickle rover
#

Not sure what to do next, I gotta clean anyway

fickle rover
#

Oh wait nvm

#

I just read it again don't mind that monklaugh

fickle rover
#

@brisk patrol (sorry for ping) but are you able to help me work this out if you aren't too busy soon? slugjump

fickle rover
#

should i remove my cwt?

#

nothing's really in it

brisk patrol
#

I mean, i don't use a cwt for that

#

it's really up to you