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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405
|
function look_pocketwatch(obj)
printl("THE_TIME_IS")
local am = true
local hour = clock_get_hour()
local minute = clock_get_minute()
if hour >= 12 then
am = false
end
if hour > 12 then
hour = hour - 12
end
local time = "TIME_AM"
if am == false then
time = "TIME_PM"
end
printfl(time, hour, minute)
end
function look_cannon(obj)
if obj.quality ~= 0 then
printl("THE_CANNON_WILL_FIRE_STEEL_CANNON_BALLS")
end
end
function look_barrow(obj)
if obj.qty == 0 then
printl("IT_IS_EMPTY")
return
end
local quality = obj.quality
local material
if quality == 1 then
material = i18n("DIRT")
elseif quality == 2 then
material = i18n("ROCK")
elseif quality == 3 then
material = i18n("IRON_ORE")
elseif quality == 4 then
material = i18n("COAL")
end
if obj.qty == 1 then
printfl("IT_HAS_1_LOAD_OF", material)
else
printfl("IT_HAS_N_LOADS_OF", obj.qty, material)
end
end
function get_lat_long_string(x, y)
local lat_str = "N"
local long_str = "W"
local lat = math.modf(((y - 512) * 240) / 1024)
local long = math.modf(((x - 512) * 360) / 1024)
if lat > 0 then
lat_str = "S"
else
if lat == 0 then
lat_str = " "
end
end
if long == 180 or long == -180 or long == 0 then
long_str = " "
else
if long < 0 then
long_str = "E"
end
end
lat = math.abs(lat)
long = 180 - math.abs(long)
return lat..lat_str.." "..long..long_str
end
function look_marker_flag(obj)
local names = {
[1]="Coprates Chasma",
[2]="Arsia Mons",
[3]="Pavonis Mons",
[4]="Ascraeus Mons",
[5]="Alber Tholus",
[6]="Elysium Mons",
[7]="Hecates Tholus",
[8]="Terra Sirenum",
[9]="Noctis Labyrinthus",
[10]="Deuteronicus Mensae",
[11]="Syrtis Major Planum",
[12]="Olympus Mons",
}
if obj.z == 0 then
if obj.quality <= 12 then
if obj.quality ~= 0 then
print(names[obj.quality])
print(" "..get_lat_long_string(obj.x,obj.y).."\n")
end
else
printl("AARGH")
end
end
end
function look_broken_strap(obj)
local spector = Actor.get(2)
Actor.set_talk_flag(spector, 6)
Actor.talk(spector)
end
function look_metal_woman(obj)
if obj.quality ~= 0 then
printl("IT_HAS_A_HEARTSTONE")
end
end
function look_covered_martian_seed(obj)
if obj.frame_n < 4 then
local quality = obj.quality
if quality == 15 then
printl("IT_IS_GROWING")
elseif quality == 16 then
printl("IT_IS_RIPE")
else
printl("IT_IS_NOT_GROWING")
end
end
end
function look_sprayer_system(obj)
local quality = obj.quality
if bit32.btest(quality, 1) then
local actor = Actor.get(0x3e)
if Actor.get_talk_flag(actor, 5) == true then
if bit32.btest(quality, 2) then
printl("IT_IS_READY_TO_USE")
else
printl("THE_RUBBER_IN_THE_SPRAYER_SYSTEM_IS_NOT_FLESH_COLORED")
end
else
printl("IT_IS_READY_TO_USE")
end
else
printl("THERE_IS_NO_RUBBER_IN_THE_SPRAYER_SYSTEM")
if Actor.get_talk_flag(actor, 5) == true and bit32.btest(quality, 2) == false then
printl("IT_IS_ALSO_NOT_FLESH_COLORED")
end
end
end
function look_cabinet(obj)
local quality = obj.quality
if quality == 0 or quality > 7 then
printl("YOU_CANNOT_DECIPHER_WHAT_IT_CONTROLS")
else
printl("CABINET_"..quality)
end
end
function look_tracking_motor(obj)
local quality = obj.quality
if bit32.btest(quality, 1) and obj.on_map == true then
printl("IT_APPEARS_TO_BE_LOOSE")
end
if bit32.btest(quality, 2) then
printl("IT_APPEARS_TO_BE_BROKEN")
end
end
function look_panel(obj)
local qty = obj.qty
if qty == 0 then
local frame_n = obj.frame_n
if frame_n == 0 then
printl("THESE_APPEAR_TO_BE_MECHANICAL_CONTROLS")
elseif frame_n == 1 then
printl("THESE_APPEAR_TO_BE_VALVE_CONTROLS")
elseif frame_n == 2 then
printl("THESE_APPEAR_TO_BE_ELECTRICAL_CONTROLS")
end
elseif qty == 4 then
printl("IT_APPEARS_TO_CONTROL_A_DREAM_MACHINE")
elseif qty == 5 then
printl("IT_APPEARS_TO_CONTROL_A_SPRAY_SYSTEM")
elseif qty == 6 then
printl("IT_APPEARS_TO_CONTROL_THE_RUBY_LENS_SYSTEM")
elseif qty == 7 then
printl("IT_APPEARS_TO_CONTROL_THE_CISTERN_VALVES")
else
printl("YOU_CANNOT_DECIPHER_ITS_PURPOSE")
end
local quality = obj.quality
if bit32.btest(quality, 1) and obj.on_map == true then
printl("THE_PANEL_IS_LOOSE")
end
if bit32.btest(quality, 2) then
printl("THE_PANEL_IS_BROKEN")
end
end
function print_number_of_charges(qty)
if qty == 1 then
printl("AND_HAS_1_CHARGE_LEFT")
else
printfl("AND_HAS_N_CHARGES_LEFT", qty)
end
end
function look_portable_sprayer(obj)
local contents
if obj.quality == 0 then
contents = tile_get_description(649)
else
contents = tile_get_description(640)
end
printfl("IT_IS_LOADED_WITH", contents)
print_number_of_charges(obj.qty)
end
function get_weapon_mode_string(obj)
local mode
local quality = obj.quality
if quality == 0 then
mode = i18n("COMBINATION")
elseif quality == 1 then
mode = i18n("RIFLE")
else
mode = i18n("SHOTGUN")
end
return mode
end
function look_ray_gun(obj)
printfl("IT_IS_SET_TO", get_weapon_mode_string(obj))
print_number_of_charges(obj.qty)
end
function look_belgian_combine(obj)
printfl("IT_IS_SET_TO", get_weapon_mode_string(obj))
print(".\n")
end
function look_switch_bar(obj)
local quality = obj.quality
if quality == 1 then
printl("IT_SEEMS_TO_BE_LOOSE")
elseif quality == 2 then
printl("IT_IS_NOT_INSTALLED")
end
end
function look_light_source(obj)
local obj_n = obj.obj_n
local qty = obj.qty
local quality = obj.quality
if (obj_n == 109 or obj_n == 110) and qty > 1 then
return
end
if quality > 30 then
printl("PLENTY_OF")
elseif quality > 6 and quality <= 30 then
printfl("IT_HAS_N_MORE_MINUTES_OF", quality)
elseif quality > 0 and quality <= 6 then
printl("ITS_ALMOST_OUT_OF")
elseif obj_n == 115 or obj_n == 117 or obj_n == 116 or obj_n == 118 then
printl("NO")
else
printl("PLENTY_OF")
end
if obj_n == 115 or obj_n == 117 or obj_n == 116 or obj_n == 118 then
printl("FUEL")
else
printl("WICK")
end
end
function look_door(obj)
local quality = obj.quality
if quality >= 128 then
quality = quality - 128
if quality >= 64 then
printl("IT_IS_APPARENTLY_RUSTED_SHUT")
else
printl("IT_IS_APPARENTLY_LOCKED")
end
end
end
function look_obelisk(obj)
if obj.quality == 0 then
return
end
local ui_style = game_get_ui_style()
canvas_show()
canvas_hide_all_sprites()
canvas_set_opacity(0xff);
canvas_set_update_interval(25)
canvas_rotate_game_palette(true)
local obelisk = sprite_new(nil, 184, 0, true)
local text_sprite
--local text_sprite_bg
if ui_style == UI_STYLE_ORIG then
canvas_set_solid_bg(false)
else
text_sprite = sprite_new(nil, 8, 164, true)
text_sprite.text_align = 2
text_sprite.text_color = 15
text_sprite.text = "Obelisk."
obelisk.x = 96
obelisk.y = 41
end
obelisk.image = image_load("mdream.lzc", obj.quality-1)
local input = nil
while input == nil do
canvas_update()
input = input_poll()
if input ~= nil then
break
end
end
canvas_set_solid_bg(true)
canvas_rotate_game_palette(false)
canvas_hide()
end
local look_usecode = {
[45]=look_belgian_combine,
[91]=look_pocketwatch,
[98]=look_pocketwatch,
[109]=look_light_source, -- OBJ_TORCH
[110]=look_light_source, -- OBJ_LIT_TORCH
[111]=look_light_source, -- OBJ_CANDLESTICK
[112]=look_light_source, -- OBJ_LIT_CANDLE
[113]=look_light_source, -- OBJ_CANDELABRA
[114]=look_light_source, -- OBJ_LIT_CANDELABRA
[115]=look_light_source, -- OBJ_OIL_LAMP
[116]=look_light_source, -- OBJ_LIT_OIL_LAMP
[117]=look_light_source, -- OBJ_LANTERN
[118]=look_light_source, -- OBJ_LIT_LANTERN
[129]=look_portable_sprayer, --OBJ_WEED_SPRAYER
[172]=look_marker_flag,
[179]=look_door, --OBJ_CLOSED_DOOR
[227]=look_door, --OBJ_DOOR3
[240]=look_ray_gun, --OBJ_HEAT_RAY_GUN
[241]=look_ray_gun, --OBJ_FREEZE_RAY_GUN
[251]=look_covered_martian_seed,
[261]=look_portable_sprayer, --OBJ_SPRAY_GUN
[268]=look_barrow, --OBJ_MARTIAN_WHEEL_BARROW
[276]=look_sprayer_system,
[287]=look_metal_woman,
[292]=look_obelisk,
[314]=look_tracking_motor,
[333]=look_cannon,
[410]=look_barrow, --OBJ_RAIL_CAR
[411]=look_switch_bar,
[457]=look_cabinet,
[458]=look_panel,
[460]=look_broken_strap,
}
function look_obj(obj)
printfl("YOU_SEE", obj.look_string);
--FIXME usecode look description should be lua code.
if usecode_look(obj) then
print("\n")
return false
end
print(".\n\n");
if look_usecode[obj.obj_n] ~= nil then
look_usecode[obj.obj_n](obj)
print("\n")
end
if is_container_obj(obj.obj_n) then
search(obj)
end
return false
end
|