Просмотр исходного кода

implemented Action Scripts block

SaltyMonkey лет назад: 6
Родитель
Сommit
773a5be11a
3 измененных файлов с 21 добавлено и 1 удалено
  1. 3 0
      data/protoData.json
  2. 11 0
      lib/unitFps.js
  3. 7 1
      lib/unitState.js

+ 3 - 0
data/protoData.json

@@ -172,5 +172,8 @@
 	},
 	"S_ITEM_EXPLOSION_RESULT": {
 		"default": 2
+	},
+	"S_START_ACTION_SCRIPT": {
+		"default": 3
 	}
 }

+ 11 - 0
lib/unitFps.js

@@ -178,6 +178,12 @@ class unitFps {
 			if (data.activeMode.blockAnnoyingScreenMessages && data.smtData.has(mod.parseSystemMessage(event.message).id)) return true;
 			return false;
 		};
+
+		const isActionScriptBlockable = (event) => {
+			if (data.activeMode.blockActionScripts && !data.specialAs.has(event.script)) return true;
+			return false;
+		};
+
 		//-------------------------------------
 		// Reconfigure area handlers
 		//-------------------------------------
@@ -489,6 +495,10 @@ class unitFps {
 			if(isNoctsBlockable()) return false;
 		};
 
+		const actionScriptHandler = (event) => {
+			if(isActionScriptBlockable(event)) return false;
+		};
+
 		const partyMemberListHandler = (event) => {
 			partyMembers.clear();
 			event.members.forEach(member => {
@@ -537,6 +547,7 @@ class unitFps {
 		mod.hook("S_NOCTAN_VARIATION_INFO", RAW_HOOK_MODE.EVENT, HOOK_SETTINGS.LAST, noctanHandler);
 		mod.hook("S_FONT_SWAP_INFO", RAW_HOOK_MODE.EVENT, HOOK_SETTINGS.LAST, fontSwapHandler);
 		
+		mod.hook(...proto.getData("S_START_ACTION_SCRIPT"), HOOK_SETTINGS.LAST, actionScriptHandler);
 		mod.hook(...proto.getData("S_QUEST_BALLOON"), HOOK_SETTINGS.LAST, baloonsHandler);
 		mod.hook(...proto.getData("S_SYSTEM_MESSAGE"), HOOK_SETTINGS.LAST, smtHandler);
 		

+ 7 - 1
lib/unitState.js

@@ -51,7 +51,8 @@ class unitState extends EventEmitter {
 			//lookup structures 
 			"shapeChangersBuffs": new Set(),
 			"onScreenEffectsBuffs": new Set(),
-			"smtData": new Set()
+			"smtData": new Set(),
+			"specialAs": new Set()
 		});
 
 		deps.mod.game.data.abnormalities.forEach(abnormality => {
@@ -62,6 +63,11 @@ class unitState extends EventEmitter {
 				this.onScreenEffectsBuffs.add(abnormality.id);
 		});
 
+		this.__mod.mod.queryData("/S1ActionScripts@type=?/Script/", ["Teleport"], true, false, ["id"]).then(result => {
+			let res = result.map(rs => rs.attributes.id);
+			res.forEach(x => { this.specialAs.add(x); });
+		});
+
 		this.availableClasses.add("common");
 		deps.mod.game.data.users.forEach(template => {
 			this.availableClasses.add(template.class);