EnigmaGrey Posted April 27, 2014 Share Posted April 27, 2014 https://www.dropbox.com/s/0961pa6lv0rv8lm/usefulBleach.zipNo longer just a quaint method of thirst reduction, harness the buautifying pwoer of bleach to cleanse those stubborn blood stains from walls.Version 1 cares about your pathetic inventory and it's contents. It rejects your attempts to wash anything and everything, other than which can be washed by bleach. From removing troublesom stains on walls to floors, bleach enables all.If it doesn't come out in one go, try two, three, four, or even five times! Get that spot out. Spoiler https://www.dropbox.com/s/0961pa6lv0rv8lm/usefulBleach.zipNo longer just a quaint method of thirst reduction, harness the beautifying power of bleach to clean those stubborn blood stains (and far too much more) from walls.Version 0 doesn't care about your pathetic inventory, nor it's contents. It will let you wash anything, and everything, even those which won't appear washed (floor tiles, zombie corpses, yourself), but it will remove blood from walls -- and even remove accent pieces, such as trim overlapping brick.Though this includes an additional Java function in IsoGridSquare (UnDoBloodSplat), it appears to be unnecessary. Everything it does should be doable in the Lua side . . . eventually.Source code included. Note, this is not compatible with save files (it will not work on loaded blood spatter nor blood overlays). Do not use this with The Censor mod. Be sure to use only in a well-ventilated area. lulu58e2, mvhnexus, turbotutone and 1 other 4 Link to comment Share on other sites More sharing options...
RoboMat Posted April 27, 2014 Share Posted April 27, 2014 This guy is on a roll. Run ... run as fast as you can!!! mvhnexus 1 Link to comment Share on other sites More sharing options...
EnigmaGrey Posted April 27, 2014 Author Share Posted April 27, 2014 Lua-only code to replace Java modifications:local function washSquare ( _worldObjects ) print "let's do it" local squareClicked = nil local squareObjects = nil for i,v in ipairs( _worldObjects ) do print "get that square" squareClicked = v:getSquare() squareClicked:DirtySlice() print "get those objects" squareObjects = squareClicked:getObjects() for j = 0, squareClicked:getObjects():size()-1 do local isoObject = squareObjects:get(j) print "iterate through objects" if (isoObject:getSprite() ) then print "check sprite" for k,l in ipairs (validSplat) do print "check if valid splat" if squareClicked:getCell():getSpriteManager() then print "full of sprite" end --isoSprite = isoObject:getSprite( squareClicked:getCell():getSpriteManager(), validSplat[k]) isoSprite = isoObject:getSprite() local isoSpriteName = isoObject:getSprite():getName() if isoSpriteName:contains(validSplat[k]) then print "contains k " end if (not isoSprite) then print "abandon on null sprite" return end isoSpriteInstance = isoSprite:newInstance() if isoSpriteInstance then print "very valid sprite" if isoObject:getAttachedAnimSprite() then print "remove attached anim sprite" --isoObject:getAttachedAnimSprite():remove(isoSpriteInstance) isoObject:getAttachedAnimSprite():clear() end --if isoObject:getAttachedAnimSpriteActual() then -- isoObject:getAttachedAnimSpirteActual():remove(isoSpriteInstance) --end end end end end endendBut, there's a catch: See isoObject:getAttachedAnimSprite():clear()? That's the only way to both remove the blood spatter and not have it just "pop up" on the tile. The commented code just below it, isoObject:getAttachedAnimSpirteActual():remove(isoSpriteInstance), simply doesn't work fully.Now why is that?. . . Link to comment Share on other sites More sharing options...
EnigmaGrey Posted April 27, 2014 Author Share Posted April 27, 2014 for a = 0, isoObject:getAttachedAnimSprite():size()-1 do print (isoObject:getAttachedAnimSprite():get(a):getClass()) print (isoObject:getAttachedAnimSprite():get(a):getID()) print "but" print (isoSpriteInstance:getID())endJudging by the results of this, IsoSprite's ID never matches up with IsoSpriteInstance's ID. Link to comment Share on other sites More sharing options...
EnigmaGrey Posted April 27, 2014 Author Share Posted April 27, 2014 local function washSquare ( _worldObjects ) local squareClicked = nil local squareObjects = nil for i,v in ipairs( _worldObjects ) do squareClicked = v:getSquare() end squareClicked:DirtySlice() squareObjects = squareClicked:getObjects() for i = 0, squareClicked:getObjects():size()-1 do local isoObject = squareObjects:get(i) if (isoObject:getSprite() ) then isoSprite = isoObject:getSprite() local isoSpriteName = isoObject:getSprite():getName() isoSpriteInstance = isoSprite:newInstance() if isoSpriteInstance then if isoObject:getAttachedAnimSprite() then for j = 0, isoObject:getAttachedAnimSprite():size()-1 do for k,l in ipairs (validSplat) do isoSpriteInstance_a = isoObject:getAttachedAnimSprite():get(j) isoSpriteInstance_a = isoObject:getCell():getSpriteManager():getSprite(validSplat[l]):newInstance() if isoSpriteInstance_a and isoSpriteInstance_b then if (isoSpriteInstance_a:getID() == isoSpriteInstance_b:getID()) then print "match" end end end end end end end endendFar as I managed to come today -- which is to say it's gotten no where. Without access to the tables within IsoSpriteManager, reconciling what sprites are which by ID alone probably isn't possible. I'll just have to leave it at isoObject:getAttachedAnimSprite:clear() until a work around is either figured out or the Java is modified. Link to comment Share on other sites More sharing options...
EnigmaGrey Posted April 30, 2014 Author Share Posted April 30, 2014 So, here's the "solution:'Added a function to IsoGridSquarepublic void UndoSplat(){ this.DirtySlice(); for(int i = 0; i < this.getObjects().size(); ++i) { IsoObject obj = (IsoObject)this.getObjects().get(i); for (int j = 0; j < this.bloodSplats.size(); ++ j ) { if ( this.bloodSplats.get(j) != null ) { if (obj.AttachedAnimSprite != null ) { if (obj.AttachedAnimSprite.contains(bloodSplats.get(j))) { obj.AttachedAnimSprite.remove(bloodSplats.get(j)); } } } } } }That uses this handy new arrayprivate ArrayList bloodSplats = new ArrayList();That's populated by IsoSpriteInstance spr = new IsoSpriteInstance(spr1); if(obj.AttachedAnimSprite == null) { obj.AttachedAnimSprite = new ArrayList(4); obj.AttachedAnimSpriteActual = new ArrayList(4); } this.bloodSplats.add(spr); // registry for bloodsplat objects obj.AttachedAnimSpriteActual.add(spr1); obj.AttachedAnimSprite.add(spr);in IsoGridSquare's DoSplat()Then it can be used from Lua like so:local function UndoSplat(_worldObjects) for i,v in ipairs( _worldObjects ) do squareClicked = v:getSquare() end for k,l in ipairs (validSplat) do squareClicked:UndoSplat(l) endend Link to comment Share on other sites More sharing options...
EnigmaGrey Posted April 30, 2014 Author Share Posted April 30, 2014 https://www.dropbox.com/s/0961pa6lv0rv8lm/usefulBleach.zipNew version is up -- requires you to have bleach in your inventory. Because I didn't think to write a check function to see if blood is on a tile, for now this will have to do. Bleach is, at the moment, an inexhaustible item.This version works only on floor tiles for the sake of testing.Will need to-Add a delta value to bleach (or whatever it's called) and,-Add a function that detects whether a tile is bloody or not.-Make bleach dilutable by a watersource within the inventory (new recipe -- "cleaning solution?")-Make compatible with The Censor mod Link to comment Share on other sites More sharing options...
EnigmaGrey Posted April 30, 2014 Author Share Posted April 30, 2014 The floor code for IsoChunk is much easier (err, hopefully): public ArrayList getFloorBloodSplats() { return FloorBloodSplats; } public void removeBloodSplat(int removeCount) { if ( (FloorBloodSplats.size() > removeCount) ) { for (int i = 0; i <= removeCount; ++i) { this.FloorBloodSplats.remove(i); } } else if ( FloorBloodSplats.size() < removeCount ) { this.FloorBloodSplats.clear(); } } Link to comment Share on other sites More sharing options...
EnigmaGrey Posted April 30, 2014 Author Share Posted April 30, 2014 Updated -- now with the ability to clean blood off the ground.Cleaning blood from tiles is also incremental, based on how much blood is present.I'll have to take a peak at the Wall code, it's lookin' a bit temperamental again. Released. Kidlonewolf and mvhnexus 2 Link to comment Share on other sites More sharing options...
Darrien Posted May 13, 2014 Share Posted May 13, 2014 Does this work with build 26? Link to comment Share on other sites More sharing options...
EnigmaGrey Posted May 13, 2014 Author Share Posted May 13, 2014 Yes.It had better. Link to comment Share on other sites More sharing options...
Darrien Posted May 21, 2014 Share Posted May 21, 2014 Cleaning walls does not appear to do anything but floors work. Link to comment Share on other sites More sharing options...
EnigmaGrey Posted May 21, 2014 Author Share Posted May 21, 2014 Might be from the recent updates to the game -- will take a peak tonight. Link to comment Share on other sites More sharing options...
EnigmaGrey Posted May 25, 2014 Author Share Posted May 25, 2014 Updated. I had just commented out the wall section when debugging. Link to comment Share on other sites More sharing options...
Darrien Posted May 25, 2014 Share Posted May 25, 2014 Which link is updated in the post, the second one or the original? Link to comment Share on other sites More sharing options...
EnigmaGrey Posted May 25, 2014 Author Share Posted May 25, 2014 They're the same link. DropBox automatically versions them. Link to comment Share on other sites More sharing options...
Viceroy Posted July 1, 2014 Share Posted July 1, 2014 Not sure if this is considered necromancy... Just wondering, you are 'technically' (pun lol) staff of TIS, and this is an addition that is probably planned anyway by the devs, so have you asked them if they will look into incorporating this into the base game? Nice code btw. Link to comment Share on other sites More sharing options...
EnigmaGrey Posted July 1, 2014 Author Share Posted July 1, 2014 Not sure if this is considered necromancy... Just wondering, you are 'technically' (pun lol) staff of TIS, and this is an addition that is probably planned anyway by the devs, so have you asked them if they will look into incorporating this into the base game? Nice code btw.Every day. Every hour. Every min- *disappears* Link to comment Share on other sites More sharing options...
Maska_zgz Posted July 21, 2014 Share Posted July 21, 2014 An incredibly useful mod! Thank you very much for this! Some questions about the mod: Works with build 27? If that's right, I'm going to use it immediately on my server! For the mod to work properly, you have to install everything that is included in the compressed file? There are two folders, one is for the installation directory of the game, and the other for Zomboid folder in the Users folder. Both are necessary? Thank you very much for this mod, and by the Fire Extinguisher mod! Link to comment Share on other sites More sharing options...
EnigmaGrey Posted July 21, 2014 Author Share Posted July 21, 2014 Both are necessary; the mod makes some modifications to the game's Java code, while doing the actual work in Lua.I don't plan to update this until build 28 is out, however, partially because It's also possible that it'll be added to the game in the near future. Let me know if there's any errors, though. Link to comment Share on other sites More sharing options...
Maska_zgz Posted July 21, 2014 Share Posted July 21, 2014 Thank you very much for the quick response! I'll try your two mods today, if possible, and informs you of any errors. Link to comment Share on other sites More sharing options...
Maska_zgz Posted July 21, 2014 Share Posted July 21, 2014 Well, I have bad news. With this mod, I can create the world, but just when I see my character for first time, the game closes. A shame, I would like to clean my house of blood. I'll wait until the updated version for the new build. Thank you very much for everything! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now