加入榨汁机 冰棍盒,炒冰盒 厨具架小bug
This commit is contained in:
1 parent
a7b56aec7d
commit
9d12baf1b2
25 files changed
+354
-227
No files matched your search
+5
-21
@@ -277,11 +277,8 @@ class YouguoService(BlueFoxServerSystem):
|
||||
# ============================================================================
|
||||
|
||||
def giveItem(self, playerId, itemName, count=1, aux=0):
|
||||
try:
|
||||
itemDict = {"itemName": itemName, "count": count, "auxValue": aux}
|
||||
comp.CreateItem(playerId).SpawnItemToPlayerInv(itemDict, playerId)
|
||||
except Exception:
|
||||
pass
|
||||
""""给玩家物品": 统一走优先级(同类合并->主手->背包->掉落)"""
|
||||
self.giveItemToPlayer(playerId, itemName, count)
|
||||
|
||||
# ============================================================================
|
||||
# 六、工具方法,消耗物品
|
||||
@@ -312,24 +309,11 @@ class YouguoService(BlueFoxServerSystem):
|
||||
"""取成品/返容器: playerId 给出时【优先入包】—— 主手空->放主手;
|
||||
否则入背包(同类叠加/空位); 背包满(返回False)->落回地面掉落物。
|
||||
不传 playerId(无玩家上下文, 如破坏掉落) 保持原掉落物, 零影响。"""
|
||||
if playerId is not None:
|
||||
self.giveItemToPlayer(playerId, itemName, count, pos, dim)
|
||||
return
|
||||
try:
|
||||
itemDict = {"itemName": itemName, "count": count, "auxValue": aux}
|
||||
if playerId is not None:
|
||||
# 1) 主手空 -> 放主手
|
||||
cur = self.getCarriedItem(playerId)
|
||||
handItem = (cur or {}).get("newItemName")
|
||||
if not handItem or handItem == "minecraft:air":
|
||||
try:
|
||||
if comp.CreateItem(playerId).SpawnItemToPlayerCarried(itemDict, playerId):
|
||||
return
|
||||
except Exception:
|
||||
pass
|
||||
# 2) 否则入包(同类叠加/空位); 失败(满)->掉落
|
||||
try:
|
||||
if comp.CreateItem(playerId).SpawnItemToPlayerInv(itemDict, playerId):
|
||||
return
|
||||
except Exception:
|
||||
pass
|
||||
self.CreateEngineItemEntity(itemDict, dim, (pos[0], pos[1] + 0.5, pos[2]))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
Reference in new issue
Block a user