[Proposal] Implementing FSCRIPT: Deploy-time file modification #6
Labels
No Label
action plan
bug
cross-platform support
dev
duplicate
enhancement
help wanted
invalid
needs verbosity
priority
high
priority
low
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: bonkmaykr/firestar#6
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Some modders will want to have files be modified automatically by Firestar using a patch system rather than replace the entire file in order to avoid compatibility issues with other mods. As of 1.2, Firestar is not capable of doing this, it simply repacks files. 1.3 changes this.
After some internal discussion, I've come up with a format that Firestar will use to make these changes.
A file will be placed at the root of the FSTAR (along with data/ and pack.png) called changes.fscript, this file instructs Firestar in sequential order what alterations to make. This can be used as an alternative to file replacements.
I don't intend on removing the data/ folder requirement for
Generate New Mod from Folder...
so if your mod only uses this fscript and nothing else then an empty data/ folder will suffice.My only concern with this approach is that it's somewhat complicated to implement as it would require making our own parser.
File paths start from FSTAR root (~/.firestar/temp/ during deploy-time).
List of commands and their usages:
locate [path]
Selects the current working file. If this fails, then for safety, all other commands are skipped until the next
locate
and a warning is printed.delete [all|which] [text]
all
deletes all matches,which
is any integer starting from 0 that points to an instance of that text. For example, if it appears 3 times:...And we use
delete 1 "quick brown fox"
Then:
all
is implied by default.replace [all|which] [text1] [text2]
Replaces text1 with text2. Same rules apply as above.
replace all "AG-SYSTEMS" "GTech"
all
is implied by default.apply-diff [path]
Applies the patch file at the specified
path
location to the currently selected file.Example:
Dedicated XML editing options also included below, use those when possible.
xml select [css selector] <which>
Selects an XML object inside the current file, only if valid XML is present.
If which is not specified then the first match is selected.
xml select-child [css selector] <which>
Same syntax as previous. Selects the child of the current selected object.
xml select-parent
Self-explanatory.
xml add-child [tagname] [attributes]
Gives a child to the currently selected XML node.
Example:
xml add-child Image src="data/SomeImage.gxt"
xml delete
Deletes the current node and it's children. Afterward, selection is automatically moved to the parent if it exists, otherwise nothing is selected.
xml append [path]
Copies the specified
path
XML into the selected XML node.xml merge [path]
Combines the selected XML file and specified
path
XML.An example of the proposal that is currently being implemented.
Above demo from Wirlaburla was implemented -- closing