fix(bridge): the three members the rig corrected — crafter owner, mission assignee, heal target
All checks were successful
PR Checks / plugin-checks (pull_request) Successful in -1m28s
All checks were successful
PR Checks / plugin-checks (pull_request) Successful in -1m28s
Compiled on both rigs (2026-09-29): ItemCraftTask has no owner, so the crafter is ItemCrafter.owner; OnMissionSucceeded credits its third argument, the assignee, since MissionInstance has no accessor for it; OnHealingItemUse takes its target as object, because GiveEffectsTo now takes an IMedicalToolTarget, and counts only a player. GameObject.ToBaseEntity is not in scope for a plugin, so OnEntityBuilt asks GetComponent<BuildingBlock>(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
@@ -1959,12 +1959,16 @@ namespace Oxide.Plugins
|
|||||||
tally.HeliKills++;
|
tally.HeliKills++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>No return behaviour. A crafted shirt, rifle or anything else, by its item category.</summary>
|
/// <summary>
|
||||||
|
/// No return behaviour. A crafted shirt, rifle or anything else, by its item category.
|
||||||
|
/// Who crafted it is the crafter's owner: the task no longer carries one (read off the
|
||||||
|
/// rig, 2026-09-29).
|
||||||
|
/// </summary>
|
||||||
private void OnItemCraftFinished(ItemCraftTask task, Item item, ItemCrafter crafter)
|
private void OnItemCraftFinished(ItemCraftTask task, Item item, ItemCrafter crafter)
|
||||||
{
|
{
|
||||||
MarkHook("OnItemCraftFinished");
|
MarkHook("OnItemCraftFinished");
|
||||||
|
|
||||||
BasePlayer player = task != null ? task.owner : null;
|
BasePlayer player = crafter != null ? crafter.owner : null;
|
||||||
|
|
||||||
if (player == null || player.IsNpc || item == null || item.info == null)
|
if (player == null || player.IsNpc || item == null || item.info == null)
|
||||||
return;
|
return;
|
||||||
@@ -1979,7 +1983,7 @@ namespace Oxide.Plugins
|
|||||||
|
|
||||||
BasePlayer player = planner != null ? planner.GetOwnerPlayer() : null;
|
BasePlayer player = planner != null ? planner.GetOwnerPlayer() : null;
|
||||||
|
|
||||||
if (player == null || player.IsNpc || go == null || !(go.ToBaseEntity() is BuildingBlock))
|
if (player == null || player.IsNpc || go == null || go.GetComponent<BuildingBlock>() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TallyFor(player).Built++;
|
TallyFor(player).Built++;
|
||||||
@@ -2019,13 +2023,21 @@ namespace Oxide.Plugins
|
|||||||
private int _reviveFrame = -1;
|
private int _reviveFrame = -1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Void: a non-null return refuses the heal. <paramref name="player"/> is who is healed;
|
/// Void: a non-null return refuses the heal. <paramref name="target"/> is what is healed;
|
||||||
/// the tool's owner is who heals. Healing yourself is not a heal (D174).
|
/// the tool's owner is who heals. Healing yourself is not a heal (D174).
|
||||||
|
///
|
||||||
|
/// <para>
|
||||||
|
/// The target is taken as <c>object</c>: the game's `GiveEffectsTo` now takes an
|
||||||
|
/// `IMedicalToolTarget`, which is not always a player, and a parameter typed
|
||||||
|
/// `BasePlayer` would simply never be called for the hook's current shape. Only a
|
||||||
|
/// player healed counts.
|
||||||
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void OnHealingItemUse(MedicalTool tool, BasePlayer player)
|
private void OnHealingItemUse(MedicalTool tool, object target)
|
||||||
{
|
{
|
||||||
MarkHook("OnHealingItemUse");
|
MarkHook("OnHealingItemUse");
|
||||||
|
|
||||||
|
BasePlayer player = target as BasePlayer;
|
||||||
BasePlayer healer = tool != null ? tool.GetOwnerPlayer() : null;
|
BasePlayer healer = tool != null ? tool.GetOwnerPlayer() : null;
|
||||||
|
|
||||||
if (healer == null || healer.IsNpc || player == null || player.IsNpc
|
if (healer == null || healer.IsNpc || player == null || player.IsNpc
|
||||||
@@ -2107,16 +2119,16 @@ namespace Oxide.Plugins
|
|||||||
/// No return behaviour. A mission one of the game's NPCs handed out, finished (D173). A
|
/// No return behaviour. A mission one of the game's NPCs handed out, finished (D173). A
|
||||||
/// failed or abandoned one raises a different hook, and is never counted.
|
/// failed or abandoned one raises a different hook, and is never counted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void OnMissionSucceeded(BaseMission mission, BaseMission.MissionInstance instance)
|
private void OnMissionSucceeded(BaseMission mission, BaseMission.MissionInstance instance, BasePlayer assignee)
|
||||||
{
|
{
|
||||||
MarkHook("OnMissionSucceeded");
|
MarkHook("OnMissionSucceeded");
|
||||||
|
|
||||||
BasePlayer player = instance != null ? instance.GetAssignee() : null;
|
// The game hands the assignee over: `MissionSuccess(instance, assignee)`. The instance
|
||||||
|
// itself has no accessor for it (read off the rig, 2026-09-29).
|
||||||
if (player == null || player.IsNpc)
|
if (assignee == null || assignee.IsNpc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TallyFor(player).Missions++;
|
TallyFor(assignee).Missions++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user