#Umbrella Project

1 messages ¡ Page 2 of 1

thick ravine
#

@languid walrus How curious are you to see this working?

languid walrus
#

just a curiosity really

thick ravine
#

Hmmm

#

I know co` expressed his interest

cold ruin
#

Oh, did I?

thick ravine
#

All good if you had a change of heart.

cold ruin
#

Well I do love python, but don't feel the need for writing python mods 😅

thick ravine
#

Hahaha darn. Okay then.

round ermine
#

request to pin links

thick ravine
round ermine
thick ravine
#

Wish I could

#

Surprised I can't.

thick ravine
thick ravine
#

@lusty steppe Hey. You've been pretty silent for a bit. Are you still planning to implement Rosetta's schema at some point?

#

I might fork your project and add support myself.

lusty steppe
#

Still planning to at some point, yeah. Between work & personal stuff I've been a bit busy. Wouldn't be opposed to you forking it, but I still had a significant restructure in the works for how everything is handled

thick ravine
#

The reason why I'm interested in your end is because I'd like to start documenting the Lua-side API myself.

lusty steppe
#

I'm going to be moving this week & weekend so I don't anticipate being able to do anything until next weekend at the earliest—I did have some ideas about how the schema may need to be tweaked (into a superset) to account for some Lua stuff, but I'll have to take a closer look to know whether that'll be necessary

thick ravine
thick ravine
#

@lusty steppe Did any of the code I referenced that uses luaparse help you?

#

Simply curious is all.

lusty steppe
#

I used the same method for sanitization of break; and numbers; I believe that's all

thick ravine
#

Heheh..

#

Glad that helped someone else.

#

It was a pain when I had to figure out what was the issue.

lusty steppe
#

Really ought to add an issue for that break thing—I saw where in the luaparse code it was causing an issue but I don't think I made a issue for it

#

I doubt they'd handle the number thing since it's non-standard

thick ravine
#

Lua is fine with break and ; so it is luaparse.

#

The number thing is non-standard and correct for luaparse to lexically fail.

#

It's something that Kahlua is okay with because they deliberately ignore it. It means nothing.

#

TIS is writing pseudo-Java in Lua in those blocks.

lusty steppe
#

Yeah it's definitely luaparse, I mean I found where in the luaparse code it's failing

thick ravine
#

Probably needs a gentle push via pull request of fork.

lusty steppe
#

And that I doubt they'd add a "fix" for the number thing considering that

thick ravine
#

I just installed your repo locally.

#

Anything I need to know?

lusty steppe
#

I'll probably start with an issue at some point and do a PR if not fixed. Last time the maintainer was pretty quick with the fix when I pointed out where the problem was

#

Nothing too special, but it is using rollup

#

I don't remember whether I included a build script command in package.json. I think I just used a vscode build task

thick ravine
#

I can add one.

lusty steppe
#

When using it you'll need to specify an input and output directory with -i and -o flags

thick ravine
#

I'm going to use your project to write the Typescript Rosetta API and then separate it and release it as an npmjs module.

lusty steppe
#

Sounds good

thick ravine
#

So I'm a virus.

#

lol

#

Turning your project (The cell) into a virus production factory.

#

x)

#

BTW Rosetta has a Java library. I haven't published it on a maven repo yet.

#

It's not actually done. I'm to write the patch loading and overriding part at some point.

#

We get to a point where both Java and Lua API has rosetta support and I can start documenting.

thick ravine
#

I can't seem to run your compiled JS file outside of the yargs entry point.

#

I get no output.

#

node pz-doc.js -in 'assets/lua/' -out 'dist/lua/' -verbose true

#

Yeah.. yargs is not fully executing for some reason.

#

@lusty steppe

#

Spent my lunch today trying to figure that out. =/

lusty steppe
#

Unsure what would be happening there. No output whatsoever, including no errors, I presume?

thick ravine
#

Yeah, even if I know it should error.

#

I ran node against a console.log test file and it outputted.

#

Something's getting stuck at the processing of the entry-point of the program.

#

I expected some sort of error or console logging when running your built js file.

#
npm i
npm run build
node pz-doc.js -i .. -o ..
#

.command('annotate', ..

#

God damnit.

#

I wasted an hour not realizing I had to write annotate

#

yargs should complain when you don't have a command.

#
npm i
npm run build
node pz-doc.js annotate -i <DIRECTORY> -o <DIRECTORY>
#

Got it working.

lusty steppe
#

In your defense I missed that above too, lol

thick ravine
#

lol

#

You can use the JSON flavor of Rosetta.

#

You don't need to use YAML.

#

(I spit out both)

#
 "scripts": {
    "build": "npx rollup --config",
    "start": "node pz-doc.js annotate -i assets/lua -o dist/lua -v true",
    "dev": "nodemon --watch **/*.ts --exec \"npm run build & npm run start\""
  },
#

👍

#

Having issues with the watch part but the execution part is working fine.

#
"build": "npx rollup --config",
"start": "node pz-doc.js annotate -i assets/lua -o dist/lua -v true",
"dev": "nodemon -e ts --exec \"npm run build & npm run start\""
#

compiles and runs.

thick ravine
#

So that's mostly set up. I'll need to implement the Lua schema objects.

#

Since we have no way to generate Rosetta datasets for the Lua API, it'll be driven by custom patches.

thick ravine
#

Just noticed that the Events API is generated from Python 3.

#

lmk if you need a Rosetta API implemented in Python 3.

languid walrus
#

i just chose a language i knew how to write scripts in, i honestly wanted lua but making a standalone lua program seemed annoying

thick ravine
#

I have no preference. I want to give you tools if you need them.

#

Just started the 2nd phase of Rosetta.

#

I'm thinking of looking into making an environment where mods could be scanned for typings.

#

Would be great to generate or hand-write typings and distribute them with the workshop mods.

lusty steppe
#

I tend to include handwritten typings, generating sounds interesting but I wonder what that'd look like

thick ravine
#

It'd largely depend on the quality of the discovery of Lua entities.

thick ravine
#

Was there a recent marketing push for Umbrella? I'm noticing an uptick in GitHub repo activity.

languid walrus
#

not that i know of, i've been mentioning it when i can though

thick ravine
#

Well someone's marketing it. (Or spreading via word of mouth)

thick ravine
#

Sneaking in some work on the Lua stubs stuff.

thick ravine
#

Writing the patch API.

#

Been updating the schema to reflect changes and improvements.

thick ravine
#
################################
##      LOADING PATCHES       ##
################################

Loading patch: assets/rosetta/patches/jab ..
Reading file: assets/rosetta/patches/jab/json/client/isui/ISUIElement.json ..
Loading Lua Class: ISUIElement
{ notes: 'This is example notes for ISUIElement.' }
#
{
    "$schema": "https://raw.githubusercontent.com/asledgehammer/PZ-Rosetta-Schema/main/rosetta-schema.json",
    "luaClasses": {
        "ISUIElement": {
            "notes": "This is example notes for ISUIElement."
        }
    }
}
#

The patch API is taking shape.

thick ravine
#

Heheh.. I'm already pushing data to the Lua type stubs. @lusty steppe =)

thick ravine
thick ravine
#
--- Draws a texture on the screen using top-left coordinates and a color multiplier.
---
--- @param texture Texture2D The texture to draw. If null, the color will be the texture.
--- @param x int The x coordinate on the screen to draw the left of the texture. (In pixels)
--- @param y int The y coordinate on the screen to draw the top of the texture. (In pixels)
--- @param red double The red color value to draw. (Range: 0.0 -> 1.0)
--- @param green double The green color value to draw. (Range: 0.0 -> 1.0)
--- @param blue double The blue color value to draw. (Range: 0.0 -> 1.0)
--- @param alpha double The alpha value to draw. (Range: 0.0 -> 1.0)
---
--- @return void
function ISUIElement:drawTexture(texture, x, y, red, green, blue, alpha) end
#

This is what I'm currently rendering with the above, hand-written Rosetta patch.

#

@lusty steppe @languid walrus

languid walrus
#

great stuff!

thick ravine
#

You're starting to see my vision.

#

This is what I want Rosetta to be mainly for.

thick ravine
#

Working on fields.

thick ravine
thick ravine
#

@languid walrus @lusty steppe

#

I haven't tested documenting tables or global functions / global values yet.

languid walrus
#

yay!

thick ravine
#

So.. Lua has their own schema objects.

#

This adheres to and simplifies the datasets digested by Rosetta when ran.

#

Also.. Sorry Omar.. I sort of blew up the source folder.

#

Because Rosetta supports patches this opens the door for multi-lingual patches.

#

Even though it's good to know English for programming in general, documented notes in French or Portuguese would be far more helpful to some.

#

Even though I haven't implemented patching on the Java side (Candle), I can start documenting the Lua API now.

#

=)

thick ravine
#

Spent today getting us this far along.

#

When this works for both Candle and LuaStubs then I can plan out a GUI for simplifying the process.

languid walrus
#

great work!

thick ravine
thick ravine
#

We could do stable releases.

#

Might make it easier on people since not everyone is a wizard at Git.

thick ravine
#

The only file I modified for the actual code for PZLuaGenStub is annotater.ts.

#

Everything else is sanitized.

thick ravine
#

I'm not sure what's happening with tables with the Lua stub.

#

Not seeing any annotations for table structs.

#

I'm reading through the code ATM and I don't see anything about table annotations except for rewriting tables.

thick ravine
#

Okay so from what I'm getting the name is handled at the root level of annotate() and not passed because all annotater does for non-classes is write them back into the distributed result lua files.

lusty steppe
#

I think I intentionally didn't mark certain tables as classes since they had looser typing or were intended to be extended. I'd have to look again though

thick ravine
#

So like I can simply support nested Rosetta definitions by calling the item from global.

#

I'm not interested in generating Rosetta datasets for Lua at this point.

#

This is where I think that writing by hand is a good idea / approach.

#

Java is rigid enough to generate and then apply handwritten patches.

#

@lusty steppe I did a lot to your project but again it's only in the annotater.ts file. Are you okay with this?

thick ravine
#

Created a private repo for tracking changes to the game's Lua code.

#

@lusty steppe For nested type defs, I can use:

--- @type table<string, {index: number, spawnChance: number}>
local trafficjamVehicles = {}
trafficjamVehicles["Base.CarNormal"] = {
    index = -1,
    spawnChance = 20,
}
#

For now, what I could do is only apply types at a global scope and any predictable formats can be nested type declarations like so.

lusty steppe
lusty steppe
thick ravine
#

Yes.

#

This is actually what I'm implementing.

lusty steppe
#

If you have a potentially better way via analysis I'm not opposed, but that sort of thing seems better suited for that

#

Gotcha, sounds good

thick ravine
#

Doing more nuanced definitions would be overengineered IMO.

lusty steppe
thick ravine
#

I'm already applying Rosetta for classes if you look up.

thick ravine
lusty steppe
thick ravine
#

It doesn't have to be 100% Rosetta supported immediately.

#

If I can start documenting and have a good percentage documentable then this leave all the time in the world for you to figure out your next steps.

#

The only thing I might tweak right now is static fields.

lusty steppe
#

I'm on board with that, wasn't big on the way the stubs handle them right now anyhow

thick ravine
#

If you don't mind me modifying your code then I'll simply keep at it.

lusty steppe
#

The pivot to analysis was intended to somewhat handle that, so it may end up changing a bit. Make all the changes you like though, I'll just have to read through it when I'm free to work on this again

thick ravine
#

Yeah. I did what I said so far with sanitizing my API.

#

So it's only calling from a loaded Rosetta instance and using the API to apply data when present.

thick ravine
#

Working on a proper project for npm

#

=)

thick ravine
#

Ended up going full cyclic when simply trying to upload my Rosetta API. xD

#

(Been optimizing)

thick ravine
#

So my linter just advised me to clean a lot of stuff haha.

#

Will have to do it later.

thick ravine
#
#

It's professional. \o/

thick ravine
#

Okay so..

#

I'm going to pull the trigger and begin working on the software to edit patches.

#

But before I do, I'm going to work on PZLuaStubGen and get it to use the npm module I just made yesterday right before sleeping.

#

Then I'll form a pullreq.

thick ravine
#

@lusty steppe Submitted first pull request. =)

#

The pz-rosetta-ts code is completely out of your source folder.

#

So PZ-Rosetta now has an official typescript library on npmjs.

thick ravine
#

Battling overflow scrolling problems but worked on modeling the software today..

#

Zero functionality. Entirely CSS / HTML.

lusty steppe
lusty steppe
thick ravine
warped plover
#

Looks great!

thick ravine
#

Webpack is cryptic to me.

#

I do need to properly learn about it.

thick ravine
thick ravine
#

I took a crash course on Webpack today. I know it far better now.

thick ravine
#

@gleaming kettle You'd be interested in the works going on in here. =)

#

Pinged you here since I'd take over the mod channel

gleaming kettle
#

oh lol, here's even another thread, didn't see it

thick ravine
#

I made it for the collab project 'Umbrella'.

#

Seemed convenient to keep development adjacent to it here.

#

PZ-Rosetta allows me to bake this information into the EmmyLua typings rendered through the Lua stubs generator project by Omar that I modified.

gleaming kettle
#

yea, that's cool flex

thick ravine
#

The goal is to provide typings for Java and Lua API while also providing additional documentation on-top.

#

One thing I noticed anyone could do with Rosetta is write typings in other languages than English.

#

=)

thick ravine
#

Going to try to crash course modern Electron soon.

#

The last version that I barely managed to work with was in 2017 and was Electron 7.

thick ravine
#

@languid walrus Thought: extension for Umbrella in vscode that uses fernflower to decompile methods and other items in Java files in the game.

#

Do it as a preview sort-of-thing

languid walrus
#

that'd be beautiful

thick ravine
#

There's a fernflower-wrapper extension on vscode atm

#

I'd like to write my own though.

thick ravine
#

I am making progress on Rosetta Workbench

#

Doing actual work rn but yeah.

#

I'll template out the type forms and then work on selection and assignment code.

#

After that, loading and saving patch files.

#

Getting there..

thick ravine
#

I wonder how many people are using Umbrella right now.

#

Umbrella Project

thick ravine
#

@lusty steppe How goes the Internet crisis?

thick ravine
#

@languid walrus I was thinking of using Steams public API to download mods in a node environment and extract typings from a specific folder in the mod for mod API support / extensions.

#

@warped plover Maybe you can add this to your PZ-Studio solution.

#

So something like /contents/mods/{mod}/media/lua/types/**/*.lua as a filter when searching for typings in a mod project.

#

Mods should be capable of writing their own typings.

languid walrus
#

i just load the mod as a library when i need to

#

(also if we were to do this it should not be in the lua folder so that it doesn't execute)

thick ravine
#

only client, server, and shared are loaded.

languid walrus
#

oh yeah sorry i just woke up LOL

thick ravine
#

Folders inside without those three names will not execute.

#

All good.

#

I'd like to figure out a solution to automatically drag in typings from mods.

#

This would be incredibly helpful for people trying to work with existing mods like TrueMusic.

languid walrus
#

not with the way they're written

thick ravine
#

Which is why I like the idea of a typings folder.

languid walrus
#

i'm not sure i understand what the benefit is as compared to annotating the lua

thick ravine
#

Then again, I'd personally want to see clean code with documentation and types all together as one package.

#

Pointing to /lua/**/*.lua might be best because it'd allow for both scenarios.

languid walrus
#

it'd be nice in the cases where we have to go around the actual mod authors i suppose

thick ravine
#

Sometimes code is too crazy.

#

Yeah. We could make an option for npmjs modules.

#

@pz-types/[MOD_ID] as a module.

#

For this to work it'd have to be a plugin in PZ-Studio or another node environment.

#

Buuuuuuuut

#

I think it's worth the work.

lusty steppe
# thick ravine <@288127781383045121> How goes the Internet crisis?

Internet is here, brain needed a bit more time. I looked over the PR and I have no huge objections, but some points of curiosity:

  • Adding the semicolons to annotator.ts was the result of linting, I assume? (I am staunchly anti-semicolon in TypeScript, but not staunch enough to not accept a PR for it)
  • Why did you add spaces before the @ sign in the annotations? I generally write annots with ---@ and not --- @. Doesn't really matter all that much, but it will unnecessarily inflate the size of the result annotations a tiny bit
#

Asking here rather than on the PR since they aren't really functional problems

thick ravine
lusty steppe
#

Fair enough, but the same question applies to those

thick ravine
#

Since you're rewriting portions of it I let you decide whether to revert or deploy something else.

#

It was my way of rapidly deploying these changes over the past weeks.

lusty steppe
#

Okeydoke. I'll run the annotations to give it a closer look then merge

thick ravine
#

I also need to update the PR.

#

(I'm revising the API for pz-rosetta-ts right now)

lusty steppe
#

Ah gotcha

thick ravine
#

By all means, check it out.

#

All Rosetta does is loads the dataset and patches and allows you to look up additional information to apply to the typings when rendering them out.

lusty steppe
#

Now that I'm set up at the new place I should be good to merge it any evening. Will hopefully be less busy outside work hours

thick ravine
#

Right now I'm refactoring the I/O API.

#

I basically want the API to have the capability to produce patches programmitcally.

lusty steppe
#

Nice. Documentation is something I need to get around to eventually, too

thick ravine
#

"Clean as I cook" is the method I try to follow.

lusty steppe
#

I found one minor thing to change, but see no issues otherwise. Left it as a review on the PR

thick ravine
#

Awesome. Will update things later.

thick ravine
#

My test:

#
const rosetta = new Rosetta('assets/rosetta');

  const patch = rosetta.createPatch('test', {
    name: "Jab's Test Patch",
    version: '1.0.0',
    authors: ['Jab'],
    description: 'This is a test patch.',
    priority: 1,
  });

  const file = patch.createFile({ uri: 'lua/client/ISUI/ISUIElement', type: 'json' });
  const clazz = file.createLuaClass('ISUIElement');
  clazz.notes = 'This is a class.';

  const { conztructor } = clazz;
  conztructor.addParameter('x', 'number', 'The x coordinate. (In pixels)');
  conztructor.addParameter('y', 'number', 'The y coordinate. (In pixels)');
  conztructor.addParameter('width', 'number', 'The width. (In pixels)');
  conztructor.addParameter('height', 'number', 'The height. (In pixels)');

  patch.save();
#

My result:

thick ravine
#

27 changed files with 1,045 additions and 99 deletions.

#

T_T

thick ravine
#

I'm not done with the upgrade but the foundation is there and working

thick ravine
#

Decided to work more on PZ-Rosetta API this evening..

#

It's funny how such a simple-sounding solution when blown up logically is actually a lot of work.

thick ravine
#

So I've coded 13 hours today.

#

Hahaha

thick ravine
#

A lot of progress was made today.

#

I'll need to optimize the JSON schemas and do some cleaning for rendering java patch files.

#

A good victory, even if it's a quiet one.

thick ravine
#

I'm wondering if I should try to move pz-rosetta-ts from a destructive solution for applying patches to the original dataset after loading them.

#

I don't think it hurts anything since the goal is to simply compile and apply everything together..

round ermine
#

What are the plans for lua stabs? Will types be added? @lusty steppe

lusty steppe
#

I do intend to more strongly type eventually using Rosetta, but may need to be a community effort

#

Gonna do a rewrite of the generation code first

lusty steppe
# round ermine What are the plans for lua stabs? Will types be added? <@288127781383045121>

Neglected to reply & was otherwise occupied while sending those, so to add some clarification on the community effort bit: while I'm sure I can cover a fair amount (and I intend to), I think it wouldn't be reasonable for me to try to provide full typing for the Lua codebase on my own—I would likely get tired of it quick. I'll have to see how much of it can be automated with analysis of the code, but if it's not a substantial amount (or not accurate to a degree that's acceptable) it'll require a fair amount of manual work

#

I can certainly coordinate that work for anyone who wants to contribute. This is likely a bit of a ways off, since I haven't been prioritizing this project, but I can try to do some more work on it if stronger typing is something that'd be handy

round ermine
#

If it needs manual work then it would be better to set up a system for the community to contribute.

lusty steppe
#

Hopefully a significant portion of it can be automated, though. Unsure when I'll be able to get around to it, but the repo is open to contributors now too

round ermine
#

hm, would adding a short comment for field with usage and default be useful?

e.g.

---@class ISBaseTimedAction : ISBaseObject
---@field character IsoGameCharacter
---@field maxTime integer special case: -1
---@field stopOnWalk boolean true
---@field stopOnRun boolean true
---@field stopOnAim boolean false
---@field caloriesModifier float 1
---@field useProgressBar boolean true
---@field forceProgressBar boolean false
---@field loopedAction boolean false
---@field action LuaTimedActionNew
---@field [any] any
ISBaseTimedAction = ISBaseObject:derive("ISBaseTimedAction")
round ermine
languid walrus
#

sure, will see if it plays nice with intellij

lusty steppe
#

That said, that part wouldn't be able to be automated at all (I guess defaults could maybe be, but that wouldn't be foolproof)

#

Thoughts on removing the ---@field [any] any once the stubs are improved? I think the original concern was missing extra fields, but classes can always be extended by end users by marking their variable with the same class annotation

round ermine
#

Well not having it can help you find typos or issues faster. On the other hand it can be rather annoying at times, but as you said it's rather easy to add new fields.

#

That being said, it can be set to the ISBaseObject class and all derived classes have it too.

#

It may be nice to add ---@field Type newClassName to derived classes, otherwise it shows me ISBaseObject.

newClass.Type = className

lusty steppe
#

Makes sense, that can be added to classes created with :derive

lusty steppe
round ermine
#

But for the ISBaseTimedAction they are not actually there by default, but in the java action.

lusty steppe
#

Yeah, that's how a lot of (static) defaults are set currently

#

I don't have special handling for ISBaseTimedAction right now, though

lusty steppe
#

Finally made some progress on the rewrite: started on analysis. See: this huge JSON file of the game's Lua files' dependencies 😄

#

Gonna clean them up to ignore stuff like print (or make a best effort to do so), then should be able to resolve guesses for types & better define classes

lusty steppe
#

A fun insight from this: a mapping of the globals the game sets to the filenames that set them (the ones I've successfully tracked, anyway). I wonder whether there's a not-rude way to compile a list of likely unintentional globals (looking at you, o, y1, y2, g, b, ...) and convince the devs to clean them up 😅 doesn't super matter ofc but the globals are already polluted enough as-is with the intentional ones

round ermine
#

OnAiStateChange also triggers for remote players.

kindred jay
kindred jay
round ermine
kindred jay
#

If it's just any then it'll be unknown.

lusty steppe
#

@languid walrus Was there some file (or set of files) that you'd said isn't picked up by the annotator sometime in the past few months? I vaguely remember something like that but can't for the life of me find it

#

I've refrained from mentioning it to not jinx myself and lead to another October-of-2023-that-turns-into-never, but I've been rewriting it (again) the past few days

languid walrus
#

i've noticed it doesn't like the new mod options, i was wondering if that was because it's nested in another table

#

PZAPI.ModOptions iirc, i think it's just annotated as table? i didn't look into what exactly was going on but i don't get completion for any of the functions in there

lusty steppe
#

Gotcha, I'll take a look at that while testing. It might be because of the local Options = PZAPI.ModOptions.Options, but the new way of doing things should be able to handle that fine

#

Thank you!

languid walrus
#

by the way, any plans to have a skip/override file feature? it doesn't really matter but the item distributions and recorded media definitions get dumped in their entirety into the output and it ends up being almost the entire filesize of umbrella

lusty steppe
#

Yeah, Jab had left an issue about that; those should definitely just be handled via rosetta annotations describing the tables

#

I was gonna add a heuristic to not include fields for tables with > X fields, but I think an option for it should be fine

lusty steppe
#

Still a whole lot of bugs to work out with the type analysis, but here's a cherry-picked example of a file where things all went right:

---@meta

---@class ISLightSourceRadialMenu : ISBaseObject
ISLightSourceRadialMenu = ISBaseObject:derive("ISLightSourceRadialMenu")
ISLightSourceRadialMenu.Type = "ISLightSourceRadialMenu"


---@return boolean
function ISLightSourceRadialMenu.checkKey(key) end

function ISLightSourceRadialMenu.onKeyPressed(key) end

function ISLightSourceRadialMenu.onKeyRepeat(key) end

function ISLightSourceRadialMenu.onKeyReleased(key) end


function ISLightSourceRadialMenu:center() end

---@return any?
function ISLightSourceRadialMenu:getInsertBatteryRecipe(item, containerList) end

---@return any?
function ISLightSourceRadialMenu:getRemoveBatteryRecipe(item, containerList) end

function ISLightSourceRadialMenu:fillMenuForItem(menu, item) end

function ISLightSourceRadialMenu:fillMenu() end

function ISLightSourceRadialMenu:display() end

function ISLightSourceRadialMenu:onEquipLight(item, primary) end

function ISLightSourceRadialMenu:onInsertBattery(item) end

function ISLightSourceRadialMenu:onRemoveBattery(item) end

function ISLightSourceRadialMenu:onToggle(item) end

function ISLightSourceRadialMenu:onLightCandle(item) end

function ISLightSourceRadialMenu:onExtinguishCandle(item) end


---@return ISLightSourceRadialMenu
function ISLightSourceRadialMenu:new(character) end
#

No more misleading ---@return any on functions that don't actually return anything 😄

languid walrus
#

great work!

lusty steppe
#

Just pushed the rewrite to https://github.com/omarkmu/PZLuaStubGen/tree/rewrite-2025. I did most development against b41 but the last hour was spent confirming things look okay for b42. It can at least handle ModOptions & a few of the other new patterns for classes (FishingManager, Bobber, Fish, FishingRod)

#

But I'll have to do a more thorough look to see if there's any other weirdness, beyond the one last nice-to-have I'm already aware of (other than the exclude option, which I also have down to do)

languid walrus
#

awesome! i honestly haven't paid too much attention to the lua side of b42 so i wouldn't be able to review that much

lusty steppe
#

I'll be doing a whole lot of review myself so no worries there—want to make sure everything is working as expected before fully moving over to the new generator

#

Once it's all looking good I'll (hopefully, given that I have enough time and interest) start on the manual Rosetta typings for b42 so the community typings can get off to a good start

lusty steppe
#

@languid walrus To avoid surprises when the next unstable build rolls around: stub generator rewrite seems ready for primetime (has for over a month, really 😅), merging shortly. Letting you know bc the annotate command has been changed to the base command, among other changes summarized in the PR

#

I also recommend using the --no-ambiguity flag until the stub data is ready; changes types analyzed as unions to unknown

#

Separately, regarding events: the TradingUIRemoveItem event's second arg has a different meaning in b42 (index → item id). I'd make the change myself but idk where the unstable data lives

lusty steppe
#

@thick ravine see above (just remembered you're back in this server)

languid walrus
#

fantastic! i'll check it out in a second

languid walrus
lusty steppe
#

Ah, that makes sense—good to know

languid walrus
#

finally got to try it, this is great! much higher quality output than before, this will be really useful

lusty steppe
lusty steppe
#

Fixed

languid walrus
#

got a chance to try it, looks good!

lusty steppe
#

I wanted to figure out all of the potential values of the rules from OnSteamRulesRefreshComplete & for some reason I decided the best way to do this would be trudging through the ZNet .dll

#

I'm sure there was an easier way that wouldn't have given me a headache, but long story short the "rules" are just server properties that were set with SteamGameServer.SetKeyValue—and plenty of calls to that can be found in GameServer

#

The fact that they're properties was unsurprising, of course, but being right there in the decompiled Java was less obvious for some reason 🤦

lusty steppe
#

Soon™️

thick ravine
#

I'm still here. I still read stuff. Been busy lighting fires in the hacking sector of PZ with stronger anti-cheat implementations.

#

About to fall back to the rewrite of Mallet when I'm finished setting up this bonfire.

thick ravine
#

I'd like to somehow eventually write a nodejs module that allows for setup of a mod project with run scripts and the ability to import Lua typings for mod API.

#

A thought that recently came back to me as I write EtherHammerX documentation.

#

I placed this in my types/ folder of the project:

languid walrus
#

i just add the mod itself as a library when i need typings from a mod

thick ravine
#

Would be cool to pull from a workshop item using a steam API and importing typings files.

languid walrus
#

i think it'd be cool but i just honestly don't see much use to it

thick ravine
#

I guess the community isn't there yet.

#

Damn.

lusty steppe
#

The primary (or potentially only) utility I'd see in that sort of thing is documentation for an API—I've had it in the back of my mind to figure out a good way to make that clearer. I'd be more likely to opt for exporting the docs using a LuaDoc-esque tool, though

#

To clarify the distinction: I mean it'd be for the documentation text rather than the typings

thick ravine
#

I named this planned project "CatHouse".

lusty steppe
#

I'll prob just fork an existing doc tool since the main blocker is that they use a different annotation format

#

Interested to see where that goes though

languid walrus
#

yeah that'd been in my backlog too but i'll probably leave it to one of you then

thick ravine
#

I write code that writes code.

#

So it'd naturally fall on my hands lol

#

x)

lusty steppe
#

I will never endorse Lua slander 😤 No matter how many times it disappoints me 😤

thick ravine
#

=D

#

Been around way too many arrogant C programmers.

#

Working on CatHouse would be a great opportunity to modernize JavaDocs-like solutions and make a clean documentation design for mobile.

lusty steppe
#

In the interest of never doing that again making it easier, for future state of the stub generator I'm thinking I'll add functionality to feed the java Rosetta files to it so it has more context for currently unknown calls

#

Which would cut down on manual work a lot, in theory. In any case, review of the above would be appreciated if anyone has the time to give it a look. You can run the generator with that data as pz-lua-stubgen -i <pz directory> -o <output directory> -r <stub data directory> -k --helper-pattern ^umbrella\.

#

One currently known issue is that JoypadData should probably be optional in most of the places it appears

languid walrus
#

oh man, i just pushed the 42.7.0 update 😅

lusty steppe
#

All good, I'd rather this have review first anyhow

languid walrus
#

so stubdata is rosetta data for the lua?

lusty steppe
#

Plus I just realized I didn't push the stubgen update, whoops

#

Yeah, the stub generator has some commands to initialize & update it and I went through the codebase and manually annotated stuff it couldn't figure out automatically

languid walrus
#

oh i see! i was wondering what those commands were for

lusty steppe
#

Unfortunately I think it'll always require manual review due to the untyped nature of Lua, but ultimately I'd like for the manual part to be as minimal as possible

thick ravine
#

It's cool to see Rosetta being used like I wanted.

thick ravine
#

Damnit @lusty steppe Stop reminding me of how fun it would be to write a type-discovery mapper for Lua code.

#

hahaha

#

It's been on my mind like 5 times now.

lusty steppe
#

You could always make stubgen better 👀

thick ravine
#

What do you use? luaparse?

#

I can only think in a blank canvas for something this big but I'd write it out as a utility that could be integrated into PZStubGen. Would that work?

#

I'd write out scope-identity strings like _G.someFunc.forloop_3.x = [number, string]

#

I'd have to write out calls to variables using scope-visibility checks on other identically-named variables and then map all assigned types to a type-array.

#

See? You did this to me.

#

xD

#

I was thinking about how to approach the problem.

lusty steppe
#

Yeah luaparse, then it goes through & checks assignments to do stuff like that

#

Currently assigns locals, functions, and tables to IDs for tracking & then does type resolution based on assignments & usage

#

It just reads top-to-bottom, though, so some resolution that's theoretically possible isn't done

#

The code for all that is in the AnalysisReader and AnalysisContext files which sorely need a refactor

#

(all of that to say it sounds like it already has that, but if you identify gaps or improvements I'd happily accept them)

thick ravine
#

Would you be comfortable if I wrote the solution in isolation and then handed it over?

lusty steppe
#

Sure, I could compare & see how to integrate it

thick ravine
#

I'd like to make it more universal for any Lua 5.1 project with overrides from a source that patches unknown types from PZ.

lusty steppe
#

Makes sense. I have a few PZ assumptions I was gonna tie to an on-by-default flag

#

It should be set up to work somewhat generally but can't make very many assumptions about the environment yet

thick ravine
#

I was working on the React + Next.JS rewrite of Mallet for albion and I to start documenting the Java API however I can also work on this in the meantime.

#

I also just finished the rewrite for a secure, modular and client-side anti-cheat for PZ so I could shoe in this project where that one ends.

languid walrus
#

@lusty steppe caught a weird quirk, target should probably be annotated as any if anything

lusty steppe
#

I think I added a heuristic for that but only applied it to Rosetta—it would def make sense to ignore call signatures for that, thanks

lusty steppe
#

Also I'm gonna add you and @thick ravine as maintainers to that & my other stubs-related stuff if there are no objections to that

#

Last also: plan currently is to wait for b42 to be stable to update & maintain the Rosetta stub data instead of trying to keep it up to date with every unstable patch. I think (/hope) the automatic generation with the default flags will suffice until then

thick ravine
#

It's so cool to see that Rosetta actually helped out

lusty steppe
#

Definitely, once we're in stable I think it'll be good to try to get the community to contribute to the documentation

thick ravine
#

I always wondered that Rosetta was a personal thing and that it didn't help outside of my interests

#

I try to be real about that so thanks for trying Rosetta out and letting me know

#

4real yall are awesome

lusty steppe
#

Right back at you

languid walrus
#

great work!

lusty steppe
#

Apologies for the likely email spam with the 3 repository invites

#

Mostly adding y'all in case I vanish off the face of the Earth (even though you could & prob would fork anyway, but this makes it easier I suppose)

#
  • the bonus of allowing commits if I'm taking too long 😄
languid walrus
#

thanks!

#

i've realised i'm not including your stubdata in my umbrella builds, will have to remind myself to do that

lusty steppe
#

Probably best not to for now given I doubt I'll be updating them on pace with b42 updates lol (not until stable anyway, see #1108874445319307384 message)

#

Although I suppose the rosetta-update command would make that a non-issue, idk I figure oughta have it when it's all good to go

thick ravine
#

Crazy idea: Modify Kahlua to map out types assigned to variables in scopes to a file and use that for Umbrella.

thick ravine
#

@lusty steppe I wonder if this would work.

#

I could look at how Kahlua stores and recalls contexts and then map them based on those calls.

#

If that could be proven to work we could give this patch to players to bake the type maps of Lua code.

#

x)

#

A funny way to solve that problem.

lusty steppe
thick ravine
languid walrus
#

@lusty steppe not sure why, but no type stubs are emitted for these functions:```lua
function CharacterCreationMain.sortByCost(a, b)
if a.item:getCost() == b.item:getCost() then
return not string.sort(a.text, b.text)
end
return a.item:getCost() < b.item:getCost();
end

function CharacterCreationMain.sortByInvertCost(a, b)
if a.item:getCost() == b.item:getCost() then
return not string.sort(a.text, b.text)
end
return a.item:getCost() > b.item:getCost();
end

function CharacterCreationMain.sort(list)
table.sort(list, CharacterCreationMain.sortByCost);
end

function CharacterCreationMain.invertSort(list)
table.sort(list, CharacterCreationMain.sortByInvertCost);
end

lusty steppe
#

Should be fixable by extending the "implied class" logic to unknown globals when encountered as a function identifier member expression base