Added Project Files

Added all files from the project and edited the readme.md
This commit is contained in:
2025-09-18 00:51:59 +01:00
parent afd7535bf3
commit 63f78c2b8e
17 changed files with 531 additions and 2 deletions

View File

@@ -0,0 +1,33 @@
require "Movables/ISMovableSpriteProps"
function ISMoveableSpriteProps:instanceItem(_spriteNameOverride)
if self.isMoveable then
local item;
if self.customItem then
item = instanceItem(self.customItem);
else
if self.isMultiSprite then
item = instanceItem("Moveables.Moveable");
else
item = instanceItem("Moveables."..self.spriteName);
end
--item = instanceItem("Moveables."..self.spriteName); --instanceItem("Moveables.Moveable");
end
local spriteName = _spriteNameOverride or self.spriteName;
if self.type == "Window" then -- Some corrections
if not self.spriteProps:Is("SmashedTileOffset") or self.spriteProps:Val("SmashedTileOffset") == 0 then
return nil; -- cant instance broken windows
end
elseif self.type == "WindowObject" and self.isClosedState then
spriteName = self.sheetName .. tostring(self.spriteID+4);
end
if self.customItem then
item:setActualWeight(self.weight);
return item;
elseif item and item:ReadFromWorldSprite(spriteName) then
item:setActualWeight(self.weight);
return item;
end
end
end

View File

@@ -0,0 +1,39 @@
require "Movables/ISMoveableSpriteProps"
local old_ISMoveableSpriteProps_instanceItem = ISMoveableSpriteProps.instanceItem
function ISMoveableSpriteProps:instanceItem(_spriteNameOverride)
--local spriteName = _spriteNameOverride or self.spriteName
if self.isMoveable then
local item;
if self.customItem then
item = instanceItem(self.customItem);
else
if self.isMultiSprite then
item = instanceItem("Moveables.Moveable");
else
item = instanceItem("Moveables."..self.spriteName);
end
--item = instanceItem("Moveables."..self.spriteName); --instanceItem("Moveables.Moveable");
end
local spriteName = _spriteNameOverride or self.spriteName;
if self.type == "Window" then -- Some corrections
if not self.spriteProps:Is("SmashedTileOffset") or self.spriteProps:Val("SmashedTileOffset") == 0 then
return nil; -- cant instance broken windows
end
elseif self.type == "WindowObject" and self.isClosedState then
spriteName = self.sheetName .. tostring(self.spriteID+4);
end
--print("SPRITE NAME - " .. tostring(spriteName))
if item
--and item:ReadFromWorldSprite(spriteName)
then
item:setActualWeight(self.weight);
return item;
end
end
end

View File

@@ -0,0 +1,34 @@
local function trashSquare_Hook(square)
--print("HOOK")
local mData = square:getModData()
if mData.trashSquare then return end
if mData.specialSquare then return end
-- trashSquare(square)
-- if not isClient then
-- trashSquare(square)
-- else
-- local player = getPlayer()
-- -- print("Sending trash call to server! - " .. tostring(player))
-- sendClientCommand( player, "PA_Trash", "Spawn", {
-- x = square:getX(), y = square:getY(), z = square:getZ()
-- })
-- end
if isClient == true then
local player = getPlayer(0)
-- print("Sending trash call to server! - " .. tostring(player))
sendClientCommand( player, "PA_Trash", "Spawn", {
x = square:getX(), y = square:getY(), z = square:getZ()
})
return
end
trashSquare(square)
-- end
end
Events.LoadGridsquare.Add(trashSquare_Hook) -- every time a grid square is loaded, checks for any vehicle spawn list entries

View File

@@ -0,0 +1,9 @@
require "Items/Distributions"
require "Items/ProceduralDistributions"
require "Vehicles/VehicleDistributions"
SuburbsDistributions["all"]["Trash"] = SuburbsDistributions["all"]["bin"]
SuburbsDistributions["all"]["TrashPaper"] = SuburbsDistributions["all"]["filingcabinet"]

View File

@@ -0,0 +1,31 @@
-- this method was copied from the excellent Skateboard mod by Dislaik https://steamcommunity.com/sharedfiles/filedetails/?id=2728300240
-- I considered making new code from scratch, albeit I would still be "copying their homework", but decided against, for the sake of ease of comprehension + conistency
if not isServer() then return end
local Commands = {}
Commands.PA_Trash = {}
Commands.PA_Trash.Spawn = function(origin, args)
-- print("Trash command recieved " .. tostring(origin) .. " - " .. tostring(args))
local cell = origin:getCell()
-- if not cell then print("No cell!") return end
local x = args.x
local y = args.y
local z = args.z
-- print("Trash command recieved " .. tostring(origin) .. " - " .. tostring(cell) .. " - " .. tostring(args))
-- print("Trash command recieved " .. tostring(x) .. " - " .. tostring(y) .. " - " .. tostring(z))
local square = cell:getGridSquare(x, y, z) or cell:getOrCreateGridSquare( x, y, x)
-- local square = args.square
-- if not square then print("No square!") return end
-- print("Recieved trash call from client -" .. tostring(origin) .. " - " .. tostring(square))
trashSquare(square)
end
local onClientCommand = function(module, command, player, args)
if Commands[module] and Commands[module][command] then
Commands[module][command](player, args)
end
end
Events.OnClientCommand.Add(onClientCommand)

View File

@@ -0,0 +1,69 @@
require "Camping/camping_fuel"
----------------------- Add Fuel for Campfire -----------------------
local i = 0
while i < 54 do
local trash = ("trash_01_" .. (tostring(i)))
campingFuelType[trash]= 15.0/60
campingLightFireType[trash]= 15.0/60
i = i +1
end
-- campingFuelType.trash_01_0 = 5.0/60
-- campingFuelType["trash_01_0"] = 5.0/60
-- campingFuelType.trash_01_1 = 5.0/60
-- campingFuelType["trash_01_1"] = 5.0/60
-- campingFuelType.trash_01_2 = 5.0/60
-- campingFuelType["trash_01_2"] = 5.0/60
-- campingFuelType.trash_01_3 = 5.0/60
-- campingFuelType["trash_01_3"] = 5.0/60
-- campingFuelType.trash_01_4 = 5.0/60
-- campingFuelType["trash_01_4"] = 5.0/60
-- campingFuelType.trash_01_5 = 5.0/60
-- campingFuelType["trash_01_5"] = 5.0/60
-- campingFuelType.trash_01_6 = 5.0/60
-- campingFuelType["trash_01_6"] = 5.0/60
-- campingFuelType.trash_01_7 = 5.0/60
-- campingFuelType["trash_01_7"] = 5.0/60
-- campingFuelType.trash_01_8 = 5.0/60
-- campingFuelType["trash_01_8"] = 5.0/60
-- campingFuelType.trash_01_9 = 5.0/60
-- campingFuelType["trash_01_9"] = 5.0/60
-- campingFuelType.trash_01_10 = 5.0/60
-- campingFuelType["trash_01_10"] = 5.0/60
-- campingFuelType.trash_01_11 = 5.0/60
-- campingFuelType["trash_01_11"] = 5.0/60
-- ----------------------- Add Starter for Campfire -----------------------
-- campingLightFireType.trash_01_0 = 5.0/60
-- campingLightFireType["trash_01_0"] = 5.0/60
-- campingLightFireType.trash_01_1 = 5.0/60
-- campingLightFireType["trash_01_1"] = 5.0/60
-- campingLightFireType.trash_01_2 = 5.0/60
-- campingLightFireType["trash_01_2"] = 5.0/60
-- campingLightFireType.trash_01_3 = 5.0/60
-- campingLightFireType["trash_01_3"] = 5.0/60
-- campingLightFireType.trash_01_4 = 5.0/60
-- campingLightFireType["trash_01_4"] = 5.0/60
-- campingLightFireType.trash_01_5 = 5.0/60
-- campingLightFireType["trash_01_5"] = 5.0/60
-- campingLightFireType.trash_01_6 = 5.0/60
-- campingLightFireType["trash_01_7"] = 5.0/60
-- campingLightFireType.trash_01_1 = 5.0/60
-- campingLightFireType["trash_01_1"] = 5.0/60
-- campingLightFireType.trash_01_1 = 5.0/60
-- campingLightFireType["trash_01_1"] = 5.0/60
-- campingLightFireType.trash_01_1 = 5.0/60
-- campingLightFireType["trash_01_1"] = 5.0/60
-- campingLightFireType.trash_01_1 = 5.0/60
-- campingLightFireType["trash_01_1"] = 5.0/60
-- campingLightFireType.trash_01_11 = 5.0/60
-- campingLightFireType["trash_01_11"] = 5.0/60

View File

@@ -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

View 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

View 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

View File

@@ -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

View File

@@ -0,0 +1,10 @@
IGUI_EN = {
-- All the UI text used in game
-- InventoryPane
IGUI_ContainerTitle_Trash = "Trash",
IGUI_ContainerTitle_TrashPaper = "Scattered Papers",
}

View 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

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

6
Random Corpses/mod.info Normal file
View File

@@ -0,0 +1,6 @@
name=Random Corpses
poster=poster.png
id=Random Corpses
description=
url=
tiledef=scattered_trashes 951