(version 2)
(include "sci.sh")
(exports
    0 rm44
)
(use "Main")
(use "Class_255_0")
(use "NewFeature")
(use "Blk")
(use "RFeature")
(use "Game")
(use "User")
(use "PicView")
(script 44)



(instance public rm44 of Rm
    (properties
        picture 44
        horizon 52
        north 5
        east 45
        south 37
        west 43
    )

    (method (init)
        Load(rsVIEW 244)
        (self:style(
            (switch (gGNumber)
                (case north
                    5
                )
                (case west
                    3
                )
                (case east
                    2
                )
                (case south
                    4
                )
                (default 
                    7
                )
            )
))
        (super:init())
        (switch (gGNumber)
            (case north
                (send gEgo:posn(proc0_17(225 (send gEgo:x) 41) (+ horizon 2)))
            )
            (case south
                (send gEgo:posn(proc0_17(318 (send gEgo:x) 73) 188))
            )
            (case west
                (send gEgo:posn(3 proc0_17(188 (send gEgo:y) 78)))
            )
            (case east
                (if (< (send gEgo:y) 148)
                    (send gEgo:posn(273 101))
                )(else
                    (send gEgo:posn(317 proc0_17(188 (send gEgo:y) 169)))
                )
            )
            (default 
                (send gEgo:
                    posn(251 157)
                    loop(1)
                )
            )
        )
        (send gEgo:
            init()
            observeBlocks(pumpBlock)
        )
        proc0_1()
        (send gAddToPics:
            add(stump pump)
            eachElementDo(#init)
            doit()
        )
        (smallRock:init())
        (pinetree1:init())
        (pinetree2:init())
        (pinetree3:init())
        (pinetree4:init())
        (stump1:init())
        (stump2:init())
        (stump3:init())
        (stump5:init())
        (stump6:init())
        (window1:init())
        (porch1:init())
        (porch2:init())
        (bush1:init())
        (bush2:init())
        (bush3:init())
        (bush4:init())
    )


    (method (doit)
        (var temp0)
        (if (script)
            (send script:doit())
        )(else
            (if (& (send gEgo:onControl(1)) $4000)
                (self:newRoom(79))
            )(else
                = temp0 
                    (switch ((send ((User:alterEgo)):edgeHit))
                        (case 1
                            north
                        )
                        (case 2
                            east
                        )
                        (case 3
                            south
                        )
                        (case 4
                            west
                        )
                    )
                (if (temp0)
                    (self:newRoom((= temp0 
                            (switch ((send ((User:alterEgo)):edgeHit))
                                (case 1
                                    north
                                )
                                (case 2
                                    east
                                )
                                (case 3
                                    south
                                )
                                (case 4
                                    west
                                )
                            )
)))
                )
            )
        )
    )


    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if ((super:handleEvent(pEvent)))
                return 
            )(else
                (if (Said('attack,kick/building'))
                    proc255_0(44 0)
                )(else
                    (if (Said('open,open/door') or Said('close,close/door'))
                        (if ((send gEgo:inRect(233 149 264 160)))
                            proc255_0(44 1)
                        )(else
                            proc0_4()
                        )
                    )(else
                        (if (Said('look,look/hole'))
                            proc255_0(44 2)
                        )(else
                            (if (Said('look,look/ceiling'))
                                proc255_0(44 3)
                            )(else
                                (if (Said('look,look/chimney'))
                                    proc255_0(44 4)
                                )(else
                                    (if (((Said('look,look[<in,in,through]/door,doorway') or ((send gEgo:inRect(233 149 264 160)) and Said('look,look<in'))) or proc0_14(pEvent 249 106 264 159)) or proc0_14(pEvent 225 158 269 175))
                                        (if ((send gEgo:inRect(233 149 264 160)))
                                            (if (proc0_12(113))
                                                proc255_0(44 5)
                                            )(else
                                                proc255_0(44 6)
                                            )
                                        )(else
                                            proc255_0(44 7)
                                        )
                                    )(else
                                        (if ((((Said('look,look/building') or proc0_14(pEvent 229 135 320 170)) or proc0_14(pEvent 222 75 236 89)) or proc0_14(pEvent 237 58 320 89)) or proc0_14(pEvent 211 89 320 135))
                                            proc255_0(44 8)
                                        )(else
                                            (if (Said('look,look<in,through,in/window') or ((< GetDistance((send gEgo:x) (send gEgo:y) 228 139 60) 60) and Said('look,look<in')))
                                                (if (proc0_12(113))
                                                    proc255_0(44 9)
                                                )(else
                                                    (if (< GetDistance((send gEgo:x) (send gEgo:y) 228 139 60) 60)
                                                        proc255_0(44 10)
                                                    )(else
                                                        proc255_0(44 11)
                                                    )
                                                )
                                            )(else
                                                (if (Said('look,look<in'))
                                                    proc255_0(44 12)
                                                )(else
                                                    (if (Said('look,look/window'))
                                                        proc255_0(44 13)
                                                    )(else
                                                        (if (Said('look,look>'))
                                                            (if (Said('[<at,around][/room]'))
                                                                (if (proc0_12(113))
                                                                    proc255_0(44 14)
                                                                )(else
                                                                    proc255_0(44 15)
                                                                )
                                                            )(else
                                                                (if (Said('/man') or Said('/fairy'))
                                                                    (if ((send gEgo:inRect(233 149 264 160)))
                                                                        proc255_0(44 16)
                                                                    )(else
                                                                        proc255_0(44 17)
                                                                    )
                                                                )
                                                            )
                                                        )
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
    )

)
(instance stump of RPicView
    (properties
        x 152
        y 155
        view 244
    )

    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if (proc255_5(self pEvent 3) or Said('look,look/ax'))
                proc255_0(44 18)
                proc255_0(44 19)
                (send pEvent:claimed(1))
            )(else
                (if (Said('look,look/stump'))
                    (if ((send gEgo:inRect(115 140 187 160)))
                        proc255_0(44 20)
                    )(else
                        proc255_0(44 21)
                    )
                )(else
                    (if (Said('get,get/ax'))
                        (if ((send gEgo:inRect(115 140 187 160)))
                            proc255_0(44 22)
                        )(else
                            proc0_4()
                        )
                    )(else
                        (if (Said('use/ax'))
                            (if ((send gEgo:inRect(115 140 187 160)))
                                proc255_0(44 23)
                            )(else
                                proc0_4()
                            )
                        )(else
                            (send pEvent:claimed(0))
                        )
                    )
                )
            )
        )
    )

)
(instance pump of RPicView
    (properties
        x 50
        y 177
        view 244
        loop 1
    )

    (method (handleEvent pEvent)
        (if ((send pEvent:claimed))
            return 
        )(else
            (if ((Said('look,look/pump') or Said('look,look/pump<water')) or proc255_5(self pEvent 3))
                (send pEvent:claimed(1))
                proc255_0(44 24)
            )(else
                (if ((((Said('use/pump') or Said('pump/water')) or Said('pump')) or Said('pump/pump')) or Said('work/pump'))
                    (if ((send gEgo:inRect(30 167 70 187)))
                        proc255_0(44 25)
                    )(else
                        proc0_4()
                    )
                )(else
                    (super:handleEvent(pEvent))
                )
            )
        )
    )

)
(instance smallRock of View
    (properties
        x 204
        y 176
        description 3392
        view 244
        loop 2
        signal $4000
    )
)
(instance pumpBlock of Blk
    (properties
        top 175
        left 45
        bottom 179
        right 55
    )
)
(instance pinetree1 of NewFeature
    (properties
        x 63
        y 110
        noun 3350
        nsTop 84
        nsLeft 25
        nsBottom 137
        nsRight 101
        description 3417
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3427
    )
)
(instance pinetree2 of NewFeature
    (properties
        x 60
        y 72
        noun 3350
        nsTop 61
        nsLeft 36
        nsBottom 84
        nsRight 84
        description 3417
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3427
    )
)
(instance pinetree3 of NewFeature
    (properties
        x 54
        y 53
        noun 3350
        nsTop 45
        nsLeft 40
        nsBottom 61
        nsRight 69
        description 3417
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3427
    )
)
(instance pinetree4 of NewFeature
    (properties
        x 282
        y 28
        noun 3350
        nsTop -1
        nsLeft 244
        nsBottom 57
        nsRight 320
        description 3417
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3427
    )
)
(instance stump1 of NewFeature
    (properties
        x 130
        y 102
        noun 3359
        nsTop 99
        nsLeft 125
        nsBottom 106
        nsRight 136
        description 3381
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3544
    )
)
(instance stump2 of NewFeature
    (properties
        x 152
        y 116
        noun 3359
        nsTop 112
        nsLeft 147
        nsBottom 120
        nsRight 158
        description 3381
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3544
    )
)
(instance stump3 of NewFeature
    (properties
        x 197
        y 101
        noun 3359
        nsTop 98
        nsLeft 193
        nsBottom 105
        nsRight 201
        description 3381
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3544
    )
)
(instance porch1 of NewFeature
    (properties
        x 226
        y 150
        noun 3363
        nsTop 141
        nsLeft 207
        nsBottom 159
        nsRight 246
        description 3618
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3624
    )
)
(instance porch2 of NewFeature
    (properties
        x 246
        y 167
        noun 3363
        nsTop 159
        nsLeft 226
        nsBottom 175
        nsRight 267
        description 3618
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3624
    )
)
(instance stump5 of NewFeature
    (properties
        x 133
        y 67
        nsTop 60
        nsLeft 119
        nsBottom 74
        nsRight 148
        description 3381
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3691
    )
)
(instance stump6 of NewFeature
    (properties
        x 178
        y 68
        nsTop 61
        nsLeft 164
        nsBottom 76
        nsRight 192
        description 3381
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3691
    )
)
(instance window1 of NewFeature
    (properties
        x 229
        y 111
        z -27
        heading 235
        nsTop 98
        nsLeft 224
        nsBottom 125
        nsRight 234
        sightAngle 360
        getableDist 0
        seeableDist 60
        shiftClick 369
    )

    (method (doLook)
        (if (> GetDistance((send gEgo:x) (send gEgo:y) x y) seeableDist)
            proc255_0(44 26)
        )(else
            (if (proc0_12(113))
                proc255_0(44 9)
            )(else
                proc255_0(44 10)
            )
        )
    )

)
(instance bush1 of NewFeature
    (properties
        x 17
        y 173
        noun 3367
        nsTop 157
        nsBottom 189
        nsRight 35
        description 3761
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3766
    )
)
(instance bush2 of NewFeature
    (properties
        x 49
        y 179
        noun 3367
        nsTop 169
        nsLeft 35
        nsBottom 189
        nsRight 64
        description 3761
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3766
    )
)
(instance bush3 of NewFeature
    (properties
        x 8
        y 58
        noun 3367
        nsTop 42
        nsBottom 74
        nsRight 16
        description 3761
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3766
    )
)
(instance bush4 of NewFeature
    (properties
        x 27
        y 63
        noun 3367
        nsTop 52
        nsLeft 16
        nsBottom 74
        nsRight 39
        description 3761
        sightAngle 360
        getableDist 320
        seeableDist 320
        shiftClick 369
        contClick 371
        lookStr 3766
    )
)
