Jump to content

How do Generators Spawn?


Hydromancerx

Recommended Posts

From what I have seen of build 32, even on custom maps like Bedford Falls, Generators will spawn on the ground. How is this done? I looked in the normal loot spawn table and did not see any Generators listed. So where is the code that makes them spawn?

Link to comment
Share on other sites

It spawn in building type storageunit, garage and shed :)

 

I figured that's where, from experance in game, but when looking at the code I do not see it listed.

 

For example here for a storage unit.

    storageunit = {        all ={            rolls = 3,            items = {                "Base.Magazine", 2,                "Base.Newspaper", 2,                "Base.Lighter", 2,                "Base.BaseballBat", 5,                "Base.Cigarettes", 5,                "Base.Cigarettes", 5,                "farming.HandShovel", 3,                "Base.Vest", 2,                "Base.Shirt", 2,                "Base.Blouse", 2,                "Base.Trousers", 2,                "Base.Skirt", 2,                "Base.Shoes", 2,                "Base.Socks", 2,                "Base.Underwear1", 1,                "Base.Underwear2", 1,                "camping.CampingTentKit", 0.2,                "Base.DishCloth", 2,                "Base.Kettle", 3,                "farming.HandShovel", 2,                "farming.Shovel", 1,                "farming.WateredCan", 1,                "Base.Paintbrush", 1,                "Base.PaintBlue", 0.8,                "Base.PaintBrown", 0.8,                "Base.PaintCyan", 0.8,                "Base.PaintGreen", 0.8,                "Base.PaintGrey", 0.8,                "Base.PaintLightBlue", 0.8,                "Base.PaintLightBrown", 0.8,                "Base.PaintOrange", 0.8,                "Base.PaintPink", 0.8,                "Base.PaintPurple", 0.8,                "Base.PaintTurquoise",0.8,                "Base.PaintWhite", 0.8,                "Base.PaintYellow", 0.8,                "Base.PlasterPowder", 0.8,                "Base.BucketEmpty", 1,            },

So how is are they spawned on the floor?

Link to comment
Share on other sites

  • 1 year later...
  • 6 months later...

I do not know if this is out of date, generator is called a IsoGenerator object.


It can be like a building object.

function ISGenerator:create(x, y, z, north, sprite)
	local cell = getWorld():getCell();
	self.sq = cell:getGridSquare(x, y, z);
	self.javaObject = IsoGenerator.new(self.item, getCell(), self.sq)
	self.javaObject:setActivated(false);
	self.javaObject:setCondition(100);
	self.javaObject:setConnected(false);
	self.javaObject:setFuel(0);
	self.sq:AddSpecialObject(self.javaObject);
	buildUtil.consumeMaterial(self);
	self.javaObject:transmitCompleteItemToServer();
end

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...