Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow reading files from data_static #1057

Merged
merged 3 commits into from
Oct 2, 2023

Conversation

EntranceJew
Copy link
Contributor

not tested extensively, feature still in dev for gmod itself

@saibotk
Copy link
Member

saibotk commented Sep 29, 2023

Nice!
Is there any documentation on what is allowed in the folder or how did you come up with this?
E.g. is there any standard folder for the map entspawnscript json to follow the same path in the data_static folder?

@saibotk saibotk added type/enhancement Enhancement or simple change to existing functionality accepted labels Sep 29, 2023
@EntranceJew
Copy link
Contributor Author

EntranceJew commented Sep 29, 2023

I did some testing on the Dev branch to confirm that there was no auto-overlay behavior, I was prompted to look into it after I saw this commit in the gmod discord

There was some discussion about it but ultimately Rubat said:

it's just a folder you file.Read from, omg you guys

which revealed it was likely just going to exist along-side data/, which makes sense with my testing.
(no DATA_STATIC context, no reading data/file.txt in place of data_static/file.txt or vice-verse, etc)

Ultimately means there is no convention and the fall-through behavior is up to us to enforce if we desire it. Otherwise it's just another folder we can't write to like maps/. It probably only obeys the filetype restrictions that gmad.exe enforces globally.

I use gmpublisher so I haven't actually experimented with what gmad.exe will or won't reject just yet.

@saibotk
Copy link
Member

saibotk commented Sep 30, 2023

Okay, so there is nothing really special about it?

Then another question, what benefits do we get from adding the new folder?

And are these two the only parts that actually read from the data folder? I dont remember currently but i could imagine there being more.

@EntranceJew
Copy link
Contributor Author

The only thing special about it is that it isn't ignored by GMA like data is, so people can create addons out of their weapon placements similar to all the rearm script addons that are out there for TTT.

Now people can distribute weapon spawn rebalance packs or button fix configs for maps specifically using TTT2's files, because even with the ttt2.fgd you can't specify a random grenade spawn which is a small thing but could be huge for how someone's got their configurations laid out.

image
These are all the places I see file.Read being run, so if there's something else reading files somewhere, I'm imagining it's going through one of these locations.

The only one I didn't change is reading the TTT1 text files included inside maps/ which, since it's legacy behavior, is something better suited for that step in the process before it gets converted to the TTT2 spawn file.

@saibotk
Copy link
Member

saibotk commented Oct 1, 2023

Alright sounds sensible, thanks for explaining this in detail!

@saibotk saibotk requested a review from Histalek October 1, 2023 09:34
Copy link
Member

@Histalek Histalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So does this mean that server owners can now setup entspawnscripts that only affect TTT2(or rather terrortown) and don't mess with other game modes?
That's neat.

lua/ttt2/libraries/entspawnscript.lua Outdated Show resolved Hide resolved
@EntranceJew
Copy link
Contributor Author

So does this mean that server owners can now setup entspawnscripts that only affect TTT2(or rather terrortown) and don't mess with other game modes? That's neat.

Yes, totally. And excellent catches. Subconsciously I think I wanted to just force it to read from "data/" as "GAME" and fallback to "data_static/" as "GAME" but that wouldn't work for writes, and got distracted. I appreciate the oversight for situations like this.

image
I was also able to pack the files with gmad in the dev branch, although I'm not able to test reading a packed gma from the addons folder by itself at the moment, but I do know that you can always read anything inside garrysmod/ as "GAME" so it isn't that big of a deal.

image

At least, I was able to prove that data/ is still not whitelisted:
image

Copy link
Member

@Histalek Histalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely a nice addition. Thank you very much!

@Histalek Histalek merged commit fc797b6 into TTT-2:master Oct 2, 2023
@EntranceJew EntranceJew deleted the feature/read_data_static branch October 28, 2023 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Enhancement or simple change to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants