Added Project Files
Added all files from the project and edited the readme.md
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
require "Definitions/ContainerButtonIcons"
|
||||
|
||||
ContainerButtonIcons = ContainerButtonIcons or {}
|
||||
|
||||
local t = {}
|
||||
|
||||
t.Trash= getTexture("media/textures/Trash.png")
|
||||
t.TrashPaper= getTexture("media/textures/TrashPaper.png")
|
||||
|
||||
ContainerButtonIcons.Trash = t.Trash
|
||||
ContainerButtonIcons.TrashPaper = t.TrashPaper
|
145
Random Corpses/media/lua/shared/ScatteredTrashes.lua
Normal file
145
Random Corpses/media/lua/shared/ScatteredTrashes.lua
Normal file
@@ -0,0 +1,145 @@
|
||||
-- local function hasWaterObject(square)
|
||||
-- for i=0, square:getObjects():size()-1 do
|
||||
-- local v = square:getObjects():get(i);
|
||||
-- if instanceof(v, "IsoObject") and v:getSprite() and v:getSprite():getProperties() and v:getSprite():getProperties():Is(IsoFlagType.water) then
|
||||
-- --print("Water Tile")
|
||||
-- return true;
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
function trashSquare(square)
|
||||
-- print("SQUARE 1")
|
||||
local mData = square:getModData()
|
||||
if mData.trashSquare then return end
|
||||
if mData.specialSquare then return end
|
||||
mData.trashSquare = true
|
||||
square:transmitModdata()
|
||||
--if mData.trashSquare then return end
|
||||
if ZombRand(0,5) ~= 0 then return end
|
||||
if not square then return end
|
||||
if checkBlockedSquare(square) == false then return false end
|
||||
if mData.stashSquare then return end
|
||||
if not square:getZone() then return end
|
||||
--if square:hasFloor(false) then return end
|
||||
if not square:getZone():getType() then return end
|
||||
--if square:isVehicleIntersecting() then return end
|
||||
--if not square:isNotBlocked(true) then return end
|
||||
local zoneType = square:getZone():getType()
|
||||
local vehicleZone = nil
|
||||
if getVehicleZoneAt and getVehicleZoneAt(square:getX(), square:getY(), square:getZ()) then
|
||||
vehicleZone = getVehicleZoneAt(square:getX(), square:getY(), square:getZ())
|
||||
end
|
||||
-- print("SQUARE 2")
|
||||
local cell = getCell()
|
||||
|
||||
--if hasWaterObject(square) then return false end
|
||||
|
||||
if not square:isOutside() then
|
||||
|
||||
if square:getZ() > 0 and not square:hasFloor(true) then return end
|
||||
|
||||
--if ZombRand(0,49)== 0 then
|
||||
if ZombRand(0,10)== 0 then
|
||||
local body = createRandomDeadBody(square, 200 )
|
||||
|
||||
if body and ZombRand(0,3) == 0 then -- used so that all spawned bodies are not on their backs
|
||||
body:setFallOnFront(true)
|
||||
end
|
||||
mData.specialSquare = true
|
||||
end
|
||||
return
|
||||
end
|
||||
if square:getZ() > 0 and not square:hasFloor(true) then return end
|
||||
local vehicleZoneType = nil
|
||||
if vehicleZone and vehicleZone:getType() then vehicleZoneType = vehicleZone:getType() end
|
||||
--if vehicleZone and vehicleZone:getName():contains("trafficjam") then
|
||||
if vehicleZoneType and vehicleZoneType:contains("trafficjam") then
|
||||
--if ZombRand(0,99)== 0 then
|
||||
if ZombRand(0,20)== 0 then
|
||||
--print("Crash Corpse")
|
||||
local body = createRandomDeadBody(square, 200 )
|
||||
--if body then body:setSkeleton(true) end
|
||||
if body and ZombRand(0,3) == 0 then -- used so that all spawned bodies are not on their rbacks
|
||||
body:setFallOnFront(true)
|
||||
end
|
||||
mData.specialSquare = true
|
||||
end
|
||||
elseif vehicleZone then
|
||||
|
||||
--if ZombRand(0,199)== 0 then
|
||||
if ZombRand(0,40)== 0 then
|
||||
--print("Car Corpse")
|
||||
local body = createRandomDeadBody(square, 200 )
|
||||
if body and ZombRand(0,3) == 0 then -- used so that all spawned bodies are not on their rbacks
|
||||
body:setFallOnFront(true)
|
||||
end
|
||||
mData.specialSquare = true
|
||||
end
|
||||
elseif zoneType =="Nav" then
|
||||
|
||||
--if ZombRand(0,1999)== 0 then
|
||||
if ZombRand(0,400)== 0 then
|
||||
--print("Corpse Spawn")
|
||||
local body = createRandomDeadBody(square, 200 )
|
||||
if body and ZombRand(0,3) == 0 then -- used so that all spawned bodies are not on their rbacks
|
||||
body:setFallOnFront(true)
|
||||
end
|
||||
mData.specialSquare = true
|
||||
end
|
||||
elseif zoneType == "TownZone" or zoneType == "ZoneStory" or zoneType == "TrailerPark" then
|
||||
|
||||
--if square:getZ() > 0 and ZombRand(0,3999)== 0 then
|
||||
if square:getZ() > 0 and ZombRand(0,800)== 0 then
|
||||
--print("Roof Corpse Spawn")
|
||||
local body = createRandomDeadBody(square, 200 )
|
||||
--if body then body:setSkeleton(true) end
|
||||
if body and ZombRand(0,3) == 0 then -- used so that all spawned bodies are not on their rbacks
|
||||
body:setFallOnFront(true)
|
||||
end
|
||||
mData.specialSquare = true
|
||||
-- end
|
||||
--elseif square:getZ()==0 and ZombRand(0,399)== 0 then
|
||||
elseif square:getZ()==0 and ZombRand(0,80)== 0 then
|
||||
--print("Corpse Spawn")
|
||||
local body = createRandomDeadBody(square, 200 )
|
||||
--if body then body:setSkeleton(true) end
|
||||
if body and ZombRand(0,3) == 0 then -- used so that all spawned bodies are not on their rbacks
|
||||
body:setFallOnFront(true)
|
||||
end
|
||||
mData.specialSquare = true
|
||||
end
|
||||
|
||||
elseif zoneType == "Vegitation" or zoneType == "Farm" then
|
||||
|
||||
--if ZombRand(0,1999)== 0 then
|
||||
if ZombRand(0,400)== 0 then
|
||||
--print("Corpse Spawn")
|
||||
local body = createRandomDeadBody(square, 200 )
|
||||
if body and ZombRand(0,3) == 0 then -- used so that all spawned bodies are not on their rbacks
|
||||
body:setFallOnFront(true)
|
||||
end
|
||||
mData.specialSquare = true
|
||||
end
|
||||
elseif zoneType == "Forest" then
|
||||
--if ZombRand(0,99999)== 0 then
|
||||
if ZombRand(0,2000)== 0 then
|
||||
--print("Corpse Spawn")
|
||||
local body = createRandomDeadBody(square, 200 )
|
||||
if body and ZombRand(0,3) == 0 then -- used so that all spawned bodies are not on their rbacks
|
||||
body:setFallOnFront(true)
|
||||
end
|
||||
mData.specialSquare = true
|
||||
end
|
||||
elseif zoneType == "DeepForest" then
|
||||
if ZombRand(0,20000)== 0 then
|
||||
--print("Corpse Spawn")
|
||||
local body = createRandomDeadBody(square, 200 )
|
||||
if body and ZombRand(0,3) == 0 then -- used so that all spawned bodies are not on their rbacks
|
||||
body:setFallOnFront(true)
|
||||
end
|
||||
mData.specialSquare = true
|
||||
end
|
||||
end
|
||||
square:transmitModdata()
|
||||
end
|
13
Random Corpses/media/lua/shared/ScatteredTrashes_Hook.lua
Normal file
13
Random Corpses/media/lua/shared/ScatteredTrashes_Hook.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
-- local function trashSquare_Hook(square)
|
||||
-- --print("HOOK")
|
||||
-- if square:getModData().trashSquare then return end
|
||||
-- if square:getModData().specialSquare then return end
|
||||
-- trashSquare(square)
|
||||
|
||||
-- end
|
||||
|
||||
|
||||
-- Events.LoadGridsquare.Add(trashSquare_Hook) -- every time a grid square is loaded, checks for any vehicle spawn list entries
|
||||
|
@@ -0,0 +1,98 @@
|
||||
function checkDeadZone(square)
|
||||
if not square then square = getPlayer():getSquare() end
|
||||
if not square then print("Player Square Failure!") return false end
|
||||
if (not square:getZone() and square:getZone():getType()) then return false end
|
||||
if (not getVehicleZoneAt(square:getX(), square:getY(), square:getZ())) then return false end
|
||||
if (not square:getRoom() and not square:getRoom():getName() ) then return false end
|
||||
end
|
||||
|
||||
function isFreeTile( _square )
|
||||
if not _square or _square:Is("BlocksPlacement") or _square:Is(IsoFlagType.canBeCut) or _square:Is("tree") then
|
||||
return false;
|
||||
end
|
||||
return true;
|
||||
end
|
||||
|
||||
function hasWaterObject(square)
|
||||
for i=0, square:getObjects():size()-1 do
|
||||
local v = square:getObjects():get(i);
|
||||
if instanceof(v, "IsoObject") and v:getSprite() and v:getSprite():getProperties() and v:getSprite():getProperties():Is(IsoFlagType.water) then
|
||||
--print("Water Tile")
|
||||
return true;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function checkBlockedSquare(square)
|
||||
if not square then square = getPlayer():getSquare() end
|
||||
if not square then
|
||||
--print("Player Square Failure!")
|
||||
return false
|
||||
end
|
||||
if not isFreeTile(square) then
|
||||
--print("Not Free Tile")
|
||||
return false
|
||||
end
|
||||
if square:isVehicleIntersecting() then
|
||||
--print("Vehicle Intersecting!")
|
||||
return false
|
||||
end
|
||||
if hasWaterObject(square) then
|
||||
--print("Water!")
|
||||
return false
|
||||
end
|
||||
if square:HasStairs() then
|
||||
--print("Stairs!")
|
||||
return false
|
||||
end
|
||||
if not square:hasFloor(true) then
|
||||
--print("No Floor!")
|
||||
return false
|
||||
end
|
||||
local door = square:getDoor(true) or square:getDoor(false) or square:haveDoor()
|
||||
if door then
|
||||
--print("Door!")
|
||||
return false
|
||||
end
|
||||
if square:Is("IsTable") then
|
||||
--print("Table!")
|
||||
return false
|
||||
end
|
||||
if square:Is("IsTableTop") then
|
||||
--print("Is TableTop!")
|
||||
return false
|
||||
end
|
||||
if square:isSolid() then
|
||||
--print("Solid!")
|
||||
return false
|
||||
end
|
||||
if square:isSolidTrans() then
|
||||
--print("Solid Trans!")
|
||||
return false
|
||||
end
|
||||
local cell = square:getCell() -- the cell wont change. no need to getWorld():getCell() every step of the loop
|
||||
local x, y, z = square:getX(), square:getY(), square:getZ()
|
||||
local square2 = cell:getGridSquare(x-1, y, z)
|
||||
if square2 and square:getDoorFrameTo(square2) then
|
||||
--print("Door Frame!")
|
||||
return false
|
||||
end
|
||||
local square2 = cell:getGridSquare(x+1, y, z)
|
||||
if square2 and square:getDoorFrameTo(square2) then
|
||||
--print("Door Frame!")
|
||||
return false
|
||||
end
|
||||
local square2 = cell:getGridSquare(x, y-1, z)
|
||||
if square2 and square:getDoorFrameTo(square2) then
|
||||
--print("Door Frame!")
|
||||
return false
|
||||
end
|
||||
local square2 = cell:getGridSquare(x, y+1, z)
|
||||
if square2 and square:getDoorFrameTo(square2 ) then
|
||||
--print("Door Frame!")
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
|
10
Random Corpses/media/lua/shared/Translate/EN/IG_UI_EN.txt
Normal file
10
Random Corpses/media/lua/shared/Translate/EN/IG_UI_EN.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
IGUI_EN = {
|
||||
-- All the UI text used in game
|
||||
-- InventoryPane
|
||||
|
||||
IGUI_ContainerTitle_Trash = "Trash",
|
||||
IGUI_ContainerTitle_TrashPaper = "Scattered Papers",
|
||||
|
||||
|
||||
|
||||
}
|
32
Random Corpses/media/lua/shared/trash_spawners.lua
Normal file
32
Random Corpses/media/lua/shared/trash_spawners.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
require "ScatteredStashes"
|
||||
|
||||
function scattered_trash(square)
|
||||
local roll = ZombRand(0,51)
|
||||
if roll > 12 then roll = roll + 3 end
|
||||
local sprite_type = tostring("trash_01_" .. tostring(roll))
|
||||
if not sprite_type then return end
|
||||
local newSprite = (IsoObject.new(getCell(), square, sprite_type));
|
||||
if not newSprite then
|
||||
print("NO NEW SPRITE!")
|
||||
return false
|
||||
end
|
||||
if newSprite and newSprite:getProperties() then
|
||||
if newSprite:getProperties():Val("ContainerType") or newSprite:getProperties():Val("container") then
|
||||
newSprite:createContainersFromSpriteProperties() --end
|
||||
|
||||
end
|
||||
end
|
||||
newSprite:getModData().forage = false
|
||||
square:getObjects():add(newSprite)
|
||||
square:RecalcProperties()
|
||||
square:getModData().specialSquare = true
|
||||
|
||||
newSprite:transmitCompleteItemToServer()
|
||||
newSprite:transmitCompleteItemToClients()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return newSprite
|
||||
end
|
Reference in New Issue
Block a user