游戏达人
  
- 贡献度
- 80
- 金元
- 18947
- 积分
- 2225
- 精华
- 1
- 注册时间
- 2010-11-27
|
本帖最后由 yzzn2009 于 2013-11-8 13:50 编辑
Mue战天。 发表于 2013-11-8 13:17 
我想修改自动播种机种岩石,你说可不可以种出来呢,
草、树杈、木头、岩石等材料太容易得到,都能交换黄金的话,会导致通货膨胀,家里装着一大堆黄金,会使交易失去乐趣。
全自动播种机(给避雷针草、树枝、芦苇种三石头)
1.用记事本打开游戏目录\data\scripts\prefabs\cutgrass.lua文件,在inst:AddComponent("inspectable")的下一行插入inst:AddComponent("tradable")
2.用记事本打开游戏目录\data\scripts\prefabs\twigs.lua文件,在inst:AddComponent("inspectable")的下一行插入inst:AddComponent("tradable")
3.用记事本打开游戏目录\data\scripts\prefabs\cutreeds.lua文件,在inst:AddComponent("inspectable")的下一行插入inst:AddComponent("tradable")
4.用记事本打开游戏目录\data\scripts\prefabs\lightningrod.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:
local function ShouldAcceptItem(inst, item)
local player = GetPlayer()
if player.components.inventory:Has("goldnugget", 50) then
if item.prefab == "cutgrass" then
return true
end
end
if player.components.inventory:Has("goldnugget", 50) then
if item.prefab == "twigs" then
return true
end
end
if player.components.inventory:Has("goldnugget", 50) then
if item.prefab == "cutreeds" then
return true
end
end
return false
end
local function OnGetItemFromPlayer(inst, giver, item)
giver.components.inventory:ConsumeByName("goldnugget", 50)
if item.prefab == "cutgrass" then
inst.name = "rock_flintless"
end
if item.prefab == "twigs" then
inst.name = "rock1"
end
if item.prefab == "cutreeds" then
inst.name = "rock2"
end
local pt = Vector3(inst.Transform:GetWorldPosition())
inst:StartThread(function()
for k = 1, 25 do
local theta = 1 * 2 * PI
local radius = 4
local result_offset = FindValidPositionByFan(theta, radius, 25, function(offset)
local x,y,z = (pt + offset):Get()
local ents = TheSim:FindEntities(x,y,z , 1)
return not next(ents)
end)
if result_offset then
local tentacle = SpawnPrefab(inst.name)
tentacle.Transform:SetPosition((pt + result_offset):Get())
GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40)
local fx = SpawnPrefab("splash_ocean")
local pos = pt + result_offset
fx.Transform:SetPosition(pos.x, pos.y, pos.z)
end
Sleep(.33)
end
for k = 1, 37 do
local theta = 1 * 2 * PI
local radius = 6
local result_offset = FindValidPositionByFan(theta, radius, 37, function(offset)
local x,y,z = (pt + offset):Get()
local ents = TheSim:FindEntities(x,y,z , 1)
return not next(ents)
end)
if result_offset then
local tentacle = SpawnPrefab(inst.name)
tentacle.Transform:SetPosition((pt + result_offset):Get())
GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40)
local fx = SpawnPrefab("splash_ocean")
local pos = pt + result_offset
fx.Transform:SetPosition(pos.x, pos.y, pos.z)
end
Sleep(.23)
end
for k = 1, 50 do
local theta = 1 * 2 * PI
local radius = 8
local result_offset = FindValidPositionByFan(theta, radius, 50, function(offset)
local x,y,z = (pt + offset):Get()
local ents = TheSim:FindEntities(x,y,z , 1)
return not next(ents)
end)
if result_offset then
local tentacle = SpawnPrefab(inst.name)
tentacle.Transform:SetPosition((pt + result_offset):Get())
GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40)
local fx = SpawnPrefab("splash_ocean")
local pos = pt + result_offset
fx.Transform:SetPosition(pos.x, pos.y, pos.z)
end
Sleep(.13)
end
end)
return true
end
inst:AddComponent("trader")
inst.components.trader.onaccept = OnGetItemFromPlayer
inst.components.trader:SetAcceptTest(ShouldAcceptItem)
|
|