mtasa-resources icon indicating copy to clipboard operation
mtasa-resources copied to clipboard

Hay doesn't reset

Open turret001 opened this issue 4 years ago • 4 comments

Is your feature request related to a problem? Please describe. When a game of hay is over (player picks up the burger) it should teleport everyone down and re-create the burger pickup but it doesn't.

Describe the solution you'd like It should teleport everyone down and re-create the burger pickup.

Describe alternatives you've considered

Additional context I don't have any coding experience so I wasn't able to inspect the code but I've checked debugscript monitor while picking up the burger and nothing came up. However, there was an outputChatbox that was getting triggered when I picked up the burger, so script knows I won but it doesn't reset it. (or even if it does, it's not resetting fast enough.) I tried jumping down and respawning but no luck.

I have a test server set up, feel free to test at 195.174.168.123 (superman is added and should be available to everyone as well. just type /superman )

turret001 avatar Aug 24 '21 01:08 turret001

That was never coded in, when a player picks up the burger all it does is destroy the burger, send a message in chat declaring them the winner, then enables them to shoot (it used to be a minigun instead of a burger)

The code for that resource is a bit trash, without some cleanup the easiest way right now would be to simply restart the resource (using restartResource) after this line https://github.com/multitheftauto/mtasa-resources/blob/d208b13649abeb46afc7d59a0f0cfe6265691610/%5Bgamemodes%5D/%5Bhay%5D/hay/Hay.lua#L223

All the init stuff is done inline, directly when the script loads, that needs moving into a function of its own. There's also no function currently to "reset" the round and ensure previous stuff / memory is cleaned up.

Lpsd avatar Aug 24 '21 02:08 Lpsd

Hay is 1 of the most iconic gamemodes of MTA, especially in the early years (just like Fallout). So that's why i feel it deserves a rewrite..

Dutchman101 avatar Aug 24 '21 03:08 Dutchman101

I don't know about a rewrite but it definitely needs to be updated to work better

turret001 avatar Aug 24 '21 19:08 turret001

I had started some refactoring work a long time ago but didn't think there was any interest in reviving this gamemode and moved on to other items. Since it appears there is, I'll see if I can crank out a PR in the next week or two.

jlillis avatar Aug 24 '21 19:08 jlillis

Since the large refactor seems not to be happening, I propose just basic round restarting as the new goal..? Would #420 suffice?

Dark-Dragon avatar Apr 03 '23 04:04 Dark-Dragon

Forgot about this... I had started to rewrite the gamemode but then got busy with work. Not really interested in getting started on this again at the moment. I think making some quick fixes would be great.

jlillis avatar Apr 03 '23 21:04 jlillis

I'd honestly be happy to give rewriting it a shot since it'd be a nice break from my usual work and hay is very iconic gamemode. Would be nice to figure out if there's any changes we'd like to have as part of the rewrite though.

MegadreamsBE avatar Apr 03 '23 22:04 MegadreamsBE

Yeah, I think I'm going to commit to the rewrite. I pretty much have the entire base finished (spawning of the players, hay bales and rocks are spawned and hay bales move in a similar fashion to old hay. Also spawning in the pickup already, just need to update the scoreboard, show some info like old hay on the right side and write the logic for the game to end.

I'm making the code base easier to work with and more reusable. It's easy due to the way I've written it to reset the gamemode without having to restart the resource.

MegadreamsBE avatar Apr 04 '23 01:04 MegadreamsBE

I had a short list of things I was looking to do with hay you might consider: 1: Use EDF to allow custom hay mode maps. Can have multiple stacks, each customizable in element settings. 2: Integrate more with other resources to reduce bloat - mapcycler/mapmanager, missiontimer, spawnmanager, etc. 3: Singleplayer themed UI (easy)

Points 2 and 3 should be easy. I was having trouble setting up the EDF stuff in a way that works well within the editor - particularly, the ability to visualize the haystack once placed.

jlillis avatar Apr 04 '23 03:04 jlillis