Sunday, October 10, 2021

Do Gloves Protect You From Broken Glass?

Yes, gloves protect you from handling broken glass - any pair of gloves.  But gloves are not needed when removing broken glass from a smashed window, just when picking up broken glass off the ground.

You deal with broken glass whenever you smash a window.  There's a bit of broken glass remaining in the window frame, and glass on the ground by the smashed window.  You might want to get rid of that broken glass, and I used to think that required leather gloves to prevent injuries.  I was wrong.

Picking Up Broken Glass - Wear Gloves (Any)

You might want to pick up the glass off the ground.  When you or a zombie walks over it, it makes a sound.  Some people strategically place the glass as a sort of alarm for when zombies are near.  Some people just don't like the mess.

If you're not wearing gloves when you pick up the glass, you may injure yourself.

It starts in ISWorldObjectContextMenu.  If you are interacting with brokenGlass, you start executing some code:

    -- broken glass interaction
--    if brokenGlass and playerObj:getClothingItem_Hands() then
	if brokenGlass then
--        local itemName = playerObj:getClothingItem_Hands():getName()
--        if itemName ~= "Fingerless Gloves" then
            context:addOption(getText("ContextMenu_PickupBrokenGlass"), worldObjects, ISWorldObjectContextMenu.onPickupBrokenGlass, brokenGlass, player)
--        end
    end

You notice that there's some commented out code where Fingerless Gloves don't protect you when you pick up broken glass.  I don't know if this is old code or just code that hasn't been implemented yet.  If they put this functionality in (not here, though), I hope they include surgical gloves and long gloves.

The code calls onPickupBrokenGlass

ISWorldObjectContextMenu.onPickupBrokenGlass = function(worldobjects, brokenGlass, player)
    local playerObj = getSpecificPlayer(player)
    if luautils.walkAdj(playerObj, brokenGlass:getSquare()) then
        ISTimedActionQueue.add(ISPickupBrokenGlass:new(playerObj, brokenGlass, 100));
    end
end

That calls ISPickupBrokenGlass, and in the perform() method we see what happens:

function ISPickupBrokenGlass:perform()
	-- add random damage to hands if no gloves (done in pickUpMoveable)
	if ISMoveableTools.isObjectMoveable(self.glass) then
        local moveable = ISMoveableTools.isObjectMoveable(self.glass)
        moveable:pickUpMoveable( self.character, self.square, self.glass, true )
    end

	-- needed to remove from queue / start next.
	ISBaseTimedAction.perform(self)
end

That calls ISMoveableTools.isObjectMoveable to retrieve the glass (a ISMoveableSpriteProps object) (code not included here), and then actually picks it up in ISMoveableSpriteProps:

        elseif self.isoType == "IsoBrokenGlass" then
            -- add random damage to hands if no gloves
            if not _character:getClothingItem_Hands() and ZombRand(3) == 0 then
                local handPart = _character:getBodyDamage():getBodyPart(BodyPartType.FromIndex(ZombRand(BodyPartType.ToIndex(BodyPartType.Hand_L),BodyPartType.ToIndex(BodyPartType.Hand_R) + 1)))
                handPart:setScratched(true, true);
                -- possible glass in hands
                if ZombRand(5) == 0 then
                    handPart:setHaveGlass(true);
                end
            end

This means that ANY clothing on the hands protects you when picking up broken glass.  So you don't need leather gloves - fingerless gloves or surgical gloves or whatever will protect your hands completely from the broken glass.

Removing Broken Glass From a Window - Don't Need Gloves

You should all already know that if you climb through a broken window, there's a good chance you're going to get injured from the broken glass.  So you want to remove the glass from the window before you climb through, especially if it's a window you're going to be climbing through regularly (like at your base).

I haven't found any code that might injure a character removing glass from a broken window.

function ISRemoveBrokenGlass:perform()
	self.window:removeBrokenGlass()

	-- needed to remove from queue / start next.
	ISBaseTimedAction.perform(self)
end

Unlike what we found in the ISPickupBrokenGlass:perform() method, nothing here has any opportunity to injure the character.  If the removeBrokenGlass() method could injure the character, it would pass in the character object.

Afterword

So wearing any gloves is better than wearing no gloves.  Sure, long gloves don't offer any scratch or bite resistance, but they'll protect your hands when you pick up glass.


Thanks for reading!  If you notice a mistake or have any questions I might answer by looking through the code, let me know!

3 comments:

  1. Heya! Love all this data and the specifics on how the game functions. I tried to decompile some code myself but lack experience or knowledge to do it proper. I was wondering if you could perhaps delve into how exactly the trait "Lucky" works. The wiki claims +10% chance to find better loot, but I find that pretty broad and was wondering on how it's coded.

    ReplyDelete
  2. Nice information, You have provided excellent data for us about front doors san antonio. It is valuable and informative for everyone. Keep posting always. I am very thankful to you

    ReplyDelete
  3. How broad is the decay or other harm? In the event that nearly little, it can most likely be fixed without any problem. On the off chance that bigger, a part of window outline or even the entire edge might need to be supplanted.https://www.westseattlewindowcleaner.com/pressure-washing-bellevue-homeowners-best-friend

    ReplyDelete

Do Gloves Protect You From Broken Glass?

Yes, gloves protect you from handling broken glass - any pair of gloves.  But gloves are not needed when removing broken glass from a smashe...