Jupiters Posted August 24, 2015 Share Posted August 24, 2015 Hello, @DarkXeroSorry to bother you. May I ask you an question?How to make meteor bring marble or other gems?Thanks very much. Link to comment Share on other sites More sharing options...
DarkXero Posted August 24, 2015 Share Posted August 24, 2015 @Jupiters:AddPrefabPostInit("shadowmeteor", function(inst) local function myexplode(inst) if inst:IsOnValidGround() then local extraloot = { marble = 0.4, redgem = 0.3, bluegem = 0.3, purplegem = 0.1, orangegem = 0.1, yellowgem = 0.1, greengem = 0.1, } for k, v in pairs(extraloot) do if math.random() <= v then local drop = GLOBAL.SpawnPrefab(k) if drop ~= nil then local x, y, z = inst.Transform:GetWorldPosition() drop.Transform:SetPosition(x, y, z) if drop.components.inventoryitem ~= nil then drop.components.inventoryitem:OnDropped(true) end end end end end end local function mystrike(inst) inst.mystriketask = nil inst:DoTaskInTime(0.33, myexplode) end local _SetSize = inst.SetSize inst.SetSize = function(inst, sz, mod) _SetSize(inst, sz, mod) inst.mystriketask = inst:DoTaskInTime(1.1, mystrike) endend) Link to comment Share on other sites More sharing options...
Jupiters Posted August 25, 2015 Author Share Posted August 25, 2015 @DarkXeroThanks, what do the numbers after "=" mean? The probability of dropping these items in every meteor? Link to comment Share on other sites More sharing options...
DarkXero Posted August 25, 2015 Share Posted August 25, 2015 @Jupiters, correct. Link to comment Share on other sites More sharing options...
Jupiters Posted August 25, 2015 Author Share Posted August 25, 2015 @DarkXeroMuch appreciated. Hum.......I have another idea in my mind. How to make the turfs such as carpeted turf have more functions. For instance, it can gain heat and keep warn in winter, it can gain sanity when night, or it can proof the rain, etc. Link to comment Share on other sites More sharing options...
DarkXero Posted August 25, 2015 Share Posted August 25, 2015 @Jupiters:if not GLOBAL.TheNet:GetIsServer() then returnend-- Gives 30 insulation for Winter, -30 insulation for Summer-- Winter insulation delays freezing, Summer insulation delays overheating-- The closer to 0, the quicker the freezing/overheating comesAddComponentPostInit("temperature", function(self) local _GetInsulation = self.GetInsulation self.GetInsulation = function(self) local winterInsulation, summerInsulation = _GetInsulation(self) local tile, data = self.inst:GetCurrentTileType() if tile == GLOBAL.GROUND.CARPET then winterInsulation = winterInsulation + 30 summerInsulation = summerInsulation - 30 end return math.max(0, winterInsulation), math.max(0, summerInsulation) endend)-- Standing on a carpet during the night only is like wearing a top hatAddPlayerPostInit(function(inst) if inst.components.sanity then local _crfn = inst.components.sanity.custom_rate_fn inst.components.sanity.custom_rate_fn = function(inst) local ret = 0 if _crfn then ret = _crfn(inst) end if GLOBAL.TheWorld.state.isnight then local tile, data = inst:GetCurrentTileType() if tile == GLOBAL.GROUND.CARPET then local carpet_delta = GLOBAL.TUNING.DAPPERNESS_MED ret = ret + carpet_delta end end return ret end endend)-- Things with moisture stay dry when standing on carpetAddComponentPostInit("moisture", function(self) local _GetMoistureRate = self.GetMoistureRate self.GetMoistureRate = function(self) local tile, data = self.inst:GetCurrentTileType() if tile == GLOBAL.GROUND.CARPET then return 0 end return _GetMoistureRate(self) endend)entity:GetCurrentTileType() does the trick. Link to comment Share on other sites More sharing options...
Jupiters Posted August 26, 2015 Author Share Posted August 26, 2015 @DarkXeroThx very much.It seems that it cannot insulate heat when summer. Link to comment Share on other sites More sharing options...
DarkXero Posted August 26, 2015 Share Posted August 26, 2015 @Jupiters, well, duh, look again: winterInsulation = winterInsulation + 30 summerInsulation = summerInsulation - 30 -- <-- Link to comment Share on other sites More sharing options...
Jupiters Posted August 26, 2015 Author Share Posted August 26, 2015 @DarkXeroOooooooooooh, I see....... Â Link to comment Share on other sites More sharing options...
Jupiters Posted August 26, 2015 Author Share Posted August 26, 2015 @DarkXeroHow to make the carpet not covered by snow when winter and keep dry when rain(it seems that the carpet is wet as is looked.). Link to comment Share on other sites More sharing options...
DarkXero Posted August 26, 2015 Share Posted August 26, 2015 @Jupiters, that can't be done.The entire map gets a snow/mud overlay over it when it snows/rains, so you can't intercept it for special tiles. Link to comment Share on other sites More sharing options...
Jupiters Posted August 27, 2015 Author Share Posted August 27, 2015 @DarkXeroAlright, thank you. Link to comment Share on other sites More sharing options...
Jupiters Posted August 28, 2015 Author Share Posted August 28, 2015 @DarkXero, how can make people who stand on these floor move fast like standing on cobblestones? Link to comment Share on other sites More sharing options...
DarkXero Posted August 29, 2015 Share Posted August 29, 2015 @Jupiters:AddComponentPostInit("locomotor", function(self) if self.inst:HasTag("player") then local _UGSM = self.UpdateGroundSpeedMultiplier self.UpdateGroundSpeedMultiplier = function(self) _UGSM(self) local tile, data = self.inst:GetCurrentTileType() if tile == GLOBAL.GROUND.CARPET then if self.carpetfast == nil then self:SetExternalSpeedMultiplier(self.inst, "CarpetSpeed", 1.5) self.carpetfast = true end else if self.carpetfast == true then self:RemoveExternalSpeedMultiplier(self.inst, "CarpetSpeed") self.carpetfast = nil end end end endend) 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