my_hat_stinks

joined 2 years ago
[–] my_hat_stinks@programming.dev 1 points 6 days ago (1 children)

A saloon is where you get a drink, a salon is where you get a haircut.

[–] my_hat_stinks@programming.dev 6 points 1 week ago* (last edited 1 week ago)

I've only just started with Godot so I can't give you anything Godot-specific, but it sounds like you're asking for the logic to link things together. I'll make some recommendations here but you'll definitely have to adapt it to work for you. There's a few different ways to do this and it depends on exactly how you want your system to work. From what you've said it seems like you have (or want) two classes, a PointManager and an EquipableItem (or whatever you've called the class in your pastebin).

What do you mean by groups here? You've identified global groups as a potential approach and that does seem to be a reasonable approach to access your EquipableItems from your PointManager, but I'm not sure that's what you're actually asking about. You'd have to set up a group for each category of item and add your items to the appropriate groups as they spawn, that seems a bit excessive.

The first approach to grouping objects I'd use would be with enums, this gives you fixed pre-defined categories so is useful for assigning an equip slot to each item, for instance.

/// Set up enum
enum ItemSlot {
    HEAD,
    TORSO,
    LEG,
    // ...
}

// Assign slot to item
@export var slot = ItemSlot.HEAD;

You can then verify this at two points: when you try to equip a new item you can verify that that slot isn't already used, and when you count points you can make sure you only count each slot once. If you want to put an item in multiple slots (eg a dress is torso+leg) you can look into bitwise enums and bitwise logic, but that's a little more advanced so I'd recommend getting the groundwork in first.

The second approach I'd use is a tags system, this is more flexible and can be be used for categorising outfits into as many categories as you want. The simplest way to do this is just an array of string IDs or ints, but this is more prone to user error since you can typo the string or enter the wrong number. On the plus side there's no central enum so you can add new categories whenever you want, even creating a custom category at runtime if you need to.

@export var categories = ["Outfit.Clown", "Color.Yellow", "Type.Fun"] // Any arbitrary tags can be added

My first approach here is just to fire an event to make your PointManager recalculate. Ideally your manager would be doing all of the calculation and the equipped items wouldn't hold any of that logic, but you would need a function on the items themselves to they can check if they can be counted (ie in the correct position). I believe in Godot that would be using the Signals system, full tutorial in the docs here. Event-driven programming is incredibly useful for game dev, even if you decide not to use this approach here I'd still recommend trying to get the hang of it.

Your drag function is doing a lot so it does need split up and simplified a bit, but for our purposes it'll be enough to combine the two elif branches since they're doing the same thing, that lets us fire the event in one place for both successful and unsuccessful drag so we can recalculate the score. You'll end up with something along these lines:

/* EquipableItem */
signal on_equipment_updated;

func _on_area_2d_input_event(_viewport: Node, event: InputEvent, _shape_idx: int) -> void:
   if event is InputEventMouseButton:
      if event.pressed:
         // [..]
         pass
      else:
         if positionIsPerfect: // add position check here
            position = perfect_position
         dragging = false
         audio_stream_player.pitch_scale =0.5
         audio_stream_player.play()
         
         // Fire the event
         on_equipment_updated.emit() // We can optionally pass this item to the event too if needed

// Might need an export or something to be accessible to point manager?
func is_scoring():
   // Check position or any other issues here, return true to score this item
   return position == perfect_position;
/* PointManager */
var score = 0;

func _on_equipment_updated():
   // Reset score
   score = 0;

   // Get equipment (assuming using groups), might need a bit more to access the item script?
   var items = get_tree().get_nodes_in_group("equipped_items")
   
   // Count scoring objects
   for item in items:
      if !item.is_scoring():
         continue;
      // This is also where you'll check tags/categories/etc for bonus points or preventing duplicates
      score += 1;

The major benefit to using events here is that it almost completely decouples your scoring system from your items, your items shouldn't need to reference your scoring system at all but they'll still be counted as needed. You can swap in different items without touching the point manager, and you can write a completely new point manager without having to update anything on the items. There's exceptions for everything, but as a general rule of thumb the more tightly coupled your code is the harder it is to maintain.

This depends on exactly how you want the items to score together, but we can handle that with the tags we set up before. Let's say for instance we're only scoring items with a specific category, we can simply check if the item has that specific tag before we score it.

/* PointManager */
@export var scoring_category = "Outfit.Casual"

func _on_equipment_updated():
   // [...]
   for item in items:
      if !item.is_scoring():
         continue;
      if !item.categories.has(scoring_category):
         continue;
      score += 1;

Or we could use the same idea to, for instance, only score whatever outfit category appears the most

/* PointManager */
func _on_equipment_updated():
   // [...]
   var scored_categories = {}
   for item in items:
      if !item.is_scoring():
         continue;
      for cat in item.categories:
         if cat.beings_with("Outfit."):
            scored_categories[cat] = (scored_categories[cat] or 0) + 1
   // Use best outfit score
   score = scored_categories.values().max()

Obviously this is all very rough but it should at least give you somewhere to start with your logic.

I'm not sure about that, I think the real issue here is that there just aren't enough train lines

Very unlikely, but that was one argument the no campaign tried to make last time. It's a solved issue, there's already a land border between the UK and EU in Ireland.

[–] my_hat_stinks@programming.dev 2 points 3 weeks ago* (last edited 3 weeks ago)

That's much less clear, that would likely be sorted out after an independence referendum. Crown assets will almost certainly be divided in the same way as all other government property, however that ends up playing out. In my opinion it's more likely than not that the monarchy would still be recognised to some degree. Anecdotally there's far fewer royalists in Scotland than England so there's also a reasonable chance they're scrapped. There's a notable portion on the population who see the monarchy as parasites using taxpayer funds to live lavishly, it's difficult to argue against that.

[–] my_hat_stinks@programming.dev 2 points 3 weeks ago (5 children)

Likely yes, it would be a relatively smooth transition into the EU. Scotland was part of the EU for a long time and a big part of the no campaign on the last referendum was that Scotland would risk it's EU membership. Scotland also voted strongly in favour of staying in the EU but was outvoted by England.

[–] my_hat_stinks@programming.dev -1 points 3 weeks ago (1 children)

On an article about employees not getting paid someone commented with the excuse that they're moving "more in line with youtube" where creators don't get paid. Since you apparently disagree with the obvious meaning, how did you interpret that?

[–] my_hat_stinks@programming.dev 4 points 3 weeks ago (4 children)

So you believe it's okay to not pay the people you hire because Google doesn't pay people who upload videos to Youtube?

Market share isn't relevant here, if a company hires you to do something they pay you for your work. If they don't recoup their costs from the work they hired you to do that's a bad business decision on their part and not a valid reason to not pay you. This is why developed countries have employee rights laws.

[–] my_hat_stinks@programming.dev 3 points 3 weeks ago (6 children)

Do you consider that a valid reason to hire people and not pay them? To me it just sounds like an excuse for a company to abuse a lack of employee rights to get free labour.

[–] my_hat_stinks@programming.dev 1 points 1 month ago (1 children)

What you're describing there is an etymological fallacy, a surprisingly literal one at that. By that logic the word "literal" should only refer to written text since it originated from the Latin word for letter, as in alphabet characters. Words' meanings are defined by how they're used, you're complaining about how the word is being used, and you claim anyone using it doesn't understand the meaning of the word. That is prescriptivism.

[–] my_hat_stinks@programming.dev 0 points 1 month ago* (last edited 1 month ago)

Where are you getting your news? Wherever it is you should stop, you're being fed (and spreading) misinformation.

In the UK, wages and salaries are notoriously low

About 12-14th place worldwide. https://en.wikipedia.org/wiki/List_of_countries_by_average_wage https://www.worlddata.info/average-income.php https://www.numbeo.com/cost-of-living/country_price_rankings?itemId=105

Im a lot of cases the salary allows employers to pay less because it’s considered different to a wage.

This is untrue. Minimum wage for salaried workers is calculated by average hours worked per pay period, if after dividing your pay by your average hours you are making less than minimum wage and your employer doesn't fix this you should report them immediately.

The reason our salaries are this low is not just because of funding the NHS,

This obviously doesn't make sense on the surface since NHS is paid for through taxes and not salary deductions so you seem to be making a tax argument instead (?), but regardless while per capita spending on health services in the UK is high compared to some other countries, it is far from the highest.

but because we have a huge portion of our population unemployed and thus needing welfare support

At ~4.2% it's middling by most measures, but I'd definitely prefer lower. https://en.wikipedia.org/wiki/List_of_countries_by_unemployment_rate https://worldpopulationreview.com/country-rankings/unemployment-by-country

which comes straight out of the money businesses have to pay people with

I don't even know how to respond to that. You are aware that this is handled by the government and not private business, right? Is this just another roundabout way to complain about being taxed?

the government spends a huge amount on processing asylum and immigration claims (of which there’s an extraordinary amount given the size of the country)

Are you aware that support for refugees in the UK comes out of the aid budget which has been reduced from 0.7% of gross national income in 2021 to 0.5%, and further decreased to 0.3% by 2027? Less of your taxes are being spent on this category now.
https://commonslibrary.parliament.uk/research-briefings/cbp-9663/

Regardless, number of refugees is high but not extraordinarily so for the region. Speculation, but that's likely due to English being the de-facto lingua franca for international communication so asylum seekers are more likely to speak the local language.
https://data.worldbank.org/indicator/SM.POP.ASYS.EA?contextual=region&end=2024&locations=GB&start=2000

The issue here is mismanagement more than number of refugees, the UK government reportedly managed to spend $26,000 per person compared to most countries spend under $10,000. As mentioned above though, this is from the aid budget which has already been reduced, this mismanagement prevents foreign aid but does not decrease your salary.
https://www.cgdev.org/blog/costs-hosting-refugees-oecd-countries-and-why-uk-outlier


Barely two paragraphs in and this is already too long, if you want the rest of your comment to be taken remotely seriously you should at least add some sources.

UK, there is no standard. I've seen last working day of the month, every second week, 28th of every month, once per week, last Friday of the month unless that Friday is also the last day of the month in which case it's the Friday before.

Hourly workers tend to be paid weekly or fortnightly and salaried workers tend to be monthly but as far as I know there's no real rules, you get whatever your employment contract says.

 

Seems like federation has been broken for a little over a day. Comments don't seem to be propagating to or from other instances, checking All/new it suddenly switched from a constant stream of posts from other instances to exclusively posts by local users.

 
 
 
 
 
 
 

I signed in this morning and checked my profile to find I'm not actually here. Did anyone else accidentally stop existing overnight?

 

Not sure exactly how long this has been happening, but it's been bugging me for the last week at least.

Running Firefox 129.0 (64-bit) on Linux Mint, it seems like the login session is just constantly expiring. Every time I boot up my machine the first time I open programming.dev I have to sign in again. Closing all programming.dev tabs and navigating back to programming.dev without closing Firefox seems to always preserve the session and not require a new sign-in.

~~Closing all Firefox windows then opening Firefox and navigationg to programming.dev is a semi-reliable way to reproduce, about 75% of the time it requires a new sign-in even when I'd signed in less then a minute ago before closing the window.~~ Further testing shortly before submitting this post and those steps no longer reproduce the issue, I'm signed in even after closing the window. Maybe it's a recurring transient issue with login service?

Potentially relevant add-ons are UBlock Origin (0 blocks, shouldn't be an issue) and Privacy Badger (also 0 trackers blocked). I'm connected through VPN, but the issue seems to appear regardless of whether I stay on the same VPN server or switch servers. Firefox reports Content-Security-Policy issues but these seem unrelated and also appear when the session is successfully preserved.

Possibly helpful, occasionally when I open programming.dev I'll see it's signed out then automatically signs in after a second or so; this might have been a known Lemmy issue at some point with delayed authentication as a (now insufficient) solution. A good chance that's a dead-end, might be worth checking anyway.

Edit: It's worth noting that I'm also signed in via the android Jerboa app on another device and don't get signed out there. This could definitely be relevant if it turns out the Jerboa session somehow interferes with the Firefox session.

 
view more: next ›