代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。

原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html



二六四.风力滑板车(饥荒世界陆上交通工具)

	用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/umbrella.lua文件,

	1.将下列内容:

local function onequip(inst, owner) 
	owner.AnimState:OverrideSymbol("swap_object", "swap_umbrella", "swap_umbrella")
	owner.AnimState:Show("ARM_carry")
	owner.AnimState:Hide("ARM_normal")
	UpdateSound(inst)
	
	owner.DynamicShadow:SetSize(2.2, 1.4)

	inst.components.fueled:StartConsuming()
end

local function onunequip(inst, owner) 
	owner.AnimState:Hide("ARM_carry") 
	owner.AnimState:Show("ARM_normal") 
	UpdateSound(inst)

	owner.DynamicShadow:SetSize(1.3, 0.6)

	inst.components.fueled:StopConsuming()
end

	替换为:

local function onequip(inst, owner) 
	owner.AnimState:OverrideSymbol("swap_object", "swap_umbrella", "swap_umbrella")
	owner.AnimState:Show("ARM_carry")
	owner.AnimState:Hide("ARM_normal")
	UpdateSound(inst)
	inst.task = inst:DoPeriodicTask(.01, function() owner.Physics:SetMotorVelOverride(20,0,0) end)
	inst.fire = SpawnPrefab( "telebase" )
	inst.fire.Physics:SetActive(false)
	local follower = inst.fire.entity:AddFollower()
	follower:FollowSymbol( owner.GUID, "swap_object", -90, 130, 0 )
end
local function onunequip(inst, owner) 
	owner.AnimState:Hide("ARM_carry") 
	owner.AnimState:Show("ARM_normal") 
	UpdateSound(inst)
	if inst.task then inst.task:Cancel() inst.task = nil end
	inst.fire:Remove()
	inst.fire = nil
end


	2.在inst.components.fueled:SetDepletedFn(onperish)的下一行插入inst:AddComponent("blinkstaff")

	即可在装备雨伞时,脚下踩着滑板自动行驶,伞就是你的风帆,卸载雨伞后停下。鼠标左键点地可以控制方向(也可以用键盘W、S、A、D键控制方向),鼠标右键点地可以瞬移(用以跳过障碍),有空儿去兜兜风吧。雨伞在生存选项(画着绳套)下,用6个树枝、1个猪皮、2个蛛丝制造