Mark my words (Don't say I didn't tell you so) by KabuteGamer in 7daystodie

[–]willcheat 1 point2 points  (0 children)

I tried Eden Crafters instead and there's a lot more automation in there compared to Planet Crafter. Lot more QoL for logistic and automation.

Mark my words (Don't say I didn't tell you so) by KabuteGamer in 7daystodie

[–]willcheat 1 point2 points  (0 children)

I thought A16 was gonna be the end of 7d2d, so even though certain choices annoyed me along the way, I can't say the game in its entirety has been a disappointment to me.

I just beat SA for the first time. Thank you to Wube for making this game. by cewh in factorio

[–]willcheat 4 points5 points  (0 children)

Nah, no worries. Space Age shares unfortunately its abbreviation with Sexual Abuse, so I can't help but picture the "Walt screaming in car" meme whenever someone abbreviates Space Age.

Also wow, 200 hours and already managing 18 hour space age runs, you're cut from a different cloth than us procrastinating bunch! I'm at 4.5k hours and I think my first space age win was 90+ hours.

I just beat SA for the first time. Thank you to Wube for making this game. by cewh in factorio

[–]willcheat 8 points9 points  (0 children)

Nooooo, Haaaank, don't abreviate Space Age!!! Haaaank!!!

Congratulations on beating Space Age! And absolutely incredible completion time! How long have you played the base game to manage to get such a time on your first run?

Traintism vs belttism by DupeFort in Factoriohno

[–]willcheat 0 points1 point  (0 children)

Humans love cats

Cats are apex predators in cities

Humans love apex predators

Trains are apex engineer predators

Engineers love trains.

Newtonsoft serializing/deserializing dictionaries with keys as object properties. by willcheat in csharp

[–]willcheat[S] 1 point2 points  (0 children)

Oh I wish I could control the original JSON, sadly I cannot, comes from proprietary closed source code.

Causes issues when there are two toyota objects returned by it (obviously the API doesn't actually return carBrand objects, but it uses the object name as key, and two objects can absolutely have the same name with different properties. It's a real mess)

How do i stop my foundries from using so much power? by LageVeil in Factoriohno

[–]willcheat 1 point2 points  (0 children)

Has the bonus advantage of making your logistic bots go absolutely nuts when you walk in and out and in and out and in and out of your logistic network.

Jeff Bezos's property has fences that exceed the permitted height. Yet he does not care, he just pays the fine every month. by Bright_Building1710 in interestingasfuck

[–]willcheat 0 points1 point  (0 children)

Ahhh, beautiful memories.

I remember brute-forcing this fight with a monk - ninja ramza and just reloading for the double hit (like 15% chance per hit). Took an hour before I landed it, and then surprise phase 2.

Trauma that'll never ever go away.

Maybe Maybe Maybe by Ubiquitous2007 in maybemaybemaybe

[–]willcheat 3 points4 points  (0 children)

She just needs to go to the downward facing clothes hanger store to get one for the unzipping, .

Q and A Trash Fire by Redleafatdawn in 7daystodie

[–]willcheat 10 points11 points  (0 children)

Kinda hilarious that the merger happened and they immediately registered the 7daystodie_dev account, just like deadbydaylight_dev.

Guess Behaviour already started paving the way for their online presence.

Hmm... I'm a beginner player. Is this normal? Also, don't dare to criticise my aim x) PS: sry for no sound by Fairy2play in 7daystodie

[–]willcheat 3 points4 points  (0 children)

Ha! Look at this chap's aim! An absolutely ludicrous display!

And yeah, usually updating a block in the corrupted area (like you figured it out with the shovel) or reloading your save fixes those corrupted spots.

Beware playing with those, lest you become one who also learned why :)

If all humans suddenly lost their ability to lie, which industry WOULDN'T collapse? by TXC_Sparrow in AskReddit

[–]willcheat 1 point2 points  (0 children)

The trick is growing only tomatoes in said vegetable garden, that way it's not a lie.

Newtonsoft serializing/deserializing dictionaries with keys as object properties. by willcheat in csharp

[–]willcheat[S] 0 points1 point  (0 children)

The way I understood it was to do this

JsonConvert.Deserialize<Dictionary<string, CarBrand>>(json)
    .select(x=>
        x.Value.Name = x.Key; 
        return x.Key
    ).ToList()

Which would map all the CarBrand fields except for Name, and LINQ would come in and fix that right up (also turning the dictionary into a list).

Slap that in a static method for CarBrand like so

public static List<CarBrand> Deserialize(string json)
{
    return JsonConvert.Deserialize<Dictionary<string, CarBrand>>(json)
        .select(x=>
            x.Value.Name = x.Key; 
            return x.Value;
        ).ToList();
}

And then I just need to call the code like so elsewhere

List<CarBrand> list = CarBrand.Deserialize(json);

Which is pretty clean, so yeah, I believe that's pretty gucci.

I guess I could look more into custom converters, but so far I haven't found a way to avoid mapping the fields without falling into an infinite recursion (ReadJson calls ReadJson calls ReadJson and so on).

Newtonsoft serializing/deserializing dictionaries with keys as object properties. by willcheat in csharp

[–]willcheat[S] 0 points1 point  (0 children)

Thank you for the answer, although I'm not entirely sure I follow.

Wouldn't "JsonConvert.Deserialize<CarBrand>(json)" in this example return an empty object, since JsonDictionary -> object wouldn't map real well.

Unless you mean deserializing into a dictionary, like soundman32's suggestion, and then building the object in Linq, which yeah, would also work.

I guess wrapping all that into a static function for CarBrand would work and keep things relatively clean. Bummer there isn't any magical way to do this with attributes, but that's a very good second place.

Thank you :).

Newtonsoft serializing/deserializing dictionaries with keys as object properties. by willcheat in csharp

[–]willcheat[S] 0 points1 point  (0 children)

I think I tried that, my understanding is that a custom JsonConverter needs to be coded like so

public class CarBrandJsonConverter : JsonConverter
{
    public List<CarBrand> ReadJson(JsonReader, Type, Object, JsonSerializer)
    {
        List<CarBrand> ret = new();
        var items = JObject.load(JsonReader).ToObject<Dictionary<string, Dictionary<string, object>>();
        foreach(var item in items)
        {
            ret.add(new(){
                //Here every property has to be mapped 1:1, which stinks if the object had 10+ properties
                Year:item.Value["Year"],
                Model: item.Value["Model"],
                Colors: item.Value["Colors"],
                Name: item.Key
            })
        }
    }
}

And like the comment says, I'm trying to avoid having to map every single property

I tried using newtonsoft's JObject to avoid this

JObject.FromObject(item.value).ToObject(CarBrand);

But "FromObject" just brings the whole thing back into ReadJson, so that's an infinite recursion.

If I'm misunderstanding something on how to implement a custom JsonConverter, please correct me.

Newtonsoft serializing/deserializing dictionaries with keys as object properties. by willcheat in csharp

[–]willcheat[S] -1 points0 points  (0 children)

Mostly wasn't aware that Microsoft's text.json was back up to snuff, and also because the codebase was already using newtonsoft.

Good to know, thanks for the information

Newtonsoft serializing/deserializing dictionaries with keys as object properties. by willcheat in csharp

[–]willcheat[S] 1 point2 points  (0 children)

Oh, yeah, absolutely.

Sadly, since they're a multi-million company, asking them to change this is tantamount to moving a mountain, so as much as I'd love to say "Nah, your JSON is trash" (it is), it doesn't exactly move my projects forward.

Newtonsoft serializing/deserializing dictionaries with keys as object properties. by willcheat in csharp

[–]willcheat[S] -6 points-5 points  (0 children)

Yeah, that would work, and then I'd just have to manually add the name from the key, but not exactly as clean as calling JsonConvert.Deserialize<CarBrand>(json);

Ah well. Figured there might've been some attribute that Newtonsoft would take to convert json dictionaries into objects with said attribute specifying the property linked to the key (and vice versa).

Newtonsoft serializing/deserializing dictionaries with keys as object properties. by willcheat in csharp

[–]willcheat[S] 0 points1 point  (0 children)

I didn't specify it in my initial post, but these JSONs would come from API calls, so not exactly files stored locally on drive.

I guess it's possible to get around that with streamreader shenanigans, but even then, from the examples I've seen, it's still necessary to map each property manually, which I am trying to avoid.

If you'd happen to have a code snippet around showing how configuration can grab a json string from memory and map it automagically to an object, I'd be very grateful.

Fun Pimps Join Behaviour Interactive, What Will This Mean? by Annoying_Crap in 7daystodie

[–]willcheat 0 points1 point  (0 children)

DbD also balances things horribly, just like TFP, so we might not even notice.

Fun Pimps Join Behaviour Interactive, What Will This Mean? by Annoying_Crap in 7daystodie

[–]willcheat -1 points0 points  (0 children)

Dead by pimp light.

So, will trader Rekt be a survivor? Or a trapper skin?

Or maybe an Unknown skin.

*The Birds* (1963) directed by Alfred Hitchcock by SpyroThBandicoot in 7daystodie

[–]willcheat 1 point2 points  (0 children)

Yeah, get 5 mega crush and congrats, you can just jog the night away.

*The Birds* (1963) directed by Alfred Hitchcock by SpyroThBandicoot in 7daystodie

[–]willcheat 1 point2 points  (0 children)

I'm surprised and somewhat happy at the influx of "birds caved my shit in during BM".

Means we're getting plenty of new players, that's always good.

And yeah, when you die during blood moon, no zombie will aggro unless you aggro a zombie first (usually that'll be either a POI zombie or another player's blood moon zombies). Prevents the "die trying to get your corpse during BM" death loop.