78 lines
2.2 KiB
Lua
78 lines
2.2 KiB
Lua
---@class BP_SupplyItem_C:BP_CustomItemBase_C
|
|
---@field ParticleSystem UParticleSystemComponent
|
|
---@field StaticMesh UStaticMeshComponent
|
|
---@field ItemSize float
|
|
--Edit Below--
|
|
|
|
---@type BP_CustomItemBase_C
|
|
local ItemBase = require('Script.Blueprint/SceneObj/PickUp/BP_CustomItemBase')
|
|
|
|
---@type BP_SupplyItem_C
|
|
local BP_SupplyItem = ItemBase:new(DefaultSettings.SceneObj.Supply);
|
|
|
|
function BP_SupplyItem:ReceiveBeginPlay()
|
|
self:LuaInit();
|
|
end
|
|
|
|
---@param InPawn UGCPlayerPawn_C
|
|
function BP_SupplyItem:OnPlayerAddItem(InPawn)
|
|
local InType = self:GetSupplyType();
|
|
UGCLogSystem.Log("[BP_SupplyItem:OnPlayerAddItem] InType = %s", tostring(InType))
|
|
if ItemTable.DirectUseSupplyItem(InPawn, InType) then self:OnItemUsed(InPawn); end
|
|
end
|
|
|
|
function BP_SupplyItem:RandomNewItem()
|
|
self:SetItemId(SupplyItems[math.random(#SupplyItems)].ItemId);
|
|
end
|
|
|
|
function BP_SupplyItem:OnRep_ItemId()
|
|
UGCLogSystem.Log("[BP_SupplyItem:OnRep_ItemId] ItemId = %s", tostring(self.ItemId));
|
|
self:HandleEffect(self.ParticleSystem, "SceneObj_Supply");
|
|
self.CachedItemId = self.ItemId;
|
|
if self.ItemId == 0 then
|
|
self.StaticMesh:SetStaticMesh(nil);
|
|
return;
|
|
end
|
|
UGCLogSystem.Log("[BP_SupplyItem:OnRep_ItemId] ItemId = %d", self:GetItemId())
|
|
local Path = ItemTable.AllItem[self:GetItemId()].StaticMesh;
|
|
UGCLogSystem.Log("[BP_SupplyItem:OnRep_ItemId] Path = %s", tostring(Path))
|
|
if Path == nil then return end
|
|
UE.AsyncLoadObject(Path, function(Obj) self.StaticMesh:SetStaticMesh(Obj); end)
|
|
end
|
|
|
|
---@return ESupplyType
|
|
function BP_SupplyItem:GetSupplyType()
|
|
for i, v in pairs(SupplyItems) do
|
|
if v.ItemId == self.ItemId then return i; end
|
|
end
|
|
return nil;
|
|
end
|
|
|
|
function BP_SupplyItem:ReceiveTick(DeltaTime)
|
|
self.SuperClass.ReceiveTick(self, DeltaTime);
|
|
if IsClient then
|
|
if self.StaticMesh.StaticMesh ~= nil then
|
|
self.StaticMesh:K2_AddWorldRotation(VectorHelper.VecToRot(VectorHelper.MakeVector(0, 0, DeltaTime * self.RotationLength)));
|
|
end
|
|
end
|
|
end
|
|
|
|
--[[
|
|
function BP_SupplyItem:ReceiveEndPlay()
|
|
self.SuperClass.ReceiveEndPlay(self);
|
|
end
|
|
--]]
|
|
|
|
--[[
|
|
function BP_SupplyItem:GetReplicatedProperties()
|
|
return
|
|
end
|
|
--]]
|
|
|
|
--[[
|
|
function BP_SupplyItem:GetAvailableServerRPCs()
|
|
return
|
|
end
|
|
--]]
|
|
|
|
return BP_SupplyItem; |