CustomItem

版本 v0.0.2·更新於 2025-02-19

A library for spawning and giving custom items.

模組介紹 作者原文

CustomItem

A library for spawning and giving custom items.

Usage

Copy this header file into your project:

ifndef PROXYMM_CUSTOM_ITEM_H

define PROXYMM_CUSTOM_ITEM_H

include "modding.h"

include "global.h"

define CUSTOM_ITEM_FLAGS (actor->home.rot.x)

define CUSTOM_ITEM_PARAM (actor->home.rot.z)

typedef enum CustomItemFlags {

// if the player is within range, kill the actor and call the actionFunc

KILL_ON_TOUCH = 1 << 0,

// if the player is within range, show the item bobbing above the player

// and call the actionFunc

GIVE_OVERHEAD = 1 << 1,

// if the player is within range, show the full Get Item Cutscene.

// WARNING: If you do not call Message_StartTextbox in your actionFunc,

// the player will soft lock

GIVE_ITEM_CUTSCENE = 1 << 2,

// Usually used in conjunction with KEEP_ON_PLAYER, hides the item until

// it is overhead

HIDE_TILL_OVERHEAD = 1 << 3,

// Keep the item at the players coordinates until they are ready to pick it up

KEEP_ON_PLAYER = 1 << 4,

// Prevent bobbing animation

STOP_BOBBING = 1 << 5,

// Prevent spinning animation

STOP_SPINNING = 1 << 6,

// Indicates the actionFunc has been called, this can be useful inside the drawFunc

// as the item can be drawn after the give is fired for the Give Item Cutscenes

CALLED_ACTION = 1 << 7,

// Give the item a random initial velocity, similar to how most item drops are spawned

TOSS_ON_SPAWN = 1 << 8,

// Allows the item to be picked up by Zora Link's boomerang

ABLE_TO_ZORA_RANG = 1 << 9,

} CustomItemFlags;

RECOMP_IMPORT("ProxyMM_CustomItem", EnItem00* CustomItem_Spawn(

PlayState* play,

// Initial pos & rotation

f32 posX, f32 posY, f32 posZ, s16 rot,

// CustomItemFlags bitfield, can be accessed with CUSTOM_ITEM_FLAGS

s16 flags,

// Abitrary s16 to be used for anything. Can be accessed with CUSTOM_ITEM_PARAM

s16 params,

// Can be null, called when KILL_ON_TOUCH | GIVE_OVERHEAD | GIVE_ITEM_CUTSCENE

ActorFunc actionFunc,

// Can be null, if null it expects a GI_ enum value to be passed in for the params arg

ActorFunc drawFunc

));

endif // PROXYMM_CUSTOM_ITEM_H

Examples

You can see various examples of how this can be used in the examples/ directory in the repository. Feel free to submit PR's for more examples.

安裝與使用 安裝:按包內說明操作

  1. 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
  2. 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
  3. 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
  4. 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。

不同模組的安裝位置差異較大,包內說明是最可靠的依據。

前置依賴

下面這些內容需要先安裝,否則該模組不會生效:

ProxyMM-ObjDepLoader

檔案與校驗

檔案名稱
CustomItem-0.0.2.zip
檔案大小
114.2 KiB