Jump to content

valrix

Member
  • Posts

    69
  • Joined

  • Last visited

Posts posted by valrix

  1. The test case on line 125 of file media/lua/client/ISUI/ISInventoryPaneContextMenu.lua to check if a Dish Cloth or Bath Towel can be used to dry the player off needs parentheses around 

    testItem:getType() == "DishCloth" or testItem:getType() == "BathTowel"

    to make the line look like

    if (testItem:getType() == "DishCloth" or testItem:getType() == "BathTowel") and playerObj:getBodyDamage():getWetness() > 0 then

    in order to fix a bug where the dry dish cloth has the option to be used when the player is dry because it's only checking if there's a dish towel, or if there's a bath towel and you are wet; instead of checking if they have a dish cloth or bath towel, as well as being wet.

  2. While fixing up one of my mods I noticed I had the option to "Dry myself" with a Dish Cloth when my character had not been wet yet. The error is on line 99 of file ISInventoryPaneContextMenu.lua, where the first part of the if statement:

     

    testItem:getType() == "DishCloth" or testItem:getType() == "BathTowel"

     

    should be wrapped in parentheses to separate it from the wetness > 0 test.

  3. On 3/21/2016 at 8:34 PM, HelmetHawk said:

    All towels in my game disappeared, can't find any anywhere after installing this mod, still gone after uninstalling. 

     

    Hmm, the way items are distributed may have changed recently. I haven't been around lately to do updates, but if I find time I can try to get this working again.

  4. Whew, that'll take a lot of bags to seal something that big, but completely agree that we need large catchment tanks. An old idea I had was to require building it next to a house and it acts like it collects from the roof, speeding up water collection.

  5. - Fixed LuaEventManager.AddEvent() not allowing mods to create custom events. (Issue #001958)

    (clyde)

    I second this sentiment. Nearly jumped out of my seat in public from excitement!

  6. How has the distribution of Wallets and Purses been while playing on SP and MP? Personally, I've been able to find wallets pretty well on SP, but on MP I don't find much of either. Any thoughts on increasing the frequency of wallet and purse spawns a little bit over the (often useless) things otherwise spawned, or do you like it where it's at?

  7. Since I needed to work with config files and your IniIO was mostly done, I helped finish it up!

     

    IniIO.lua

    -- =============================================================================-- INI Reader / Writer-- by RoboMat---- Created: 30.01.14 - 16:59-- modified by Valrix 01.06.15 - 23:38-- =============================================================================-- -------------------------------------------------- Global Variables-- ------------------------------------------------IniIO = {};-- -------------------------------------------------- Global Functions-- ------------------------------------------------function string.startsWith(String,Start)	return string.sub(String,1,string.len(Start))==Startendfunction string.contains(String,Search)	return string.find(String,Search,1,true) > 1endfunction string.trim(String)  return String:match'^%s*(.*%S)' or ''end-- -------------------------------------------------- INI READER-- ----------------------------------------------------- Reads a file written in .ini-format:-- http://en.wikipedia.org/wiki/INI_file---- @param String	_path-- @param Boolean	_createIfNil--function IniIO.readIni(_path, _createIfNil)	local path = _path;	local useNewFile = _createIfNil or false;	-- Create new file reader.	local reader = getFileReader(path, useNewFile);	if reader then		local file = {};		local section;		local line;		while true do			line = reader:readLine();			-- If no line can't be read we know that EOF is reached.			if not line then				reader:close();				break;			end			-- Trim whitespace and remove uppercase letters.			line:trim();			if line:startsWith("[") then --[[ We have a new section ]] --				-- Cut out the actual section name (remove []).				section = line:sub(2, line:len() - 1)				-- Create a new nested table for that section.				file[section] = {};			elseif line:contains("=") then --[[ We have a key && value line ]] --				-- Make sure we have an active section to write to.				assert(file[section], "ERROR: No global properties allowed. There has to be a section declaration first.");				-- Split the key from the value.				local key,value = string.gmatch(line, "(%w+)=(%S*)")();				key = key:trim();				value = value:trim();				-- Use the key to index the active table and store the value.				file[section][key] = value;			end		end		return file;	else		print("\nERROR: Can't read file at: " .. path .. "\n");		return;	endend-- -------------------------------------------------- INI WRITER-- ----------------------------------------------------- @param String	_path-- @param Table		_ini-- @param Boolean	_createIfNil-- @param Boolean	_append--function IniIO.writeIni(_path, _ini, _createIfNil, _append)	local path = _path;	local ini = _ini;	local useNewFile = _createIfNil or true;	local append = _append or false;	local writer = getFileWriter(path, useNewFile, append);	if writer then		for section, values in pairs(ini) do			writer:write("[" .. tostring(section) .. "]\n");			for key, value in pairs(values) do				writer:write(tostring(key) .. "=" .. tostring(value) .. "\n");			end		end		writer:close();	else		print("\nERROR: Can't create file at: " .. path .. "\n");		return;	endend

     

    Usage Example:

    ZConomy = {};ZConomy.config = {};function ZC_config()    if not fileExists(getMyDocumentFolder().."/Lua/ZConomy.ini") then        local config = {            ["Pop"] = 1.5,            ["Snack"] = 1.25,            ["Petrol"] = 0        };        ZConomy.config["Prices"] = config;        IniIO.writeIni("ZConomy.ini", ZConomy.config);    else        ZConomy.config = IniIO.readIni("ZConomy.ini");    endendEvents.OnGameBoot.Add(ZC_config);

    Example Output (from above code):

    [Prices]Pop=1.5Snack=1.25Petrol=0
  8. Now we just need vending machines to have a smashed graphic for when breaking them open.

     

    Maybe one of the wonderful community artists will help with this endeavor? *hopes at least one sees this*

  9. Also another thing the money can be used for is to get gas from gas pumps until the power runs out but you would need a empty gas can.

     

    Added to planned features  :)

  10. 3 things Number 1. I like the Puny Name lol 2.Going to try it right away and 3.Would the currency from this conflict with Hydrocraft and if so maby make it if you can somehow when Hydrocraft is installed you can use Hydro Monah

     

    1. Thanks, I struggled for a good name for a while, haha.

    2. Awesome! Hope you enjoy it!

    3. It shouldn't conflict with it, but I do want to have it work with other mods like Hydrocraft seamlessly. I haven't figured out a nice catch-all yet, but will probably just add support for each mod that's requested until I can figure out a good way to do it. Thank you for the suggestion! I'll add it to the planned features list.

  11. Greetings! I've made this mod as an attempt to implement currency and allow the use of machines that would require such currency. With it, you can loot money from wallets and purses, then buy from vending machines, which have been loaded up with drinks and snacks. If you don't have the money and don't mind making a lot of noise, you can also pry them open with a crowbar, destroying some of the contents.

     

    I haven't had a chance to test this in multiplayer yet, but I tried to implement it best I can. I'm afraid my experience with multiplayer is close to none.

     

    Planned Features:

    • Smash open cash registers for a lot of money.
    • Some kind of trade/payment interface?
    • Buy gas until power is off.
    • Remove access to machines when power goes out.
    • Support different types of money from other mods (like Hydrocraft)
    • Make fees for all machines configurable
    • Add more sounds for various machines (drinks/snacks being vended, gas being pumped, etc.)
    • Add smashed variants of machines (artwork needed)
    • Allow reset of machines on soft-reset and/or schedule

     

    Downloads:

    Latest Version

     

    Changelog:

    v0.1

    - Added money

    - Made vending machines contain more loot

    - Vending machines now sell their goods for 1.50/ea, and can be broken open (loudly and messily) with a crowbar

     

    Translation Support:

    ContextMenu_EN.txt

    ContextMenu_EN = {    ContextMenu_BuyDrink = "Buy drink",    ContextMenu_BuySnack = "Buy snack",    ContextMenu_BreakOpen = "Break open"} 
  12. How do you want to spawn the items? To spawn then in a players inventory, the format is like this:

    Local inv = getSpecificPlayer(player):getInventory();

    inv:AddItem("MODULE.ITEM_NAME");

    Changing MODULE.ITEM_NAME to the actual item's name. (e.g. Base.Fork to spawn a fork)

    Edit: Looks like Svarog beat me to it with much better documentation. :P

  13. I basically do this with my DryTowels mod. In the code, when drying yourself it removes the dry towel and adds an empty wet towel that it charges with uses over time depending on how empty it is. This way, you can stop mid-dry and it'll be half-wet for later use. I use those charges to fill up water containers.

  14.  

    v6.3 testing in Build 31.10

     

    I can't loot ANYTHING from ANYWHERE when I run this mod. And yes, I've tested all of my mods one by one, and it only happens with this one. As in, no looting with just this mod running. 

     

    My guess: your mod might have a clash going on with the base game due to this mod having it's own files on cleaning dirty water when we have it in base Build 31. Please look into it.

     

    I also get this on my game cmd.exe...

     

    ERROR: ItemContainer.AddItem: can't find dryTowels.Purifier

     

    v6.3 doesn't reference Purifier anymore, so you may have some lingering files from an earlier version. I tested the download link and the files all check out fine as well. Here's the direct link to v6.3 in case the server was giving you the wrong version: dryTowels_v63.zip

  15. My bad, for some reason I didn't understand the initial question. To be honest, I haven't played around with the map/tile editor, so I don't know how they work. However, from what I've gleaned off the code, it looks like the initial tainted state is stored in one of these .tiles map definition files. Whether it does it per-tile, or per-tile-definition, I don't know.

    media/newtiledefinitions.tilesnewtiledefinitions_4.tilestiledefinitions.tilestiledefinitions_4.tilestiledefinitions_erosion.tiles
  16. I'm not sure if this counts as more of a mod or script, but I've managed to enable custom tooltips by setting an item's getModData()["tooltip"] object. It supports multiple labels, too! I haven't managed to make the values stay centered, but got pretty close.

     

    tooltips.png

     

    Example:

    local md = result:getModData();md.tooltip = {};md.tooltip.amount = ZombRand(3) .. "." .. ZombRand(99);

    Installation:

    Paste the following spoiler'd script into a new file and save it in the "client" folder of your mod for it to work.

     

    Script:

    require "ISUI/ISToolTipInv"if ISToolTipInv.loaded ~= nil then    print("Custom tooltips already loaded, skipping...");    returnelse    ISToolTipInv.loaded = 1endfunction ISToolTipInv:render()    -- we render the tool tip for inventory item only if there's no context menu showed    if not ISContextMenu.instance or not ISContextMenu.instance.visibleCheck then        -- tool tips are glitched in that they do not set their properties set before DoTooltip is called        -- therefore we cannot ensure that they are placed correctly        local mx = getMouseX() + 24;        local my = getMouseY() + 24;        if not self.followMouse then            mx = self:getX()            my = self:getY()        end        -- if not self.toolTipDone then            self.tooltip:setX(mx+11);            self.tooltip:setY(my);            self.tooltip:setWidth(50)            self.item:DoTooltip(self.tooltip);           -- self.toolTipDone = true;           -- return;        -- end        -- clampy x, y        local myCore = getCore();        local maxX = myCore:getScreenWidth();        local maxY = myCore:getScreenHeight();        local tw = self.tooltip:getWidth();        local th = self.tooltip:getHeight();        local lh = getTextManager():getFontFromEnum(UIFont.Small):getLineHeight();        self.tooltip:setX(math.max(0, math.min(mx + 11, maxX - tw - 1)));        self.tooltip:setY(math.max(0, math.min(my, maxY - th - 1)));        self:setX(self.tooltip:getX() - 11);        self:setY(self.tooltip:getY());        self:setWidth(tw + 11);        -- helper function        function len(T)            local c = 0            for _ in pairs(T) do c = c + 1 end            return c        end        local itemData = nil;        if self.item:hasModData() then            itemData = self.item:getModData();            if itemData.tooltip ~= nil then                th = th + (lh * len(itemData.tooltip));            end        end        self:setHeight(th);        self:drawRect(0, 0, self.width, self.height, self.backgroundColor.a, self.backgroundColor.r, self.backgroundColor.g, self.backgroundColor.b);        self:drawRectBorder(0, 0, self.width, self.height, self.borderColor.a, self.borderColor.r, self.borderColor.g, self.borderColor.b);        if itemData ~= nil and itemData.tooltip ~= nil then            -- local x = 5;            local count = 1;            local label;            local ty;            for key in pairs(itemData.tooltip) do                ty = 25 + (lh * count);                label = key:gsub("^%l", string.upper) .. ":";                self.tooltip:DrawText(label, 5, ty, 1,1,0.8,1);                -- [x = ] pad + 40 + getTextManager():MeasureStringX(UIFont.Small, label)                self.tooltip:DrawText(itemData.tooltip[key], (self.width / 2) + 12, ty, 1,1,1,1);                count = count + 1;            end        end        self.item:DoTooltip(self.tooltip);    endend 

     

    Changelog:

    v0.2.0

    - Added check so only the first one it finds will be loaded.

     

    v0.1.0

    - Added ability to add custom tooltips as key/value pairs.

×
×
  • Create New...