掉落规则补全
This commit is contained in:
1 parent
ba44cc738f
commit
1df1e9291a
6 files changed
+70
-39
No files matched your search
+9
-4
@@ -174,9 +174,9 @@ class NaturalService(BlueFoxServerSystem):
|
||||
# 替换方块
|
||||
if recipe.get("target"):
|
||||
self.replaceBlock(pos, dim, recipe["target"], playerId)
|
||||
# 掉落物
|
||||
# 掉落物(任务一: 玩家主动获得 -> 统一优先级)
|
||||
if recipe.get("dropItem"):
|
||||
self.dropItems(dim, pos, recipe["dropItem"])
|
||||
self.dropItems(dim, pos, recipe["dropItem"], playerId)
|
||||
# 给背包物品
|
||||
if recipe.get("giveItem"):
|
||||
self.giveItem(playerId, recipe["giveItem"])
|
||||
@@ -251,14 +251,19 @@ class NaturalService(BlueFoxServerSystem):
|
||||
# 八、工具方法:以掉落物形式生成物品
|
||||
# ============================================================================
|
||||
|
||||
def dropItems(self, dim, pos, dropList):
|
||||
def dropItems(self, dim, pos, dropList, playerId=None):
|
||||
for d in dropList:
|
||||
itemDict = {
|
||||
"itemName": d["name"],
|
||||
"count": d.get("count", 1),
|
||||
"auxValue": d.get("aux", 0),
|
||||
}
|
||||
self.CreateEngineItemEntity(itemDict, dim, (pos[0], pos[1] + 0.5, pos[2]))
|
||||
if playerId is not None:
|
||||
# 任务一: 玩家主动获得 -> 统一优先级(同类合并->主手->背包->掉落)
|
||||
self.giveItemToPlayer(playerId, d["name"], d.get("count", 1), pos, dim,
|
||||
aux=d.get("aux", 0))
|
||||
else:
|
||||
self.CreateEngineItemEntity(itemDict, dim, (pos[0], pos[1] + 0.5, pos[2]))
|
||||
|
||||
# ============================================================================
|
||||
# 九、工具方法:冷却检查
|
||||
|
||||
Reference in new issue
Block a user