summary refs log tree commit diff
diff options
context:
space:
mode:
authorSingustromo <singustromo@disroot.org>2024-03-06 14:04:05 +0100
committerSingustromo <singustromo@disroot.org>2024-03-06 14:04:05 +0100
commit2da9c5c5ab1236701113025a5c6a59e62d2c810c (patch)
treea4c172eb385a593ff5b0deb616934d5a94812f8d
parente25612e78660d514769701e8dcf6b4fb93ffa673 (diff)
downloadrevised-ammo-maker-2da9c5c5ab1236701113025a5c6a59e62d2c810c.tar.gz
revised-ammo-maker-2da9c5c5ab1236701113025a5c6a59e62d2c810c.zip
Parts on corpses: Streamlined logic
-rw-r--r--src/10 - Ammo Parts drop on corpses/gamedata/scripts/death_manager_monkey_ammo_parts.script32
1 files changed, 13 insertions, 19 deletions
diff --git a/src/10 - Ammo Parts drop on corpses/gamedata/scripts/death_manager_monkey_ammo_parts.script b/src/10 - Ammo Parts drop on corpses/gamedata/scripts/death_manager_monkey_ammo_parts.script
index 567d056..85df7eb 100644
--- a/src/10 - Ammo Parts drop on corpses/gamedata/scripts/death_manager_monkey_ammo_parts.script
+++ b/src/10 - Ammo Parts drop on corpses/gamedata/scripts/death_manager_monkey_ammo_parts.script
@@ -19,30 +19,24 @@ if not (parent and parent.version >= 20240110) then return end
 item_count = death_manager.item_count
 item_by_community = death_manager.item_by_community 
 
-Create_item_list = death_manager.create_item_list
-
+CreateItemList = death_manager.create_item_list
 death_manager.create_item_list = function(
         npc, npc_comm, npc_rank, is_private, to_save)
 
-        Create_item_list(npc, npc_comm, npc_rank, is_private, to_save)
+        CreateItemList(npc, npc_comm, npc_rank, is_private, to_save)
         
-        -- Get correct section
         local spawn_section
-	if is_private then
-		local sect = npc_comm .. "_private_" .. npc_rank
-		if item_by_community[sect] then
-			spawn_section = sect
-		elseif item_by_community[character_community(npc) .. "_private"] then
-			spawn_section = character_community(npc) .. "_private"
-		end
-	else
-		local sect = npc_comm .. "_" .. npc_rank
-		if item_by_community[sect] then
-			spawn_section = sect
-		elseif item_by_community[character_community(npc)] then
-			spawn_section = character_community(npc)
-		end
-	end
+
+        -- Get correct section
+        local sect = string.format("%s%s%s", npc_comm, (is_private and "_private_" or "_"), npc_rank)
+        local community = character_community(npc)
+        community = (is_private) and community .. "_private" or community
+
+        if item_by_community[sect] then
+                spawn_section = sect
+        elseif item_by_community[community] then
+                spawn_section = community
+        end
 	
 	if not spawn_section then
 		printdbg("! death_manager | no item spawn list for npc with community (%s) rank (%s)", npc_comm, npc_rank)