[Scummvm-git-logs] scummvm master -> 2556e4d9360e645f0415bade468ea30b5915644f

dreammaster noreply at scummvm.org
Tue Mar 14 03:40:34 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2556e4d936 NUVIE: Fix Ultima 6 throwing weapon auto-ready


Commit: 2556e4d9360e645f0415bade468ea30b5915644f
    https://github.com/scummvm/scummvm/commit/2556e4d9360e645f0415bade468ea30b5915644f
Author: PushmePullyu (127053144+PushmePullyu at users.noreply.github.com)
Date: 2023-03-13T20:40:30-07:00

Commit Message:
NUVIE: Fix Ultima 6 throwing weapon auto-ready

Remove thrown weapons from the inventory first instead of the hands
so they stay readied.

Fixes #12534

Changed paths:
    devtools/create_ultima/files/ultima6/scripts/u6/actor.lua


diff --git a/devtools/create_ultima/files/ultima6/scripts/u6/actor.lua b/devtools/create_ultima/files/ultima6/scripts/u6/actor.lua
index 2ff0e6300b1..6d020bd57fe 100644
--- a/devtools/create_ultima/files/ultima6/scripts/u6/actor.lua
+++ b/devtools/create_ultima/files/ultima6/scripts/u6/actor.lua
@@ -1616,13 +1616,25 @@ function combat_range_weapon_1D5F9(attacker, target_x, target_y, target_z, foe,
    elseif weapon_obj_n == 0x24 or weapon_obj_n == 0x25 or weapon_obj_n == 0x26 then
       --spear, throwing axe, dagger
 
-      if Actor.inv_remove_obj_qty(attacker, weapon_obj_n, 1) == 1 and map_is_water(target_x,target_y,target_z) == false then
-	      local obj = Obj.new(weapon_obj_n);
-	      obj.ok_to_take = true
-	      obj.temporary = true
-		  Obj.moveToMap(obj, target_x, target_y, target_z)
-	  end
-
+      --remove unreadied throwing weapons from inventory first so weapon stays readied
+      local removal_candidate = nil
+      for inv_obj in actor_inventory(attacker) do
+          if inv_obj.obj_n == weapon_obj_n then
+              removal_candidate = inv_obj
+              if removal_candidate.readied ~= true then
+                  break
+              end
+          end
+      end
+      if removal_candidate ~= nil then
+          Actor.inv_remove_obj(attacker, removal_candidate)
+          if map_is_water(target_x,target_y,target_z) == false then
+              local obj = Obj.new(weapon_obj_n);
+              obj.ok_to_take = true
+              obj.temporary = true
+              Obj.moveToMap(obj, target_x, target_y, target_z)
+          end
+      end
    elseif weapon_obj_n == 0x29 or weapon_obj_n == 0x2a or weapon_obj_n == 0x32 or weapon_obj_n == 0x36 then
       --bow, crossbow, triple crossbow, magic bow
       local projectile_obj = nil




More information about the Scummvm-git-logs mailing list