File: slime.lua

package info (click to toggle)
scummvm 2.9.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 450,580 kB
  • sloc: cpp: 4,299,825; asm: 28,322; python: 12,901; sh: 11,302; java: 9,289; xml: 7,895; perl: 2,639; ansic: 2,465; yacc: 1,670; javascript: 1,020; makefile: 933; lex: 578; awk: 275; objc: 82; sed: 11; php: 1
file content (38 lines) | stat: -rw-r--r-- 983 bytes parent folder | download | duplicates (4)
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
local loc = player_get_location()
local caster = magic_get_caster()
local x = loc.x - 5
local y = loc.y - 5
local z = loc.z

magic_casting_fade_effect(caster)

for x = loc.x - 5,loc.x + 5 do
	for y = loc.y - 5,loc.y + 5 do
		local actor = map_get_actor(x, y, z)

		if actor ~= nil then
			local actor_type = actor_tbl[actor.obj_n]

			if actor.align == ALIGNMENT_EVIL and (actor_type == nil or actor_type[12] == 0) then
				if actor_int_check(actor, caster) == false then

					local old_tile_num = actor.tile_num
					actor.base_obj_n = 0x177 --convert actor into slime
					local new_tile_num = actor.tile_num
					actor.visible = false
					--FIXME need to fade all at once.
					fade_tile(x, y, z, old_tile_num, new_tile_num)
					actor.visible = true
					if actor.temp == true then
						--remove inventory
						local obj
						for obj in actor_inventory(actor) do
							Actor.inv_remove_obj(actor, obj)
						end
					end
				end
			end
		end
	end
end
slime_update_frames()