#mod_development

1 messages ยท Page 103 of 1

sour island
ancient grail
#

I wish someone would make timeaction tools
And serverclient tools
That modders would require to make life easier

red tiger
#

Make it module.

sour island
#

hmm

#

I can inspect a number

chilly ledge
#

Yeah, I tried to spawn bandages on zombies but I can't seem to find a way to listen for zombie spawning events. If I can listen to spawn events then getting to work properly would be easy. In the meantime I'm just using the method that scalyZeds did(Overriding underwear and using it to spawn the bandage/costumes)

red tiger
#

Oh and for anyone interested, If I complete my Lua transpiler project, it'll be analytical.

nova socket
red tiger
#

I'm planning it out in a markdown.

red tiger
sour island
#

It's ok brother

chilly ledge
#

IF anyone knows how to listen to zombie spawn events and run LUA on the spawned zombies (Once only when they spawn, not every time you load that zombie) that would be a massive help >.>

bronze yoke
#

it's not possible

nova socket
#

So sandbox vars can accept any types, even bytes? KEK

bronze yoke
#

not in the way you describe i mean, there literally just isn't a hook or event for it

#

the best you can do is to just indiscriminately grab zombies and test that you haven't already operated on them

ancient grail
#

Actualy if you have a zombie counter then it might do the trick but only limited to your vicinity not the whole world if there are other players

chilly ledge
#

Why doesn't zomboid have a lua hook for OnZombieCreated sad_cowboy

#

Lol

#

Maybe it's for perf reasons to prevent missuse? But idk, I feel like trying to hack your way around it would just be worse perf wise

sour island
#

Zombie's also can't save modData for performance concerns

#

You can still sue their modData for per session stuff tho

quasi geode
nova socket
#

pogs

sour island
#

so you can hook into their OnZombieUpdate - and set a boolean to true for 'onCreate'

ancient grail
#

Ow hi fenris

chilly ledge
quasi geode
#

sure. people use hacks to get around limitations

chilly ledge
#

alternatively for my usecase having a way to specify custom item defines/clothing defines to add to all outfits via script would solve my problem without require a onspawn event

sick umbra
# sour island

How did you open that inspection window? not finding here...

chilly ledge
red tiger
sour island
#

i lol'd

ancient grail
#

Wow

#

Chase meeeee

chilly ledge
#

Is java modding a thing? Or is it mainly constrained to just lua scripting? (sorry for all the questions ๐Ÿ˜… )

red tiger
ancient grail
#

If you are jab then yes

red tiger
#

Been Java modding here since 2014.

sour island
#

inspect tool is on public release atm too - im just updating it to include reference linking

chilly ledge
red tiger
#

Lua modding is safe.

chilly ledge
red tiger
#

Java is gray-zone.

sour island
#

it's on steam

#

I linked it

#

Only accessible in -debug mode

ancient grail
#

Thats github

#

Ow yeah earlier nvm

sour island
#

2 links

ancient grail
#

I guees i should sleep

#

Lol

chilly ledge
ancient grail
red tiger
#

lol

#

I like the ability to mod my Java.

chilly ledge
#

You'd still have it, you'd just sign your mod when you upload it

#

Although I'd imagine that it would probably be too much work for such a niche part of the modding scene

#

Does zomboid even have a mod/patch loader for java?

red tiger
#

I wrote some of my own but no.

quasi geode
#

several lol

red tiger
#

Oh?

chilly ledge
#

Huh

#

It could be neat to have something similar to Forge as a modding API

red tiger
#

I wouldn't know about em.

quasi geode
#

theres multiple java mod loaders

nova socket
#

how exactly do you get who has what permissions via lua?

#

admin, observers etc

red tiger
#

Of course I wouldn't know about other patchers.. I write my own stuff. xD

chilly ledge
bronze yoke
red tiger
quasi geode
red tiger
#

It's a little hit but it runs in a VM.

chilly ledge
#

I should look into java modding for zomboid ๐Ÿ˜› Seems like it could be fun

red tiger
#

Kahlua also uses older invocation / reflection practices which means it runs a little slow.

chilly ledge
#

oof

red tiger
#

Modding in PZ with Kotlin is fun too.

chilly ledge
#

ewww Kotlin ๐Ÿ˜›

nova socket
#

TypeScript just peeks around corner and giggles

chilly ledge
#

Tbh Java is kinda icky too IMO but shrug_cat It's magic lol

chilly ledge
red tiger
#

Yeah you can Typescript mod if you want.

willow estuary
red tiger
#

I made PipeWrench so people can mod in TS.

#

You know that TIS could upgrade Kahlua if it were a priority.

#

I did this for my servers back in the day.

#

Upgraded the under-the-hood code to make it slightly faster.

chilly ledge
#

Convert zomboid to C#

nova socket
#

oh noes not C# please

chilly ledge
#

hehehehe

#

.net 7 is great

quasi geode
#

/me converts it to perl instead

chilly ledge
#

RUST time

nova socket
sick umbra
#

wanted to ask something, I looked at the game files and in the media/scripts folder there were some sounds (attributed to items) that I didn't find in the media/sounds folder, does anyone know where are they?

sour island
chilly ledge
sour island
#

Anyone know how I can get the class name for the userdatas?

#

field:getType() errors

nova socket
#

Sounds script can point to any media from original game too so.

red tiger
#

This game would run insanely faster if:

  1. Medium PRNG is provided alongside high-quality PRNG
  2. The map format & tile coordinate system were to be rewritten in factors of 2 using bitwise calculations from chunk-coordinate to world-coordinate
  3. Less files for the map format.
#

=)

#

Java is good enough to run "The Sims 1". =)

sour island
chilly ledge
#

The game would run faster if it was ECS breakdance

sour island
#

I have no idea what I'm looking at

chilly ledge
#

Multiple threads go vrrrrrrr

red tiger
#

Oh and thanks to a friend's research:
4) If RakNet were to use multi-threading

chilly ledge
#

How many zombies do you want:
ECS: Yes

jaunty marten
#

the game would run faster if just sit in main menu

chilly ledge
#

You can support ABSURD amounts of active agents using ECS

sick umbra
nova socket
chilly ledge
#

Although I'm pretty sure you can't implement the design pattern in java due to object shenanigan's and lack of access to low level memory (For cache optimization shenanigan's ) (L1 Cache go BRRRRRR)

nova socket
#

Same goes for required lua, you can require anything from base game dir lua folder

red tiger
#

require modules pls

#

Pls use Lua modules modders..

#

Please.

chilly ledge
#

lol

red tiger
#

Can't stress it enough.

nova socket
quasi geode
#

I'd set all the base game lua to use actual module format, but i'm not allowed to break things ๐Ÿ˜ฆ

red tiger
#

Haha

#

I get that you guys have a process / plan.

nova socket
#

that would break every mod existing that is bigger than 1 lua function

red tiger
#

I'm also considering straight-up converting your entire Lua codebase to Typescript.

#

It'll be modules then..

quasi geode
red tiger
#

Why can't you use a deprecation or API version?

#

I'd love to see revisions.

#

I know it sounds way easier to implement than it actually is. =(

quasi geode
#

that be nice, but setup work.

#

also, not part of my task list atm (still the newbie on the team)

red tiger
#

90% of my time spent modding PZ is working on this exact issue / category.

sick umbra
#

apparently for me to open the .bank files I need to have FMOD Studio, which is paid, F... though, I think I have no reason for opening them

red tiger
#

Sooo that's why I'm so interested in what'll happen there. xD

#

Thanks for responding to the questions.

#

One more thing before I run away: Mods having a internal form of versioning for files would be epic. Servers could use the same workshop items and specify a version to use.

#

Would solve most of the problems with uploading workshop content and servers.

nova socket
#

Does workshop even have versioning of files?

red tiger
#

No. TIS would need to make the folder-structure support it.

nova socket
#

That means you somehow will have stream older version from server to client

quasi geode
#

Personally I'd like to see mod versioning, but I think to be effective the server would have to transfer mods to the clients, which could be problematic for some larger mod or busy / low bandwidth servers

red tiger
#
mod_root/
   versions/
     a_version/
        media/ ..
     another_version/
        media/ ..
mod.info
..
red tiger
red tiger
#

I have a working case of this as a template.

nova socket
#

zstd can compress non-blobs up to 90%

quasi geode
#

code isnt the issue, text is relatively low bandwidth. I'm thinking more models & textures

nova socket
#

oh, well yeah.

red tiger
quasi geode
#

where youve got mods that are 1gb+ in size, or 15 different vehicle mods installed etc

red tiger
#

lookup:

  1. Specific version folder
  2. Shared folder
  3. PZ media install folder
nova socket
#

You could split it into parts and apply patches depending on what was changed.

#

but thats a bit complicated.

red tiger
#

My suggestion may not be the optimal one however I feel like it could serve as a vehicle for an eventual solution to mod version controls.

quasi geode
#

keeping previous versions in the mod folder only really solves half the issue though (mainly, duplicate conflicting workshop items, reuploads etc), where transfering directly from the server would fix.

red tiger
#

Glad I can pass those long-time thoughts to someone at TIS.

red tiger
nova socket
#

Man I was surprised to have direct answers on topics from devs

quasi geode
#

but ya lots to consider with it though. i've put some thought into it but its really not my area

nova socket
#

You don't see that every day now

drifting ore
#

yea 10/10 here

quasi geode
#

ah well...i'm a new dev for TIS, and been a modder for years, so this channel still kinda my home ๐Ÿ˜…

weak sierra
#

very much hope you take some of the energy about certain problems here over to there

red tiger
weak sierra
#

also walkie talkie voip been broken since november pls help

nova socket
#

I'll actually try compressing some mods with zstd and see how it goes

quasi geode
weak sierra
#

i reported it two patches before they closed that..

#

they spent that time telling me it wasn't a problem :(

#

but yeah..

#

just wish it had a setting like the other anti-cheat stuff.

red tiger
#

If the patch is simple I'll try to make one in the meantime.

weak sierra
#

yeah that's the one thing im 100% willin to javamod for lol

#

absolutely leap at it

red tiger
#

Already reverse-engineered and deobfuscated var names for some parts of Radio code to investigate that.

weak sierra
#

it's so important to my users

#

they'll sing your name like an ancient hero

#

<_<

red tiger
#

Lol

#

It's definitely tied to user permissions from the symptoms so that removes a lot of possibilities as to what actually breaks it.

weak sierra
#

yeah

#

im kinda surprised the thing you did do didn't fix it tbh

red tiger
#

Just needs more looking into.

#

Maybe the player simply needs all player's data sent to their client on login.

weak sierra
#

could compare a decompile of an old build to the current

#

and just like..

#

copypasta

#

<_<

red tiger
#

Funny you say that.

#

I do have older builds on my storage.

weak sierra
#

hunting it down should be easier if u poke at that

#

i kinda wish i didnt update my decompile lol

red tiger
#

Yeah. Just don't want to put too much time into the patch when I have active projects.

weak sierra
#

i wish i had money to give or something, i do not :P

red tiger
weak sierra
#

overwhelms me a bit

#

heh

#

i have lists upon lists upon lists

#

but im tryna raise a 3yo

#

so

red tiger
#

Constantly tearing apart this game for fun.

weak sierra
#

anyway it's time for me to write the sandbox fix finally, have time tonight to actually code it

red tiger
#

I'm mapping out a new Lua transpiler ATM for future work.

#

Nice.

#

Going to try to interpret Lua code as ES5 JavaScript and transpile it to TypeScript.

#

It'll need to resolve var assignments from a collection of Lua code so I can see what types are inferred.

#
#

This is going to be fun.

#

If anyone in here likes to plan out their projects, I'd recommend getting PlantUML installed on your VSCode install.

#

The link above also works as a website portal for PlantUML.

weak sierra
#

the plan

#

lol

#

i do more extensive notes for big projects but always just notepad-esque stuff.

#

i am an agent of chaos

red tiger
#

PlantUML helps visualize your plans.

#

Also that UI lol

weak sierra
#

linux w/ CDE theme, win9x style taskbar/etc..

#

xD

young edge
weak sierra
#

party like it's 1999

young edge
weak sierra
#

lol

#

i go back and forth between modern and retro when i get nostalgic

#

haha

young edge
weak sierra
#

whatever works for someone to keep organized tho eh

#

bunch of windows open isn't killin me so whatev

young edge
#

suuuuure KEK

weak sierra
#

idk i've released like 30 mods

#

๐Ÿคทโ€โ™€๏ธ

red tiger
#

For me it's like 100 projects = 5 releases

weak sierra
#

yours are on average of greater scope than mine, to be fair

#

but yeah i try to finish what i do

#

used to not

red tiger
#

Nah. It's simply a failure to plan / organize.

#

(me)

#

If I had the time I did like last year, I'd be working on 3 concurrent projects. =)

weak sierra
#

if i start more than one, one of them will sit on hold lol

red tiger
#

I go back and forth to keep things from getting stale.

#

If I get stuck on one I can always flop over to another project.

#

I avoid burnouts this way.

weak sierra
#

yeah with how big your projects seem to be that makes sense

#

mine are usually within "i can grind through this in a week or two" (if i have the time, anyway) territory

#

wrote most of the sandbox sync stuff, tired tho, i think i'll finish tomorrow

#

will play game for the rest of tonight nodnod

red tiger
#

=)

#

Hope my big projects helps make your projects smaller in time invested in figuring things out.

#

That's when I know that not only is my time worth it, but that it is successful.

drifting ore
#

is getLuaTest what i'd use to set a certain script parameter via a lua script?

#

for recipe specifically

#

trying to use sandboxvar int for item amount for recipe then i can wrap this up and release a good update for lightswitch electrician

vast nacelle
#

How do I get the parent object of a backpack's ItemContainer (inventory)?
I want to access the modData of whatever object is currently holding an item.
If its a world object, like a cabinet or something, I can do

local objectThatHasTheContainer = containerHoldingTheItem:getParent()
local modData = objectThatHasTheContainer:getModData()```
However, when that item is in a backpack, `getParent()` just returns nil.
Answer: Apparently `getContainingItem()` is used to get the backpack object from the backpack inventory....
Why doesn't getParent() handle both cases?
tawdry moss
#

zombies i spawn using addZombiesInOutfit() despawn almost instantly and dont chase the player. Debug log says "removing stale zombie". How do I fix this?

vast nacelle
tawdry moss
#

the file is loaded on server though

#

should it be shared?

vast nacelle
#

The Client will load files in both the Client and Server folder.
Under what circumstances are you calling addZombiesInOutfit()?
Are you "protecting" it from be called by Clients?
e.g.

--- code to spawn zombies
end```
dark wedge
#

oh, i'm behind. ha.

vast nacelle
#

Nah. I added the edit like a millisecond after you posted

tawdry moss
vast nacelle
tawdry moss
#

damn

vast nacelle
#

So you need to add something to prevent Clients from calling code they shouldn't even if its in the Server folder.

tawdry moss
#

this specific code is set to run when the player says a certain phrase in chat, and sometimes it spawns them properly and sometimes it doesn't. I'm just confused as to why.

vast nacelle
#

Because the Server will normally "reject" zombies added by a Client.
You'll need to learn how to do Server-Client Communication.
A player says something > Their client sends a command to the server
Server receives the command > Server spawns the zombies

https://steamcommunity.com/sharedfiles/filedetails/?id=2735092774&searchtext=server

Hey there! In this guide, I'll explain the client-server concepts and how they work in Project Zomboid. This guide is mainly aimed to modders who want to update their creations so that they work corre

tawdry moss
#

reading through this, and the example lines dont make much sense to me. sendClientCommand(string, string, KahluaTable) --> The event is triggered by the player source. This doesn't tell me what it wants for the strings or the table, just that it wants them. Do i put the function names? triggers?

vast nacelle
#

The intended use is
1st String - A module name (like your mod's name or something)
2nd String - A command name (the specific thing you want to occur)
KahluaTable - The arguments/data you want to pass to the server. Can be nil

So on the other side, you'd first use the Module string to check if the incoming ClientCommand is for you and then use the Command plus Arguments to call the specific function you want.

sour island
tawdry moss
vast nacelle
#

Yes. You need to create a function that listens for the command and puts it together and calls it correctly.

bronze yoke
#

that's how people use them, literally speaking they are just two strings that get passed from end to end

sour island
#

alrighty, I'm beat

#

gn all

tawdry moss
#

Imma sleep and try again when I get home from school

viral spire
#

I've convinced myself we're never getting a TLOU overhaul mod for a very, very long time.

jaunty marten
#

decided to continue work on water pipes mod that I dropped a few month ago and found this. mb in that time I didn't know premade func for it so my question is in pz really no shortcut for this shit ๐Ÿฅด ? wtf.. tried to find smth on wiki or in source but nothing

red tiger
#

Working on breaking down code blocks now...

red tiger
#

Going to pause here for tonight.

ancient grail
stable flame
#

any clue why this doesn't actually calculate the weight properly? All i'm getting is one piece of scrap, although the input item has a weight of 3

--variable scrap amount
function Recipe.OnCreate.RecycleToScrapMetal(items, result, player)
    local scrapQuantity = 0

    for _, item in ipairs(items) do
        scrapQuantity = scrapQuantity + (item:getRealWeight() * 2)
    end

    player:getInventory():AddItem("Base.ScrapMetal", scrapQuantity)
end
red tiger
#

@stable flame

#

You can syntax highlight posted code.

#

Wait, are you confusing item weight with quantity?

#

Thinking that real weight is how heavy the item is and that AddItem's 2nd param might be an integer quantity.

#

Just a hunch.

stable flame
#

aka its weight in scrap

red tiger
#
public boolean AddItem(String type, float useDelta)
jaunty marten
#

:getRealWeight at least exists? I can't even find it in pz source lul

bronze yoke
#

there's a separate method for adding multiple items at once

red tiger
stable flame
#

remember reading that getWeight() was deprecated and to use getRealWeight

pulsar heath
#

dont you guys sleep?

#

i wake up at 7am and you guys are still going strong ๐Ÿ˜„

jaunty marten
#

๐Ÿฅด

pulsar heath
#

and i've finally solved my problem in mp

local ZedList = player:getCell():getZombieList()
for i=0, ZedList:size()-1 do
        local zombie = ZedList:get(i);
         print(zombie:
getOnlineID())
   local x,y,z = player:getX(), player:getY() , player:getZ();
    zombie:pathToLocationF(x, y ,z)
   end```
stable flame
pulsar heath
#

now just need to add a Custom tag when spawning the zombies and only call those

red tiger
#

(Read up)

pulsar heath
#

oh fenris was around ๐Ÿ˜„

jaunty marten
pulsar heath
#

@red tiger youre nuts... all that work... jesus

red tiger
#

Planning phase for a new Lua transpiler.

pulsar heath
#

well as long as it was productive, its a good thing ๐Ÿ™‚

red tiger
#

I have a basic transpiler right now.. but I don't like it. It only exports definitions of arbitrary types.

#

The goal of this one is to be analytical and resolve types by combing code.

bronze yoke
#

this deprecation notice is on ItemContainer, not InventoryItem?

pulsar heath
#

hmmm i hiave a big problem... when i solve the problem i lose interest in finishing the simple parts of the solution...

#

need to create a table with the zombies spawned

#

and call those zombies only...

#

ill just grab the id and use that

#

easy enough i guess

#

hmmm i wonder
setWalkType(String string)

red tiger
#

Imagine graphing a relationship tree of Lua classes for ISUI..

#

Hahaha

pulsar heath
#

if i can make a zombie a runner in code

red tiger
#

Oh God I really need to stop asking questions..

pulsar heath
#

ISUI... i hate it so much

red tiger
#

ISUI is big enough to need guardrails and type safety.

pulsar heath
#

tbh everything exposed to modding should have guardrails and type safety

red tiger
#

D:

#

Is that supporting my thought of migrating Lua to Typescript?

pulsar heath
#

50/50 ๐Ÿ˜„

red tiger
#

Good enough.

#

I'll let you decide on how to round that value.

pulsar heath
#

well i made a zombie run and my game just froze ๐Ÿ˜„

#

ill think about it later... breakfast time

stable flame
#

managed to crash the game now ๐Ÿ˜„

function Recipe.OnCreate.RecycleToScrapMetal(items, result, player)
    local scrapQuantity = 0
    for _, item in pairs(items) do
        scrapQuantity = scrapQuantity + math.floor(item:getWeight() * 2)
    end
    player:getInventory():AddItem("Base.Scrap Metal", scrapQuantity)
end
#

it doesn't like the math

pulsar heath
#

player:getInventory():AddItem("Base.Scrap Metal", scrapQuantity)

#

a white space in the item name?

stable flame
#

opps, missed it

pulsar heath
#

good to see im not the only one failing due to typos

#

๐Ÿ˜„

red tiger
#

Starting to feel tired.

pulsar heath
#

go rest

red tiger
#

Doing IRL work work ATM.

pulsar heath
#

ill only have to worry about IRL work next month

red tiger
#

lucky.

#

I'd steal your free time if I could.

pulsar heath
#

yeah... until the point that its 7 days a week with no days off till november ๐Ÿ˜„

red tiger
#

Sleeping is unproductive.

#

Body needs it yeah.. I don't want it.

pulsar heath
#

sometimes its not the body but the brain that needs it more...

#

was stuck b4 sleep... i wake up and have the solution in my head

#

so i can say at least this time sleeping was productive ๐Ÿ˜„

red tiger
#

I can be a code zombie.

#

I use that time to do grunt work.

pulsar heath
#

still, not good for your health

red tiger
#

Not wrong.

pulsar heath
#

but i know how it is...

red tiger
#

Oh well

pulsar heath
#

i suffer from the same problem

#

even if i try to sleep and i have something thats bothering me that i want to find a solution

#

it will be more trying to sleep and coding in my head

#

than actually sleeping... so yeah... zombie mode and code away

red tiger
#

Ever dreamed in code?

pulsar heath
#

sometimes yeah

red tiger
#

Ever remember it? Write it down?

pulsar heath
#

when i was making my twitch api lib... that happened a lot

#

usually i wake up and just grab the laptop sitting next to me ๐Ÿ˜„

red tiger
#

I've solved problems in my sleep. Fucking crazy stuff.

pulsar heath
#

and type it away

stable flame
#

Best ideas come when not actively thinking about them, aka while trying to sleep or on the can

red tiger
#

There's thinking about the problem and there's actually following through with logic and literally coding it out in your sleep.

#

The latter one is terrifying.

pulsar heath
#

toilet time is spent solving another problems... ๐Ÿ˜„

#

like actually thinking about my real work

#

and i have to get things ready... only 1 month to go and i've done nothing to setup the new work season

red tiger
#

=/

stable flame
#

ugh a simple idea turning into a full hour of trial and error ๐Ÿงจ , such is the modding life

drifting ore
#

lol

#

took me 3 days of messing around to figure out these damn light switches

#

then again i dont know shiat

#

speaking of which. what am i doing wrong here?

            local context = ISWorldObjectContextMenu.createMenu(player, worldobjects, x, y)
            context:setVisible(false)
#

it's working but it's throwing an error also

#

java.lang.RuntimeException: __add not defined for operands in get

#

im trying to just remove any context menu from when you are using the lightswitch

#

the error hits on the top line

crystal pollen
#

Does anyone know how to get items to spawn on top of beds? I didn't see it in the distribution or ProceduralDistributions lua files. I noticed some mods before do it without having to edit the map itself.

vast nacelle
stable flame
#

Had no idea that was a thing ๐Ÿ˜

#

thought the quantity after is applied if specified

#

thank you for the tips

drifting ore
#

actually you right

#

i guess wth... do i just not use it?

#

lol confusing for me

jaunty marten
stable flame
#

wondering if i should replace for _, item in ipairs(items) with something like item:getType() and specify a list

vast nacelle
drifting ore
# jaunty marten why x is a table xp

can i just use something like ISWorldObjectContextMenu.removeToolTip() joke lol it's easy to add or replace but i can not figure out how to remove

drifting ore
#

remove right click context from only on that sprite lol

#

so nothing happens when you right click it

jaunty marten
#

why r u trying to create new one

drifting ore
#

i tried all different ways lol i couldnt find a good enough example to figure it out

#

derp brain i guess

jaunty marten
#

crude example but I think u'll get the idea

local function a(context)
  context:setVisible(false)
end
onfillworldcontextmenu.add(a)
dark wedge
#

Blech. Is there a consistent way to do damage to everything? Seems different objects have different functions to take damage, which seems wrong (if true, that's annoying). IsoObject and IsoMovingObject both have Hit, but this seems to be just part of the class definition and does nothing; only some objects define this (like IsoZombie). Other stuff like IsoObjects have just Damage(float) that I can call, and vehicles has hitVehicle(character, weapon)
Everything has the WeaponHit(weapon, character) function, but this only does the overwhelmingly helpful java code of:

}```
drifting ore
#

im using that. i have no idea what the parent menu is though.

jaunty marten
#

try this one

local function onFillWorldObjectContextMenu(player, context, worldobjects)
  context:setVisible(false)
end
Events.OnFillWorldObjectContextMenu.Add(onFillWorldObjectContextMenu)
drifting ore
#

here is what i'm using atm so it's not so hard to understand my usage

#
local spriteList = {"lighting_indoor_01_0", "lighting_indoor_01_1", "lighting_indoor_01_2", "lighting_indoor_01_3", "lighting_indoor_01_4", "lighting_indoor_01_5", "lighting_indoor_01_6", "lighting_indoor_01_7"}
local getSprite = getSprite
local ISWorldObjectContextMenu = ISWorldObjectContextMenu
local function hideBulb(player, worldobjects)
    for i, spriteName in ipairs(spriteList) do
        local sprite = getSprite(spriteName)
        local prop = sprite:getProperties()
        if not sprite then return end
        if prop:Val("CustomName") == "Switch" then
            local context = ISWorldObjectContextMenu.removetoolTip(player, worldobjects)
            context:setVisible(false)
        end
    end
end
Events.OnFillWorldObjectContextMenu.Add(hideBulb)
#

also i'm sorry for burying your post @dark wedge ๐Ÿ˜ฆ

jaunty marten
#
local spriteList = {"lighting_indoor_01_0", "lighting_indoor_01_1", "lighting_indoor_01_2", "lighting_indoor_01_3", "lighting_indoor_01_4", "lighting_indoor_01_5", "lighting_indoor_01_6", "lighting_indoor_01_7"}
local getSprite = getSprite
local ISWorldObjectContextMenu = ISWorldObjectContextMenu
local function hideBulb(player, context, worldobjects)
    for i, spriteName in ipairs(spriteList) do
        local sprite = getSprite(spriteName)
        local prop = sprite:getProperties()
        if not sprite then return end
        if prop:Val("CustomName") == "Switch" then
            context:setVisible(false)
        end
    end
end
Events.OnFillWorldObjectContextMenu.Add(hideBulb)
#

u missed context arg

drifting ore
#

thats it?

#

i was defining it on the line above so it didn't matter, but thats it?

jaunty marten
#
hideBulb(player, worldobjects) -- ur code
hideBulb(player, context, worldobjects) -- should be this
drifting ore
#

i think i did that and no luck ill try again

jaunty marten
#

u need to hide context menu fully, right?

drifting ore
#

yes

#

i dont even need the other args then right?

#

not called anywhere

jaunty marten
drifting ore
#

player and worldobjects

dark wedge
jaunty marten
#

if u don't use them then nope

#

but code still looks strange xp

drifting ore
#

lol

#

so far that seems to be my thing ๐Ÿ˜„

jaunty marten
#

idk how it should work

#

cos u always get hided context menu

#

u didn't use worldobjects arg

drifting ore
#

yea or player. i only did when i was defining context earlier

#

since we removed. no use

#

ngl sometimes i just dont even get this lol

#

i normally learn best this way but i'm struggling lol and thank you also

#
local spriteList = {"lighting_indoor_01_0", "lighting_indoor_01_1", "lighting_indoor_01_2", "lighting_indoor_01_3", "lighting_indoor_01_4", "lighting_indoor_01_5", "lighting_indoor_01_6", "lighting_indoor_01_7"}
local getSprite = getSprite
local function hideBulb(context)
    for i, spriteName in ipairs(spriteList) do
        local sprite = getSprite(spriteName)
        local prop = sprite:getProperties()
        if not sprite then return end
        if prop:Val("CustomName") == "Switch" then
            context:setVisible(false)
        end
    end
end
Events.OnFillWorldObjectContextMenu.Add(hideBulb)

`function: hideBulb -- file: testcontext.lua line # 9 | MOD: Lightswitch Electrician
Callframe at: se.krka.kahlua.integration.expose.MultiLuaJavaInvoker@d41fe7be
java.lang.RuntimeException: Object tried to call nil in hideBulb

#

i'm def not doing this right it feels

#

i have to be close

jaunty marten
#

don't remove player arg

drifting ore
#

even if it's not used?

jaunty marten
#

now context arg is a player

drifting ore
#

oh

#

i see so you can call it to be nil?

#

or it just always is 0

#

is the first always player?

jaunty marten
#

yea

drifting ore
#

ah

#

okay i got it

#

no error but no work

#

gonna try a couple things here now

#

i think i am good for now lol thank you again.

dark wedge
pulsar heath
#

๐Ÿ˜„

#

well scrap one more solution

#

time for try number 73 ๐Ÿ˜„

pulsar heath
#

well this kinda works

#
                local ZedList = player:getCell():getZombieList()
local x,y,z = player:getX(), player:getY() , player:getZ();

local zedcount = 0
for i=0, ZedList:size()-1 do
    local zombie = ZedList:get(i);
if zombie then
zedcount = zedcount +1
if zedcount < 10 then
   zombie:pathToLocationF(x, y ,z);
end
end
end
player:Say(tostring(zedcount))```
#

nop...

ancient grail
#

guys can someone help me with this one pls

if getActivatedMods():contains("FunctionalChainsaw") then 
require "Ftool_Actions"
end

if im making another mod thats named FunctionalChainsaw2
then woulding this get activated thing detect itself??

vast nacelle
#

It should not return true because of "FunctionalChainsaw2".
contains should only be looking for exact matches, not partial matches.

ancient grail
#

Nice thank you.
I really thought it was a partial thing

#

Thnx

#

Im really confused right now like how do i create another version and prevent them from conflicting

jaunty marten
#

FunctionalChainsaw2? thinkW

ancient grail
#

One of my problem is the way i structure the first one

ancient grail
#

@tacit plover and i are almost done

jaunty marten
pulsar heath
#

finally... some results

#
local ZedList = player:getCell():getZombieList()
local TWESpawnedZeds = 4
local zedcount = 0
local totalzeds = ZedList:size()-1
player:Say("Total zeds: " .. tostring(totalzeds))
for i=0, ZedList:size()-1 do
 local zombie = ZedList:get(i);
if zombie then
zedcount = zedcount +1
if zedcount < TWESpawnedZeds then
player:Say("Sending zed: " .. tostring(zedcount))
zombie:pathToLocationF(player:getX(),player:getY() ,0);
end
end
end```
ancient grail
#

Not really new feature
Ammm the thing im trying is that if the first version is installed then overwrite it

jaunty marten
pulsar heath
#

because im lazy

#

and on the 0 z with the char

#

๐Ÿ˜„

ancient grail
#

But then i realized my functions for the first one has 1k gas this one has 600

jaunty marten
#

xp

ancient grail
#

Whatver ill nake the github for now public

pulsar heath
#

well its working, if the value is set to 4 it will send 3 because of the for

#

the if i mean

#

while is <

#

missing a =

#

or just move the increment to be done after sending the zombie

#

either way works i guess

ancient grail
#

@jaunty marten

pulsar heath
ancient grail
pulsar heath
#

not to apply this to the mod

#

without breaking the mod or the game ๐Ÿ˜„

ancient grail
#

Is that from chucks code

pulsar heath
#

what?

ancient grail
#

The say ah nvm so its not. Hehe cuz its similar

pulsar heath
#

im still a traitor since im using AUD and not chuck's tool ๐Ÿ˜„

#

but you remember why right?

#

i wonder if he already fixed it

ancient grail
#

Ithought its using this one

pulsar heath
#

and done

    local ZedList = player:getCell():getZombieList()
    local zedcount = 0
    local totalzeds = ZedList:size()-1
        for i=0, ZedList:size()-1 do
            local zombie = ZedList:get(i);
                if zombie then
                    zedcount = zedcount +1
                    if zedcount <=  zedQ then
                        zombie:pathToLocationF(player:getX(),player:getY() ,0);
                    end
                end
        end
end
#

oops

#

not done

ancient grail
pulsar heath
#

need to fix the lazy part

#

z is 0

#

and also

#

replace the getplayer with vars...

#

so only one call is made to the instance

#

b4 someone kicks my ass for bad coding habits ๐Ÿ˜„

ancient grail
pulsar heath
#
    local ZedList = player:getCell():getZombieList()
    local zedcount = 0
           for i=0, ZedList:size()-1 do
            local zombie = ZedList:get(i);
                if zombie then
                    zedcount = zedcount +1
                    if zedcount <=  zedQ then
                        zombie:pathToLocationF(x,y,z);
                    end
                end
        end
end```
#

is this good enough or can i improve it sill?

#
    local sourceId = source:getOnlineID();
    local x = source:getX()
    local y = source:getY()
    local z = source:getZ()
    print("Zedspawn [".. sourceId .."] quant: ", ZedQ)
    print("Zedspawn [".. sourceId .."] XY: ", args.ZedX,args.ZedY)
    print("Zedspawn [".. sourceId .."] PlayerXY: ", source:getX(),source:getY())
    createHordeFromTo(args.ZedX, args.ZedY, x, y, args.ZedQ)
    ZedsToPlayer(source,args.ZedQ,x,y,z)
end
#

done i hope

#

now the car alarms ....

jaunty marten
#

hmmm, trying to do my mod better and have question is there any way to merge two textures in single one in kahlua? I need to set a few sprites on object and currently uses just :SetSprite and :SetOverlaySprite so I have only 2 slots for textures, it's fine for now but I'll need more in future. I can't merge them manually cos it's 16 * 2 * 2 = 64 extra textures and that's not final count => it's too shitty way. I'm sure for 99% pz can't provide feature to merge textures but... maybe? unhappy

pulsar heath
#

i remember chuck had a trick for the alpha that could possible be of use to you for what you want to do

#

something about the overlay of 2 textures and mixing cant quite remember

jaunty marten
ancient grail
#

will this work?

Events.OnPlayerUpdate.Add(function(player)
    if player:isAiming()
        player:nullifyAiming() 
        getCore():setOptionAimOutline(false)
    end
end) 
pulsar heath
#

removing the aim outline?

#

or stoping him from aiming?!

#

i saw something similar in britas or arsenal

#

i think

ancient grail
#

Removing the outline
Idk what nullifyaiming is
Maybe its the red version of the aim

#

But idont care abt that i care more abt the aimoutline
Also how do i remove that option from the settings

ancient grail
ancient grail
#

You want them to look merge but you can always out stuff on top if each other

#

Basically having infinite layers

jaunty marten
pulsar heath
dull obsidian
#

hello. was making a car mod and keep running into code related issues, basically what i've done here is added a bodywork part that does not exist in vanilla (front bumper) and wanted to make it detachable. First of all, part does not appear when i spawn the car, second, it does exist in the mech. overlay, third, when i'm trying to install it it gives me this issue (getDisplayName() of non table). Also when clicking on "install" local it also gives me two errors (getDisplayName() of non table and getType of non table). Screenshots attached.

#

I suspect that the game does not consider this as a part, but clueless on how to fix it

#

This issue bugs me for a couple of days now and i will be very grateful if someone gives me a clue on how to fix this

ancient grail
#

Show your code

dull obsidian
#

No problem, but which code exactly?

ancient grail
#

How you spawned the car

dull obsidian
#

spawned using a debug menue

ancient grail
#

Ow so youre not developing a mod?

dull obsidian
#

by that you mean?

ancient grail
pulsar heath
#

youll need to overwrite the code of the car for that to work

#

and add the part location

dull obsidian
pulsar heath
#

dunno if you can do that with scripting or if youll actually need to code it in lua

ancient grail
#

This is the comms for modders who authors mod.
Idk how to help you if its not mod related tbh even if i wanted too. But i think the debug menu isnt really spawning the vehicle its just client sided
Then heres the part i will attempt to make change your code but since you arent writting any
.im lost as to what to do

#

Nit being rude or anything just pointing you the right direction thats all

dull obsidian
pulsar heath
#

dont suspect it is the reason

#

you cant just add parts to the car

#

youll need to alter the code to accept the new part

#

in theory youll have to overwrite the default code for the car

#

and add in the bits and pieces youll need to add a bumper

dull obsidian
#

in theory yes, but making it work is a whole other problem

pulsar heath
#

you should check the modding guide

#

i think theres something there about modeling

#

a sec ill check

ancient grail
#

Show the code

dull obsidian
#

there are vehicle mods that utilise custom parts such as armor and they do have additional lua code

ancient grail
#

Ownroght its just script nvm sorry

pulsar heath
#

yeah thats the reason why they have it

#

since the base car has no way to atach the new parts

#

they rewrote the code to allow it

ancient grail
#

Amm debug doesnt work wait let me give you a piece of code that will actually spawn

#

=-y

pulsar heath
#

i think a good mod for you to have a look inside would be the workshop

#

i bet you can get a pretty good idea of what you have to do from the code they use

ancient grail
#
plocal spawnV = "Base.Car2"
local command = "/addvehicle ".. spawnV .. ' '.. tostring(getPlayer():getUsername()) 
SendCommandToServer(command)
#
    function randV()
        local scripts = getScriptManager():getAllVehicleScripts()        
        local allV = scripts:size()+1    
        local randV = ZombRand(1, allV)
        local randM = scripts:get(randV):getModule():getName()
        local randN = scripts:get(randV):getName()
        local spawnV = randM..'.'..randN    
        local command = "/addvehicle ".. spawnV .. ' '.. tostring(getPlayer():getUsername())         
        SendCommandToServer(command)
    end

randV()
pulsar heath
#

anyway i think youll have better luck asking the #modeling chat

ancient grail
#

im really lost and confused idont understand the problem or youdont understand whats going on...
first you said non table
and mentioned vehicle parts...
its non exsitent which is why the part never exist cuz the car doesnt exist

#

try to spawn a regular thing then try again

#

also what did you do to get the error

#

you should have a code or script or a mod you are working on right

#

anything will help pinpoint the problem and we can provide solution if we know the answer

dull obsidian
dull obsidian
#

the car itself does exist (dont mind the mask), was spaund through the debug menue

#

the basic are put together as a set of scripts

#

this part is pretty much based on vanilla

#

then cars have the lua folder, where mainly their distribution zones, mechanics overlay and translation names are defined

#

but now it seems that for custom parts this is not enough

dull obsidian
jaunty marten
dull obsidian
ancient grail
#

Im not particularly experienced with car modding
You should probably wait for others to help u...i thought issue was spawnning vehicle

dull obsidian
dull obsidian
ancient grail
#

What m3ss is telling you to with them is to actually use it as reference

dull obsidian
#

I know, thats how i learned the basics aswell, hopefully it will help

sour island
#

try to automated the process the best you can

#

especially if you're trying to add on more than just 1 texture - and if I understand you're trying to add 64 textures??

#

The trick mentioned that I use is in photoshop and it's for nicer looking recolors

#

I manually separate the elements and just change each one to a different combo of colors - for anyone curious

#

There's probably a way to automate what you're doing - but it should be done once

#

outside of PZ if possible - that'd be my advice

jaunty marten
# sour island

yea, manually made fine for this but I need it for other way

sour island
#

What are you trying to merge exactly?

#

I know recoloring textures makes them look bad and overlays are a better way to keep consistency

jaunty marten
#

basically I need to merge pieces of these images

sour island
jaunty marten
#

sec

ancient grail
jaunty marten
#

as I said it's too much to merge all of it by photoshop

ancient grail
#

i created a photoshop acttion forre sizing to icon sizess

#

you just have to select the thing then press the action

#

since chuck mentioned automate

jaunty marten
#

each water pipe type (WaterPipe_*) can have one of 3 green dot types

#

rn it's fine cos I'm using setSprite for water pipe and setOverlaySprite for dots

#

but it's shit cos idk what to do if I'll need 3rd slot for some image

pulsar heath
#

plumbing mod?

jaunty marten
#

and I want to find some way to merge 2 sprites in single

jaunty marten
pulsar heath
#

or irrigation mod?

#

nice

jaunty marten
#

all of these

fast galleon
#

add another obj?

ancient grail
ancient grail
#

probably not an option for him

jaunty marten
#

like and current state with :setOverlaySprite

jaunty marten
#

16 * (2 ^ 3)

ancient grail
#

ye if you cant find a way to then thats just one option

jaunty marten
#

seems now I remember why I dropped this mod..

ancient grail
#

cant you

setOverlaySprite = {"a","b","c"}
pulsar heath
#

never messed around with that kind of mod

fast galleon
#

crutch?

jaunty marten
jaunty marten
#

already changed source

#

and setSprite and setOverlaySprite

ancient grail
# jaunty marten (shitty way)

we do lots of shitty stuff anyways .. besides youre building an irrigation mod so time to get your hands dirty ๐Ÿ’ฉ

fast galleon
#

I mean that's what vanilla does and mapping, they put more objects to combine them where necessary.

pulsar heath
#

whats the easiest way to get a cell from xy?

sour island
#

oh yeah

#

I guess you could attach Sprites to the isoObjects

jaunty marten
#

huh?

fast galleon
sour island
#

if the pipes are isoObjects you can attach IsoSprites to it

fast galleon
#

Like the floor erosion, sounds good idea.

jaunty marten
sour island
#

merging images in game is very costly tho

jaunty marten
#

if do it each frame xp

sour island
#

even adding IsoSprites on top of an IsoObject is somewhat a costly approach

jaunty marten
#

it should merge 2 textures in single one and it will be basic texture so it's -0% to performance

#

if there's any way

sour island
#

Yes, but if that becomes a norm you'd get longer bootup times

#

cause your game is merging textures

#

you should be able to add sprites onto isoObject though

jaunty marten
#

it have to just override bytecode of texture by bytecode of another one, not so hard thing

fast galleon
#

That's a good idea, gonna test this and make the Battery Bank an IsoGenerator with attached sprites, new incompatible version incoming ๐Ÿ™‚

jaunty marten
#

maybe there's way to get bytecode of texture and set it so I can override one manually..

sour island
#

Are you trying to add these to an item icon?

jaunty marten
#

just found IsoSpriteGrid, idk what is that but seems it not for me

sour island
#

like in inventory? I assumed based on the art it was on the grid

jaunty marten
sour island
#

Yes, I have an old commission I can send you stuff from

#

I made biomes in PZ

jaunty marten
#

yea, please

#

btw java have getting bytes function

sour island
#
local function applySpriteToObject(sprite, isoObject)

    if not isoObject:getAttachedAnimSprite() then
        isoObject:setAttachedAnimSprite(ArrayList.new(4))
    end

    ---@type IsoSprite
    local isoSprite = getSprite(sprite)
    isoSprite:setName(sprite)

    ---@type IsoSpriteInstance
    local isoSpriteInstance = IsoSpriteInstance.get(isoSprite)

    ---@type ArrayList
    local isoObjectAttachedAnimSprite = isoObject:getAttachedAnimSprite()
    if isoObjectAttachedAnimSprite then
        isoObjectAttachedAnimSprite:add(isoSpriteInstance)
        return isoSpriteInstance
    end
end
#

sprite is a string of the texture

jaunty marten
#

so by this code u can free applied a few textures to object, right?

sour island
#

you'll have to make these into sprites like for mapping

#

I've added 3-4 sprites over every tile for the load tests

#

it lagged when teleporting and stuttered a bit when walking

#

but that was every single tile on every z

jaunty marten
#

cool, thanks moon_kittylove

sour island
#
  • the logic for biomes
#

so you should be fine adding more than a few on just pipes

jaunty marten
#

now I have sense to complete this mod

pulsar heath
#
    local sourceId = source:getOnlineID();
    local x = source:getX()
    local y = source:getY()
    local z = source:getZ()
    local ZedList = player:getCell():getZombieList()

    if ZedList then
    zombie = ZedList:get(0)
    if zombie then
    x = zombie:getX()
    y = zombie.getY()
    z = zombie.getZ()
    end
    end
    print("Zedspawn [".. sourceId .."] quant: ", ZedQ)
    print("Zedspawn [".. sourceId .."] XY: ", args.ZedX,args.ZedY)
    print("Zedspawn [".. sourceId .."] PlayerXY: ", source:getX(),source:getY())
    createHordeFromTo(args.ZedX, args.ZedY, x, y, args.ZedQ)
    ZedsToPlayer(source,args.ZedQ,x,y,z)
end
``` thinking about the zombie spawning... do you guys think this would be viable?
#

its wrong... correcting it...

jaunty marten
#

feels gotcha

#

nil unhappy

pulsar heath
#

ok i think i've got it

    local sourceId = source:getOnlineID();
    local x = source:getX()
    local y = source:getY()
    local z = source:getZ()
    local zombie = nill
    local ZedList = source:getCell():getZombieList() -- get zombies in the cell
    if ZedList then  -- if no zombie was found values are kept from source
    zombie = ZedList:get(0) -- get first zombie found
    if zombie then
    args.ZedX = zombie:getX() -- set the spawn for the existing zombie x and y
    args.ZedY = zombie:getY()
    end
    end
    print("Zedspawn [".. sourceId .."] quant: ", ZedQ)
    print("Zedspawn [".. sourceId .."] XY: ", args.ZedX,args.ZedY)
    print("Zedspawn [".. sourceId .."] PlayerXY: ", source:getX(),source:getY())
    createHordeFromTo(args.ZedX, args.ZedY, x, y, args.ZedQ) 
    ZedsToPlayer(zombie,args.ZedQ,x,y,z)
end

function ZedsToPlayer(source,zedQ,x,y,z)
    local ZedList = source:getCell():getZombieList()
    local zedcount = 0
        for i=0, ZedList:size()-1 do
            local zombie = ZedList:get(i);
                if zombie then
            zedcount = zedcount +1
            if zedcount <=  zedQ then
            zombie:pathToLocationF(x,y,z);
            end
            end
        end
end```
#

dont see anything else wrong... but i never do.... ๐Ÿ˜„

finite radish
#

your indentation is all kinds of fucked up, but beyond that I don't see anything too egregious at first glance

grand solar
#

hey just wanted to know that that i decide to make assets for PZ, like the shelfs or something, or maybe long blunt or short blunt weapons, then do i need to know coding? and from where should i start to make these? i purchased the game last week.., i am an 3D Environment Artist, but wanted to know how can i make stuffs..

#

any tutorials or guidance should work ig..

pulsar heath
grand solar
sour island
#

nah, just picked apart the rendering system - I still don't know why that list needs a define of 4

pulsar heath
#

well the spawning location is working

#

but the zombies dont move to the player

#

god dang it it worked when i tried b4 adding it to the mod

#

....

jaunty marten
sour island
#

you can add as many as you want

finite radish
#

is it a minimum of 4?

sour island
#

it's an empty array

ancient grail
#

How many tile variation is it that you need exactly

sour island
#

but the java sets it size to 4

#

I worked on this in august

#

I recall it refusing to work

finite radish
#

i know it's an empty array, but if won't work with any values less than 4, it could be that it's just representing a word (4 bytes)

#

not a "word" as in the language sense, but a word as in... the programming sense

sour island
#

ah

finite radish
#

most values in the engine are going to be 32 bits, and there's 8 bits to a byte
so 32/8 = 4

#

just a guess though, I don't know if that's actually what's going on in that case

sour island
#

so the first 4 are maybe an id of sorts?

#

cause you can add onto it

#

as many sprites as you want

finite radish
#

could be, yeah. does the java version assign a type to it?

sour island
#

I'd have to look it up - last touched it in august

#

๐Ÿ˜…

finite radish
#

that'd be telling. if it's an int, or an array of 4 bytes, then you're probably right that it's an ID

#

if it's a string that'll be weird - because that'd be an array of 4 characters most likely, and I can't think of any reason you'd have a 4-length string in there. but who knows

#

still weird that it'd pass that way instead of just using the type directly though. maybe something to do with allocation, idk

sour island
#
            if (!StringUtils.isNullOrWhitespace(var3)) {
               if (var1.AttachedAnimSprite == null) {
                  var1.AttachedAnimSprite = new ArrayList(4);
               }

               IsoSprite var11 = IsoSpriteManager.instance.getSprite(var3);
               var11.name = var3;
               IsoSpriteInstance var12 = IsoSpriteInstance.get(var11);
               if (var7 > 0.0F) {
                  var12.tintr = var4;
                  var12.tintg = var5;
                  var12.tintb = var6;
                  var12.alpha = var7;
               }

               var12.bCopyTargetAlpha = false;
               var12.bMultiplyObjectAlpha = true;
               var1.AttachedAnimSprite.add(var12);
            }
jaunty marten
#

trying to remember how my water pipes mod is working

sour island
#

this is where I got it from

#
public void updateTileOverlaySprite(IsoObject var1) {
      if (var1 != null) {
         IsoGridSquare var2 = var1.getSquare();
         if (var2 != null) {
            String var3 = null;
            float var4 = -1.0F;
            float var5 = -1.0F;
            float var6 = -1.0F;
            float var7 = -1.0F;
            if (var1.sprite != null && var1.sprite.name != null) {
               TileOverlays.TileOverlay var8 = (TileOverlays.TileOverlay)overlayMap.get(var1.sprite.name);
               if (var8 != null) {
                  String var9 = "other";
                  if (var2.getRoom() != null) {
                     var9 = var2.getRoom().getName();
                  }

                  TileOverlays.TileOverlayEntry var10 = var8.pickRandom(var9, var2);
                  if (var10 == null) {
                     var10 = var8.pickRandom("other", var2);
                  }

                  if (var10 != null) {
                     if (var10.usage.bTableTop && this.hasObjectOnTop(var1)) {
                        return;
                     }

                     var3 = var10.pickRandom(var2.x, var2.y, var2.z);
                     if (var10.usage.alpha >= 0.0F) {
                        var6 = 1.0F;
                        var5 = 1.0F;
                        var4 = 1.0F;
                        var7 = var10.usage.alpha;
                     }
                  }
               }
            }

            if (!StringUtils.isNullOrWhitespace(var3) && !GameServer.bServer && Texture.getSharedTexture(var3) == null) {
               var3 = null;
            }

            ...

         }
      }
   }
#

it seems to use this field and give it a list of 4 entries

#

often

#

if you use add() on an array[4] and it's empty does it fill 1 or 5?

jaunty marten
sour island
#

you can add more than 4

jaunty marten
#

I'm talking exactly about number

#

4

sour island
#
            int var4 = this.AttachedAnimSprite.size() > 255 ? 255 : this.AttachedAnimSprite.size();
            if (var4 != 1) {
               var1.put((byte)var4);
            }
#

uses it's size as a byte

finite radish
#

yup there's the byte type I was assuming was there, although it's still a little vague where that goes exactly. I'd say that's the case though

#

what's the thing it's casting to byte there, var4?

#

oh wait it's defined there i'm blind

#

so either 255 or the size, whichever is larger

sour island
#

I don't really understand bytes - if I can keep adding more sprites how does the list's length work as a byte?

#

it is like a hash - that a certain combination of sprites makes the same byte or?

finite radish
#

so you can have 255 sprites, max

fast galleon
finite radish
#

yeah, I meant smaller

#

whoops

fast galleon
#

ok

jaunty marten
finite radish
#

if you attach 255 sprites, you have a problem

sour island
#

that's just for 1 object

fast galleon
#

for one object

sour island
#

you can have as many objects on the tile you want friend

hollow current
#

I discussed sth here before, regarding picking a random item from a json file and using it in my script. I was told it's a bad way, especially wen it comes to translating those items, and that I already have the built-in method, translations. So, my question is, assuming I have a JSON file that consists of something like:

{
  "stories": [
    {
      "title": "Story 1",
      "content": "Story 1 Content"
    },
    {
      "title": "Story 2",
      "content": "Story 2 Content"
    },
    {
      "title": "Story 3",
      "content": "Story 3 Content"
    },
    {
      "title": "Story 4",
      "content": "Story 4 Content"
    }
  ]
}```

How do I use such form in the translations files, to be able to pick one random item from it?
fast galleon
#

It looks like blood uses this system?

sour island
#

floor grime does too

finite radish
sour island
#

as does erosion to some extent

finite radish
#

yeah they're attached sprites, the map uses them extensively. basically anything that uses the "Overlay" tile property

jaunty marten
sour island
#

I think there's a limit on mapobjects but I can see with my inspector there's multiple isoObjects on the same tile usually 2-3

finite radish
#

oh yeah, IsoObject is just anything

ancient grail
#

@quasi kernel didnt you make a farming framework? Can you share link so can add to the compiled stuff thx

finite radish
#

the player is an IsoObject technically

sour island
#

as are sprites

finite radish
#

yup

#

but map objects are different tho

sour island
#

you could technically attach a sprite to a sprite ???

finite radish
#

in this case, it's attached sprites - which apply to map tiles, more or less

#

you can't attach these to just anything

sour island
#

oh

hollow current
sour island
#

public void updateTileOverlaySprite(IsoObject var1) { ?

finite radish
#

they're specifically for the map tiles (although maybe you could attach them to other stuff? I don't know why you'd want to, but maybe you could find a way to do it)

fast galleon
finite radish
jaunty marten
finite radish
jaunty marten
hollow current
#

because like, I can have the translations file in the way of:

Stories_EN = {
    Stories_Story1 = "Content 1",
    Stories_Story2 = "Content 2",
}```

How do I pick from them randomly? How do I adjust that to have a title for each one?
hollow current
fast galleon
#

maybe I don't understand why we mix map objects and attached anim sprites

finite radish
#

because they're two different things

finite radish
#

right, but we're talking about attached sprites via tile overlays

sour island
#

the attachedSprites thing is under IsoObjects

fast galleon
finite radish
sour island
#

I'd be inclined to think you can add overlay to mapobjects or maybe anything

finite radish
#

true, maybe

sour island
#

let me try to add an overlay to myself

fast galleon
sour island
#

IsoDoor IsoWindow IsoLightSwitch IsoGenerator IsoBarrel

#

are mapobjects

finite radish
ancient grail
#

These an animated sprite thing on the docs right

I always thought it was used for campfire, tv, water smoke

sour island
#

campfire is a mapobject too

finite radish
#

yup

sour island
#

I think furniture are as well(?)

ancient grail
#

You have a lost of these things right

fast galleon
#

so are walls, crates, etc

finite radish
finite radish
sour island
#

walls are not unless player built

fast galleon
#

yes

finite radish
#

walls most definitely are not

sour island
#

it certainly feels like 2 systems cobbled together

finite radish
#

you can only have one on each tile, but I don't believe they derive from the mapobject class or whatever properties that make them into the proper mapobject

fast galleon
sour island
#

Nah, mapobjects are referenced but not an actual class

#

afaik

ancient grail
sour island
#

there's a global list called mapobjects

finite radish
#

i haven't looked at them in a hot minute so I couldn't tell you the details off the top of my head

#

but more or less - to get back to the original thing - tile properties determine what can/can't be placed in certain arrangements

#

overlays = attachedSprite = get placed on the tile, in a layer arrangement

fast galleon
#

I'm not even sure if we talk about map or world here.

finite radish
#

you can have any number of sprites on a tile up to 255, but there can only be one "floor" at the base, and it has to have a floor tile property

sour island
#

and mapobjects manipulate the properties too I recall

#

I think that's what they're essence is(?)

#

walls/floors are tiles

#

their sprites get structured together to give the tile it's property

fast galleon
#

Only java mapobjects I see, is the one similar to events. That triggers funtions.

ancient grail
#

Questionn
Theres a thing called remove everything but floor

sour island
#

but you can also slap a mapobject like a door on it and the tile will read it from what I recall (?)

finite radish
ancient grail
#

What does it do exactly like does it delete zeds items corpse or are we talking abt just tiles

sour island
#

sprites definitely have their own properties that match tile's though

#

I recall that from the biome code

finite radish
finite radish
ancient grail
#

Cool
You make the whole place clean like that
So what if
getCell()
Then do that

sour island
#

I think it's amalgamated

ancient grail
#

It will remove everything will it remove floors above

sour island
#

they're referred to as flags

finite radish
# sour island I think it's amalgamated

the way I tend to think of it is that the sprite is just the base image, cut from the spritesheet. the "tile" would include that sprite, as well as the tile properties that are associated with that sprite, to form the tile object

#

and yeah tile properties are mostly flags

#

there's a few that are actual strings and such, but like 90% of them are flags

ancient grail
#

So everything you see that involves tiles are tileobj? Or not all

sour island
#

isoSprite carries tile properties

ancient grail
#

Is there
if instanceof(obj, "IsoTileObject") then

sour island
#

putting them together gives the tile the combination of their properties

ancient grail
#

I doubt

finite radish
sour island
#

there's also no such thing as isotileobject

#

is there?

finite radish
#

i don't recall

sour island
#

the sprites are added to the square

ancient grail
#

I think what we are discussing right now is something any mapper should know

Crater is a mapper

sour island
#

IsoGridSquare

fast galleon
ancient grail
#

But everything else are considered isoObj right

finite radish
#

okay I think I figured out the confusion - "tile" is more or less a term used in the mapping tools' code, so I'm accidentally confusing everyone

pretty sure chuck is right that they're just IsoSprite in the game though

sour island
#
local specialOverrideExceptions = {"IsoCurtain","IsoDoor","IsoWindow","IsoBarricade","IsoLightSwitch"}
---Vanilla has a getFloor but it causes layering issues if there's objects over the floor - like walls
---@param isoGridSquare IsoGridSquare
local function ifFlagTypeGetObject(isoGridSquare, isoFlagType)
    local isoObjects = isoGridSquare:getObjects()

    local objWithFlagFound
    local lastSpriteObject

    if isoFlagType == IsoFlagType.solidfloor and isoGridSquare:getProperties():Is("BlocksPlacement") then return end

    for i=0, isoObjects:size()-1 do
        ---@type IsoObject
        local isoObj = isoObjects:get(i)
        if isoObj then
            local isoObjSprite = isoObj:getSprite()
            local isoObjSpriteName = isoObjSprite:getName()
            if isoObjSprite and isoObjSpriteName then
                if isoObj:getType()==IsoObjectType.wall and string.find(isoObjSpriteName, "roofs") then
                else
                    if isoObjSprite:getProperties():Is(isoFlagType) then
                        objWithFlagFound = true
                        lastSpriteObject = i
                    end

                    if objWithFlagFound then
                        if (not isoGridSquare:getProperties():Is("IsMoveAble")) then
                            lastSpriteObject = i
                        end
                        for _,type in pairs(specialOverrideExceptions) do
                            if instanceof(isoObj, type) then
                                lastSpriteObject = i
                            end
                        end
                    end
                end
            end
        end
    end
    if objWithFlagFound and lastSpriteObject then
        return isoObjects:get(lastSpriteObject)
    end
end
fast galleon
#

yeah tileobject is not real thing in-game

sour island
#

Other part of that biome code

finite radish
#

the game does use "tile" in a bunch of function names but it's likely a later-dev term

sour island
#

this was to... uh... grab the last sprite layer but avoid certain issues with layering

ancient grail
#

Then im also confused about thumpables

I thought thump are those with hp
But then light swwitch are also thump

sour island
#

thumpables are the closest to match 'mapobjects' in java

finite radish
#

to clear things up a bit: it goes IsoCell->IsoChunk->IsoGridSquare->IsoSprite
there's only 1 IsoGridSquare at each coordinate on the map, on each vertical Z level

ancient grail
#

Map obj are those with globals right? I missed this part earlier maybe i should read again

fast galleon
#

Why are we adding new names (mapobjects)?

finite radish
#

but yeah Chuck that's good, I was starting to suspect mapobjects were a Lua thing

sour island
#

I believe mapobjects referenced = thumpables

finite radish
sour island
#

the lau references them as mapobjects :\

#

I'm not hallucinating this

finite radish
#

yeah same LOL

fast galleon
#

MapObjects is a system similar to events

ancient grail
#

Of someone could write all the iso

fast galleon
#

stop confusing people

finite radish
#

...

#

no one is confusing anyone lol, other than maybe the devs

sour island
#

mapbject events?

fast galleon
ancient grail
#

Reason why mentioned global was cuz i saw s panel with global objects and it links to campfire traps and water barrel

sour island
fast galleon
#

I'm on mobile so bear with me.

finite radish
#

it's just a callback event handler like any other, yeah

#

OnLoadWithSprite etc

fast galleon
#
MapObjects.OnLoadWithSprite("sprite",myFunc,5)
sour island
#

I feel like i'm being mandela effected but I guess it wasn't mapobjects but 'worldobjects' ?

#

Lua refers to IsoXYZ as worldobjects

fast galleon
#

when the game load an object with spritename "sprite" it will call myFunc with the object as argument.

sour island
#

also not all IsoXYZ that goes on the world are thumpable

#

IsoGenerator isn't - not sure if light switch would be

#

public class IsoLightSwitch extends IsoObject { it's not

#

thump = can be thumped lol

fast galleon
#

Placing objects has that option.

sour island
#

map tiles have properties for that

#

it's how counters and walls work

#

Nurver made countertops hoppable for instance

fast galleon
sour island
#

they're not IsoThumpable but they have thumpabale flags iirc

fast galleon
#

not same thing

sour island
#

didn't say they were

#

someone said IsoLightSwitch was a IsoT

silk quarry
#

What's the way to make your mod easily translatable? i.e. How do you use the lua/shared/Translate/[language code]/*.txt files

I see they're stringtables. But I can't find any of the keys anywhere, if I look at mods that use them. Like looking at the More Skill Books mod, it has keys in those txt files like DisplayName_Sneaking_for_Beginners and the MoreDescriptionForMoodles has like... Moodles_endurance_desc_lvl1 but those keys don't appear to be present anywhere in the mod's other files. I assumed maybe they're dynamically generated so I searched for things like _desc_ to try and find that but no dice. So! I am here to ask for one (1) halp.

sour island
#

I was tying to bridge the lua term (which I misrecalled) to the java terminology

#

there isn't really a class for "worldobjects" other than just IsoObject

tame mulch
#

Hi! About what discussion here?

fast galleon
silk quarry
#

Aha, thank you both

pulsar heath
#

example: HaloTextHelper.addTextWithArrow(playerChar, getText("UI_trait_"..TWETraitsTable[MyTrait]), true, HaloTextHelper.getColorGreen())

finite radish
pulsar heath
#

the _ disappears ?

finite radish
#

oh actually, I should clarify: IsoCell, IsoChunk, etc. are not IsoObject

#

they're just normal Java objects

silk quarry
pulsar heath
#

basicly you have something called UI_MYtext

#

and you use getText("UI_MYtext")

fast galleon
# sour island didn't say they were

I am just trying to get the terminology straight. So people like me don't get more confused than they need to be, and maybe explain something.

pulsar heath
#

and it will replace that with the text

sour island
#

the context menu pulls all the isoObjects I believe

silk quarry
sour island
#

so "worldobjects" are just IsoObjects in the world... lol

sour island
pulsar heath
#

EN for english, etc

sour island
#

if I use my inspect tool

silk quarry
#

Or can they be whatever? And the name for the object in that file, since it appears to be like ...
Going back to the MoreDescriptionForMoodles, theirs is Moodles_EN = { ... stringtable ...}

pulsar heath
#

i think its on the modding wiki

sour island
#

shows the isobojects on each tile under context menu

silk quarry
#

Oh, no I know that part, I mean about the .txt files though

fast galleon
#

pls no "mapobjects" I asked already and you have no clear definition for that.

pulsar heath
#

the name or the content of the files?

silk quarry
#

Well, both, really.

pulsar heath
#

the files on the wiki theres a table with all the languages

sour island
#

idk why I can swear it was called mapobjects in lua....

pulsar heath
#

the files its usually ( EN for example )

    UI_optionscreen_binding_STATSPZ = "Twitch Game Stats",
    UI_TwitchInGameWindow_status = "Ingame Stats Window",
    UI_Zkills = "Zombie Kills",
    UI_AliveFor ="Time Alive",
    UI_optionscreen_binding_STATSPZToggle = "Game Window Key",
    UI_TwitchStatsTitle = "Game Stats"
}```
fast galleon
#

It just makes harder to explain things and confuses people ๐Ÿ˜ฆ

pulsar heath
#

inside the UI_EN you use the naming you want... thats just from one of my mods

sour island
#

Well I'm confused

#

I don't even use the term myself

pulsar heath
#

the file i have for PTBR

    UI_optionscreen_binding_STATSPZ = "Twitch Game Stats",
    UI_TwitchInGameWindow_status = "Janela de Stats no jogo",
    UI_Zkills = "Zombie Mortos",
    UI_AliveFor ="Tempo Vivo",
    UI_TwitchStatsTitle = "Game Stats"

}```
sour island
#

Oh I started using it for shops

#

ah that's probably where I got the term from baked into my brain

silk quarry
#

But I can name the text files whatever? And the name of that table whatever?
Like, a name of MyMod_EN.txt is fine? And the name of the table in the mod, you have UI_EN there, is that important?
Or does the java just load every .txt file in this folder, and parse the table out of it regardless of name?
Is it important that the table have a specific name? Like the UI_PTBR? Or could you have used UI_Whatever, as long as you were consistent

pulsar heath
#

no

#

you have to follow a structure

tame mulch
pulsar heath
sour island
#

what's the shortcut for en mass text replace

silk quarry
finite radish
#

if you mean within the file, just ctrl+H

pulsar heath
pulsar heath
fast galleon
#

it's ok to call things anything you want but for explaining it's best to use common terms. So if it has a well defined name already, use that to communicate.

fast galleon
sour island
#

I made a documentary of my journey of self discovery

#

Apologies for the pausing - my brain was turning gears when I realized when and why I made the mistake

fast galleon
#

well I'm going to run, have fun

finite radish
sour island
#

when using emmylua to type path it auto compelted WorldObjects at one point

#

and it stuck ever since stressed

finite radish
pulsar heath
finite radish
#

yeah. I talked to Aiteron about getting docs for the native C/C++ libraries, based on that use case

#

(and a few others, but yeah)

pulsar heath
#

the wall of code i posted b4