Skip to content

Instantly share code, notes, and snippets.

@aaaaagold
Created July 15, 2021 01:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaaaagold/45f38d571436c0e82658841db2bc33e8 to your computer and use it in GitHub Desktop.
Save aaaaagold/45f38d571436c0e82658841db2bc33e8 to your computer and use it in GitHub Desktop.
an rmmv plugin
"use strict";
/*:
* @plugindesc 讓事件可以只穿透事件而不穿透玩家
* @author agold404
*
* @help this plugin let you set events through only events but not player (and followers)
*
* syntax: write <throughEvents> in note of a event
* this will let the event can be through all events
*
* syntax: write <throughEventsOnly:A_USER_DEFINED_STRING> in note of a event
* this will let the event can be through all events having same 'meta.throughEventsOnly' (leave it empty can be a classification) in notes only
*
* remember to uncheck "through"
*
* This plugin can be renamed as you want.
*/
(()=>{
{ const p=Game_Event.prototype , k='isCollidedWithEvents';
const r=p[k]; (p[k]=function f(x,y){
const meta=this.event().meta , k='throughEventsOnly';
if(meta.throughEvents) return false;
else if(Object.hasOwnProperty.call(meta,k)) return $gameMap._events.filter(e=>e&&!e._through&&e.pos(x,y)&&meta[k]!==e.event().meta[k]).length!==0;
else return $gameMap._events.filter(e=>e&&!e._through&&e.pos(x,y)).length!==0;
}).ori=r;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment