Jump to content

Norby007

Member
  • Posts

    11
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Norby007's Achievements

  1. I noticed that if you have a stack of items that you are cooking one at a time, the stack doesn't update until I click the dropdown on any item in the player inventory. Is there a way to force a refresh to the player's inventory after the food is changed to a cooked state?
  2. Curious, did you ever get this to work? Not sure about pulling it from the hand but you can pull it from the player inventory.
  3. It takes the slurp and burp machine and converts it into a container item so that later on I can drop in a menu to pull soda syrup and co2 tanks from the container. This bit was a mess as in multiplayer it would not update until I finally worked this out. When the grid square is loaded it looks for the machine. If found it sends it for replacement. If it's not already replaced it saves the index of the sprite and deletes it locally and from the server. Then it creates a new container with the specs that I wanted and reloads the original sprite's index. Then it updates the whole thing to the server with the mod data after dropping it on to the tile and updating the tile to the server. At least that is how I understand it. I only started coding in PZ about a month ago.
  4. This is how I finally solved the issue, not sure if all of the code is needed but it works so I am not going to fight it. local function replaceSodaFountain(SodaFountainObject) if not SodaFountainObject:getContainer() then local square = SodaFountainObject:getSquare() local spr = SodaFountainObject:getSprite():getName() local index = SodaFountainObject:getObjectIndex() sledgeDestroy(SodaFountainObject) SodaFountainObject:getSquare():transmitRemoveItemFromSquareOnServer(SodaFountainObject) SodaFountainObject:getSquare():transmitRemoveItemFromSquare(SodaFountainObject) SodaFountainObject = IsoThumpable.new(getCell(), square, spr, false, ISWoodenContainer:new(spr, nil)) SodaFountainObject:setIsContainer(true) SodaFountainObject:getContainer():setType("counter") SodaFountainObject:getContainer():setCapacity(50) square:AddTileObject(SodaFountainObject, index) square:transmitAddObjectToSquare(SodaFountainObject, SodaFountainObject:getObjectIndex()) square:transmitModdata() SodaFountainObject:transmitModData() SodaFountainObject:transmitCompleteItemToServer() SodaFountainObject:transmitUpdatedSpriteToServer() end end local function GetVanillaSodaFountain(square) if square then local objects = square:getObjects() for i=1, objects:size()-1 do local thisObject = objects:get(i) local spr = thisObject:getSprite() if spr then local properties = spr:getProperties() if properties:Val("GroupName") == "SlurpBurp" then return thisObject end end end end end local function onLoadGridsquare(square) local SodaFountain = GetVanillaSodaFountain(square) if SodaFountain then replaceSodaFountain(SodaFountain) end end Events.LoadGridsquare.Add(onLoadGridsquare);
  5. I finally got the code to work and will post the method that made it work when I get done with the mod update tonight. It will allow anyone using the code to convert any unused static sprite in the game into a container item that gets updated in the world for multiplayer support.
  6. Does anyone know the difference between these two commands? transmitRemoveItemFromSquareOnServer() transmitRemoveItemFromSquare() I suspect the first is only used on multiplayer and the second is used on a solo game?
  7. I have tried a few things without any luck. I have a check on load grid square that will convert the slurp burp machine into a container item. This works fine in single player but as soon as it is created in multiplayer any items left inside will disappear if you leave the area and return. I verified locally that once the machine is converted that it is not making a new one. I have a test server setup that I have been using but haven't figure out how to log the print commands so I can see what the code is doing in multiplayer. It's not throwing any errors in the log, just upon return the box is empty. I also noticed that objects I set custom weight on also does not update between players and resets to the starting weight. I suspect there is something I need to send to the server that is sent back to all players upon the changes but I have not found a way to make that happen. Any ideas? Thank you for your time. local function replaceSodaFountain(SodaFountainObject) if not SodaFountainObject:getContainer() then local square = SodaFountainObject:getSquare() local spr = SodaFountainObject:getSprite():getName() sledgeDestroy(SodaFountainObject) SodaFountainObject:getSquare():transmitRemoveItemFromSquare(SodaFountainObject) SodaFountainObject:transmitCompleteItemToServer(); SodaFountainObject:transmitUpdatedSpriteToClients() if isClient() then SodaFountainObject:transmitCompleteItemToServer(); end SodaFountainObject:setSprite(spr) SodaFountainObject:getSprite():setName(spr) SodaFountainObject = IsoThumpable.new(getCell(), square, spr, false, ISDoubleTileFurniture:new("SlurpBurp", spr, spr)); SodaFountainObject:setIsThumpable(true) SodaFountainObject:setIsContainer(true) SodaFountainObject:getContainer():setType("counter") SodaFountainObject:getContainer():setCapacity(50) SodaFountainObject:setCanPassThrough(false) SodaFountainObject:setIsDismantable(false) SodaFountainObject:setBlockAllTheSquare(true) SodaFountainObject:getSprite():getProperties():Set(IsoFlagType.waterPiped, "TRUE") square:AddTileObject(SodaFountainObject); if isClient() then SodaFountainObject:transmitCompleteItemToServer(); end end end
  8. Thank you for your response. I have seen this and it explains a lot except how to add the TheaterSnacks list into the theatre counters list. I built a work around but it's not using the tables. I just force feed the counters in the theater and made some user settable options to lower or increase the amounts. example, this code will add the Fountain Cup into the theatresnacks list. table.insert(ProceduralDistributions["list"]["TheatreSnacks"].items, "FunctionalAppliances.FAFountainCup"); table.insert(ProceduralDistributions["list"]["TheatreSnacks"].items, 10); But if you go into the distributions file in project zomboid, the theatresnacks list is never used. I suspect it was supposed to be added to the theatre tables in the distribution file. theatre = { counter = { procedural = true, procList = { {name="StoreCounterCleaning", min=0, max=99, forceForTiles="location_shop_accessories_01_0;location_shop_accessories_01_1;location_shop_accessories_01_2;location_shop_accessories_01_3;location_shop_accessories_01_20;location_shop_accessories_01_21;location_shop_accessories_01_22;location_shop_accessories_01_23;fixtures_sinks_01_0;fixtures_sinks_01_1;fixtures_sinks_01_2;fixtures_sinks_01_3;fixtures_sinks_01_4;fixtures_sinks_01_5;fixtures_sinks_01_6;fixtures_sinks_01_7;fixtures_sinks_01_8;fixtures_sinks_01_9;fixtures_sinks_01_10;fixtures_sinks_01_11;fixtures_sinks_01_16;fixtures_sinks_01_17;fixtures_sinks_01_18;fixtures_sinks_01_19"}, } } }, theatrekitchen = { isShop = true, counter = { procedural = true, procList = { {name="StoreCounterCleaning", min=0, max=99, forceForTiles="location_shop_accessories_01_0;location_shop_accessories_01_1;location_shop_accessories_01_2;location_shop_accessories_01_3;location_shop_accessories_01_20;location_shop_accessories_01_21;location_shop_accessories_01_22;location_shop_accessories_01_23;fixtures_sinks_01_0;fixtures_sinks_01_1;fixtures_sinks_01_2;fixtures_sinks_01_3;fixtures_sinks_01_4;fixtures_sinks_01_5;fixtures_sinks_01_6;fixtures_sinks_01_7;fixtures_sinks_01_8;fixtures_sinks_01_9;fixtures_sinks_01_10;fixtures_sinks_01_11;fixtures_sinks_01_16;fixtures_sinks_01_17;fixtures_sinks_01_18;fixtures_sinks_01_19"}, } }, crate = { procedural = true, procList = { {name="CratePopcorn", min=0, max=99, weightChance=100}, {name="CrateSodaBottles", min=0, max=99, weightChance=40}, {name="CrateSodaCans", min=0, max=99, weightChance=60}, } }, freezer = { procedural = true, procList = { {name="TheatreKitchenFreezer", min=0, max=99}, } }, fridge = { rolls = 1, items = { } }, metal_shelves = { procedural = true, procList = { {name="CratePopcorn", min=0, max=99, weightChance=100}, {name="CrateSodaBottles", min=0, max=99, weightChance=40}, {name="CrateSodaCans", min=0, max=99, weightChance=60}, } }, }, theatrestorage = { crate = { procedural = true, procList = { {name="CratePopcorn", min=0, max=99, weightChance=100}, {name="CrateSodaBottles", min=0, max=99, weightChance=40}, {name="CrateSodaCans", min=0, max=99, weightChance=60}, } }, }, My guess is this is a mistake or missed opportunity. I do not know how to insert {name="TheatreSnacks", min=0, max=99}, into the existing distribution table from a mod... so close yet so far...
  9. I tried something like this but it did not work. table.insert(SuburbsDistributions["theatre"]["counter"].procList, name="TheatreSnacks"); table.insert(SuburbsDistributions["theatre"]["counter"].procList, min=0); table.insert(SuburbsDistributions["theatre"]["counter"].procList, max=99); table.insert(SuburbsDistributions["theatre"]["counter"].procList, weightChance=60);
  10. No real list, but I found a the lists in the file ProceduralDistributions.lua in PZ's folder here... \ProjectZomboid\media\lua\server\Items each list item looks like this: PizzaKitchenButcher = { rolls = 4, items = { "KitchenKnife", 6, "MeatCleaver", 4, "Pepperoni", 50, "Pepperoni", 20, "Pepperoni", 20, "Pepperoni", 10, "Pepperoni", 10, "Twine", 10, }, junk = { rolls = 1, items = { "Apron_White", 20, "CuttingBoardPlastic", 100, } } }, In this example: PizzaKitchenButcher is the name and I believe that the number afterwards is a percentage. So to make this work in your mod, you would add this line in your shared items directory. table.insert(ProceduralDistributions["list"]["PizzaKitchenButcher"].items, "Base.Sausage"); table.insert(ProceduralDistributions["list"]["PizzaKitchenButcher"].items, 10); and then it would spawn sausages in the pizza kitchens... Took me a while to understand this... My big question now, is how to add a room counter location. In the Distribution file are the locations but the theatre counters only have cleaning supplies and I want to add a distribution list like "TheatreSnacks" so they are added to the counters. Is there a way to do this in a mod by adding code to a distributions file in shared directory? theatre = { counter = { procedural = true, procList = { {name="StoreCounterCleaning", min=0, max=99, forceForTiles="location_shop_accessories_01_0;location_shop_accessories_01_1;location_shop_accessories_01_2;location_shop_accessories_01_3;location_shop_accessories_01_20;location_shop_accessories_01_21;location_shop_accessories_01_22;location_shop_accessories_01_23;fixtures_sinks_01_0;fixtures_sinks_01_1;fixtures_sinks_01_2;fixtures_sinks_01_3;fixtures_sinks_01_4;fixtures_sinks_01_5;fixtures_sinks_01_6;fixtures_sinks_01_7;fixtures_sinks_01_8;fixtures_sinks_01_9;fixtures_sinks_01_10;fixtures_sinks_01_11;fixtures_sinks_01_16;fixtures_sinks_01_17;fixtures_sinks_01_18;fixtures_sinks_01_19"}, } } },
  11. table.insert(ProceduralDistributions["list"]["BurgerKitchenFridge"].items, "mod.newobject"); table.insert(ProceduralDistributions["list"]["BurgerKitchenFridge"].items, 2); "BurgerKitchenFridge" -> Is there a list of these locations that can be used? In particular I am looking for the locations used for the Theater counters, crates, shelves, fridge, and freezers. Thank you! -Norby
×
×
  • Create New...