-
Notifications
You must be signed in to change notification settings - Fork 41
/
OrangeInstantTriggerMouseEvents.js
74 lines (65 loc) · 2.4 KB
/
OrangeInstantTriggerMouseEvents.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*=============================================================================
* Orange - Instant Trigger Mouse Events
* By Hudell - www.hudell.com
* OrangeInstantTriggerMouseEvents.js
* Version: 1.0
* Free for commercial and non commercial use.
*=============================================================================*/
/*:
* @plugindesc This plugin will trigger events instantly when you click on them
* @author Hudell
*
* @help
* ============================================================================
* Latest Version
* ============================================================================
*
* Get the latest version of this script on
* http://link.hudell.com/trigger-mouse-events
*
*=============================================================================*/
var Imported = Imported || {};
var OrangeInstantTriggerMouseEvents = OrangeInstantTriggerMouseEvents || {};
(function($) {
"use strict";
Scene_Map.prototype.tryTriggeringEvent = function() {
if ($gameMap.isAnyEventStarting() || $gameMap.isEventRunning() || !$gamePlayer.canStartLocalEvents()) {
return false;
}
if (TouchInput.isTriggered() || this._touchCount > 0) {
if (TouchInput.isPressed()) {
if (this._touchCount === 0 || this._touchCount >= 15) {
var x = $gameMap.canvasToMapX(TouchInput.x);
var y = $gameMap.canvasToMapY(TouchInput.y);
var events = $gameMap.eventsXy(x, y);
if (events.length === 0) {
return false;
}
for (var i = 0; i < events.length; i++) {
if (events[i].isTriggerIn([0])) {
events[i].start();
return true;
}
}
}
}
}
return false;
};
var oldSceneMap_processMapTouch = Scene_Map.prototype.processMapTouch;
Scene_Map.prototype.processMapTouch = function() {
if (!this.tryTriggeringEvent()) {
oldSceneMap_processMapTouch.call(this);
}
};
})(OrangeInstantTriggerMouseEvents);
// If MVCommons is imported, register the plugin with it's PluginManager.
if (Imported['MVCommons'] !== undefined) {
PluginManager.register("OrangeInstantTriggerMouseEvents", "1.0.0", "This plugin will trigger events instantly when you click on them", {
email: "[email protected]",
name: "Hudell",
website: "http://www.hudell.com"
}, "2015-10-22");
} else {
Imported["OrangeInstantTriggerMouseEvents"] = true;
}