#Better Vuoksikivi

27 messages · Page 1 of 1 (latest)

plush prairie
jovial moth
#

👀

#

How'd you implement this?

plush prairie
#

17 lines of init.lua, lmao

#
---@type nxml
local nxml = dofile_once("mods/BetterVuoksikivi/nxml.lua")
local vuoksikivi = "data/entities/items/pickup/waterstone.xml"

local xml = nxml.parse(ModTextFileGetContent(vuoksikivi))

local new_child = nxml.new_element("MagicConvertMaterialComponent", {
    _tags="enabled_in_world,enabled_in_hand",
    kill_when_finished="1",
    from_material="",
    from_material_tag="[radioactive]",
    steps_per_frame="2",
    to_material="water",
    clean_stains="0",
    is_circle="1",
    radius="64" ,
    loop="1",
})

xml:add_child(new_child)

ModTextFileSetContent(vuoksikivi, tostring(xml))
#

that's the whole mod

jovial moth
#

woah! nice!

odd brook
#

bruh bringing the entire nxml into it lul thinking about it, it is way easier.. if only the api included something like nxml; but technically it makes it way more than 17 lines

plush prairie
#

i mean, Nathan would kill me if i did it through strmanip

odd brook
#

a tiny little little gsub is not scary tho

jovial moth
#

HEH

narrow bison
tough swan
odd brook
# narrow bison it will break if another mod edits it

bruh nope?.
like editing the text with nxml is different from editing the text with gsub only in that nxml is more convenient

I guess you meant that stupid gsubs will be incompatible, which is fair enough, and nxml helps avoid that

but something like "insert text before closing tag of some xml" should be fine lul

narrow bison
#

nxml will understand these, gsub wont

odd brook
#

I mean if you want to cover "what if someone will change the specific closing tag format of this vanilla xml i'm editing" then you can write a pattern that handles that, so technically gsub will work

but nxml (in some form) should be included in the game regardless

#

I guess covering that case is prudent, cuz who knows what people will do lul

narrow bison
#

well nxml will automatically use correct xml formatting

#

and nolla often just.... doesn't

#
  • its not like nxml is super bloated
odd brook
#

nah I was just memeing when I said the entire nxml

yeah nxml is obv superior, although I dislike that every mod ever ships it

although again, not like people install hundreds of mods and even then it is tiny anyway, meh

||I actually rewrote nxml in rust lul||

narrow bison
#

nxml could be extracted into a dependency mod, given i don't intend to make any breaking changes (unless nxml parses some xml wrongly)

#

nxml will only get new functions + increases in correctness

#

don't think i will change the existing functions input / output