初级玩家

- 贡献度
- 0
- 金元
- 975
- 积分
- 98
- 精华
- 0
- 注册时间
- 2013-10-27
|
本帖最后由 Brainos 于 2014-1-25 11:10 编辑
陈浩洋 发表于 2014-1-25 10:09 
宁哥,如果你有时间的话可不可以做一个克隆机啊,可以把鸟的羽毛,兔人尾巴,蜂刺,蚊子血囊等等的物品放入 ...
仿照全自动播种机我做了一个克隆机,打开data\scripts\prefabs\feathers.lua,在inst:AddComponent("inspectable")的下一行插入inst:AddComponent("tradable")
2,打开data\scripts\prefabs\manrabbit_tail.lua,在inst:AddComponent("inspectable")的下一行插入inst:AddComponent("tradable")
3,打开data\scripts\prefabs\stinger.lua,在inst:AddComponent("inspectable")的下一行插入inst:AddComponent("tradable")
4,打开data\scripts\prefabs\honey.lua,在inst:AddComponent("inspectable")的下一行插入inst:AddComponent("tradable")
5,打开data\scripts\prefabs\mosquitosack.lua,在inst:AddComponent("inspectable")的下一行插入inst:AddComponent("tradable")
6,打开data\scripts\prefabs\froglegs.lua,在inst:AddComponent("inspectable")的下一行插入inst:AddComponent("tradable")
7,打开data\scripts\prefabs\spidergland.lua,在inst:AddComponent("inspectable")的下一行插入inst:AddComponent("tradable")
8,打开data\scripts\prefabs\pigskin.lua,在inst:AddComponent("inspectable")的下一行插入inst:AddComponent("tradable")
9,打开data\scripts\prefabs\horn.lua,在inst:AddComponent("inspectable")的下一行插入inst:AddComponent("tradable")
10,打开data\scripts\prefabs\eyeturret.lua,在第二个inst:AddComponent("inspectable")的下一行插入
local function ShouldAcceptItem(inst, item)
local player = GetPlayer()
if player.components.inventory:Has("goldnugget", 25) then
if item.prefab == "feather_crow" then
return true
end
end
if player.components.inventory:Has("goldnugget", 25) then
if item.prefab == "feather_robin" then
return true
end
end
if player.components.inventory:Has("goldnugget", 25) then
if item.prefab == "feather_robin_winter" then
return true
end
end
if player.components.inventory:Has("goldnugget", 25) then
if item.prefab == "manrabbit_tail" then
return true
end
end
if player.components.inventory:Has("goldnugget", 25) then
if item.prefab == "stinger" then
return true
end
end
if player.components.inventory:Has("goldnugget", 25) then
if item.prefab == "honey" then
return true
end
end
if player.components.inventory:Has("goldnugget", 25) then
if item.prefab == "mosquitosack" then
return true
end
end
if player.components.inventory:Has("goldnugget", 25) then
if item.prefab == "froglegs" then
return true
end
end
if player.components.inventory:Has("goldnugget", 25) then
if item.prefab == "spidergland" then
return true
end
end
if player.components.inventory:Has("goldnugget", 25) then
if item.prefab == "pigskin" then
return true
end
end
if player.components.inventory:Has("goldnugget", 25) then
if item.prefab == "horn" then
return true
end
end
return false
end
local function OnGetItemFromPlayer(inst, giver, item)
giver.components.inventory:ConsumeByName("goldnugget", 50)
if item.prefab == "feather_crow" then
inst.name = "crow"
end
if item.prefab == "feather_robin" then
inst.name = "robin"
end
if item.prefab == "feather_robin_winter" then
inst.name = "robin_winter"
end
if item.prefab == "manrabbit_tail" then
inst.name = "bunnyman"
end
if item.prefab == "stinger" then
inst.name = "killerbee"
end
if item.prefab == "honey" then
inst.name = "bee"
end
if item.prefab == "mosquitosack" then
inst.name = "mosquito"
end
if item.prefab == "froglegs" then
inst.name = "frog"
end
if item.prefab == "spidergland" then
inst.name = "spider"
end
if item.prefab == "pigskin" then
inst.name = "pigman"
end
if item.prefab == "horn" then
inst.name = "beefalo"
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
end)
return true
end
inst:AddComponent("trader")
inst.components.trader.onaccept = OnGetItemFromPlayer
inst.components.trader:SetAcceptTest(ShouldAcceptItem)
即可把各色羽毛、兔人尾巴、蜂刺、蜂蜜、蚊子血囊、蛙腿、蜘蛛腺体、猪皮、牛角给远古守护者(炮塔),分别克隆出各色鸟、兔人、杀人蜂、蜜蜂、蚊子、青蛙、普通蜘蛛、猪人、牛,每次克隆消耗25黄金。
|
|