[CF-Devel] Ingame map 'building' / modification: full patch

crossfire-devel at archives.real-time.com crossfire-devel at archives.real-time.com
Mon Nov 10 15:31:19 CST 2003


Hello.

Finally completed & tweaked & 'nifted' my build patch.

2 files are attached: patch itself, and modified Scorn apartment, for testing 
purposes. Note: directly patches lib/archetype, didn't feel like making separate 
archs for now.

And, hopefully, no newline issue :)

To test, enter the apartment, pick gold, buy, pick diamonds, buy extender, apply 
it. You can build on the south wall (start by making floors).

All builders work like a range attack. Apply/ready it, fire in the building 
direction.
There are 2 different kind of items: builders & raw materials.
Builders are tools to build, they don't disappear. Raw materials obviously 
disappear when building :)

Still no shop to buy building items, need to dm-create'em, here's the details of 
what you can do:

* build a floor. Archetypes 'builder_floor' & 'builder_material_floor' (pretty 
descriptive i guess).
Uses one material per build. Can build on wall (will remove it), or existing 
floor (change archetype). Archetype of built floor determined by 'slaying' 
field. Will add walls if required to ensure player doesn't go in weird places 
(undefined space around apartment for instance)

* build a wall. Archetypes 'builder_wall' & 'builder_material_wall'. One 
material per build, can build on floor (makes the wall) or existing wall 
(changes archetype). Archetype of built wall determined by 'slaying' field.

* build a door. Archetypes 'builder_door' & 2 'builder_material_pedestal' or 
'builder_material'button' (those 2 will merge at some point, just some fields 
difference).
More tricky for doors. Will build a button/pedestal on player's standing spot, 
door in firing direction, another button/pedestal on other side of the door. 
Archetype of the door determined by 'slaying' of raw door, archetype of 
'handler' (button/pedestal) by 'slaying' of raw 'handler'. If raw handler's Str 
is 1, handler is inserted below floor (thus 'builder_material_pedestal' has it 
set). Tries 10000 random connection values for one free, then bails out.

Building does the following things, depending on what you build:
* always check the map is unique
* check you don't try to build outside the map
* check the (new) flag 'FLAG_IS_BUILDABLE' / 'is_buildable' is set on building 
square(s) (1 for floor/walls, 3 for door)
* make sure you have enough material to build
* update walls around building spot if required

To correctly identify walls/floors & such, i changed the type of walls in 
apartment around the building zone to '77' (WALL) for walls, '71' (FLOOR) for 
floors (note: JavaEditor correctly associated those types). Those flags must be 
set on buildable squares, else the functions return with a failure message. 
(security, to avoid any bug). Note that the WALL type should be set 2 squares 
around the walls you intend to let player remove (so that walls around are 
updated correctly) (check my modified map when in doubt)

There are some issues with apartment as it's defined, concerning the 'blocked' 
view. If you build east, you'll hit a blocked view. You won't be able to build 
floor or wall, square will stay black. Not that a big issue.

If/when this code makes it at some point, i suggest making a new apartment 
somewhere (Pupland? Lake County?). And making raw material expensive :) (or 
something you can only do with alchemy, some challenging thing).

Also, I plan on adding other things to build, someday :)

I hope you guys look at the code, since i hope it's included in the game at some 
point :)
If you don't feel like patching your sources, grab me on the IRC channel & i'll 
open my test server so you can look (though timezone differences can make it 
harder).

Nicolas 'Ryo' 'Kaori'
-------------- next part --------------
arch map
name apartments
msg
Creator: Christian Stieber
Email: 
     
     stieber at informatik.tu-muenchen.de
     
     
Date: Fri Mar 27 16:41:54 1998
endmsg
width 30
height 30
reset_timeout 1
end
arch woodfloor
unique 1
end
arch wall_2_2_2
end
arch woodfloor
unique 1
y 1
end
arch wall_2_1_1
y 1
end
arch woodfloor
unique 1
y 2
end
arch wall_2_1_1
y 2
end
arch woodfloor
unique 1
y 3
end
arch wall_2_1_1
y 3
end
arch woodfloor
unique 1
y 4
end
arch wall_2_1_1
y 4
end
arch woodfloor
unique 1
y 5
end
arch wall_2_1_1
y 5
end
arch woodfloor
unique 1
y 6
end
arch wall_2_1_1
type 77
y 6
end
arch woodfloor
unique 1
y 7
end
arch wall_2_1_1
type 77
y 7
end
arch locked_door1
name woodfloor
face woodfloor.111
msg
endmsg
slaying ExtendedApartmentKey
blocksview 1
is_floor 1
y 7
end
arch locked_door1
name wall
face wall_7.111
msg
endmsg
slaying ExtendedApartmentKey
y 7
end
arch woodfloor
unique 1
y 8
end
arch locked_door1
msg
endmsg
slaying ExtendedApartmentKey
y 8
end
arch woodfloor
unique 1
y 8
end
arch wall_2_1_1
type 77
y 8
end
arch woodfloor
unique 1
y 9
end
arch wall_2_2_1
type 77
y 9
end
arch woodfloor
unique 1
x 1
end
arch wall_2_1_2
x 1
end
arch woodfloor
unique 1
x 1
y 1
end
arch exit
slaying /world/world_105_115
hp 1
sp 34
x 1
y 1
end
arch woodfloor
unique 1
x 1
y 2
end
arch goldcoin
nrof 10000
x 1
y 2
end
arch goldfloor
name Apartment costs 1000 gold
slaying money
food 10000
connected 1
x 1
y 3
end
arch woodfloor
unique 1
x 1
y 4
end
arch igate_closed_1
speed 0.500000
resist_physical 30
connected 1
x 1
y 4
end
arch woodfloor
unique 1
x 1
y 5
end
arch woodfloor
unique 1
x 1
y 6
end
arch bed_save
x 1
y 6
end
arch woodfloor
unique 1
x 1
y 7
end
arch locked_door1
name wall
face wall_A.111
msg
You need to buy the apartment extender to remove this wall
endmsg
slaying ExtendedApartmentKey
blocksview 1
x 1
y 7
end
arch woodfloor
unique 1
x 1
y 8
end
arch locked_door1
slaying ExtendedApartmentKey
x 1
y 8
end
arch woodfloor
unique 1
x 1
y 8
end
arch oakdoor
name Pocket reality
face chest_1.111
slaying Apartments1
hp 1
sp 1
unique 1
x 1
y 8
end
arch woodfloor
type 71
unique 1
is_buildable 1
x 1
y 9
end
arch wall_2_1_2
type 77
is_buildable 1
x 1
y 9
end
arch woodfloor
unique 1
x 2
end
arch wall_2_1_2
x 2
end
arch wall_1_2
face wall_1_short.111
x 2
end
arch pedestal
resist_physical 30
resist_magic 30
resist_electricity 30
resist_cold 30
resist_confusion 30
resist_acid 30
connected 123
x 2
y 1
end
arch woodfloor
unique 1
x 2
y 1
end
arch igate_closed_2
name Emergency exit
speed 0.500000
resist_physical 30
resist_magic 30
resist_electricity 30
resist_cold 30
resist_confusion 30
resist_acid 30
connected 123
x 2
y 1
end
arch woodfloor
unique 1
x 2
y 2
end
arch wall_1_1
x 2
y 2
end
arch woodfloor
unique 1
x 2
y 3
end
arch wall_2_1_1
x 2
y 3
end
arch woodfloor
unique 1
x 2
y 4
end
arch wall_1_2
x 2
y 4
end
arch woodfloor
unique 1
x 2
y 5
end
arch woodfloor
unique 1
x 2
y 6
end
arch woodfloor
unique 1
x 2
y 7
end
arch locked_door1
name wall
face wall_A.111
msg
You need to buy the apartment extender to remove this wall
endmsg
slaying ExtendedApartmentKey
blocksview 1
x 2
y 7
end
arch woodfloor
unique 1
x 2
y 8
end
arch oakdoor
name Pocket reality
face chest_1.111
slaying Apartments2
hp 1
sp 1
unique 1
x 2
y 8
end
arch woodfloor
type 71
unique 1
is_buildable 1
x 2
y 9
end
arch wall_2_1_2
type 77
is_buildable 1
x 2
y 9
end
arch woodfloor
unique 1
x 3
end
arch wall_2_1_2
x 3
end
arch pedestal
resist_physical 30
resist_magic 30
resist_electricity 30
resist_cold 30
resist_confusion 30
resist_acid 30
connected 123
x 3
y 1
end
arch woodfloor
unique 1
x 3
y 1
end
arch woodfloor
unique 1
x 3
y 2
end
arch woodfloor
unique 1
x 3
y 3
end
arch woodfloor
unique 1
x 3
y 4
end
arch woodfloor
unique 1
x 3
y 5
end
arch woodfloor
unique 1
x 3
y 6
end
arch woodfloor
unique 1
x 3
y 7
end
arch locked_door1
name wall
face wall_A.111
msg
You need to buy the apartment extender to remove this wall
endmsg
slaying ExtendedApartmentKey
blocksview 1
x 3
y 7
end
arch woodfloor
unique 1
x 3
y 8
end
arch oakdoor
name Pocket reality
face chest_1.111
slaying Apartments3
hp 1
sp 1
unique 1
x 3
y 8
end
arch woodfloor
type 71
unique 1
is_buildable 1
x 3
y 9
end
arch wall_2_1_2
type 77
is_buildable 1
x 3
y 9
end
arch woodfloor
unique 1
x 4
end
arch wall_2_1_2
x 4
end
arch woodfloor
unique 1
x 4
y 1
end
arch woodfloor
unique 1
x 4
y 2
end
arch woodfloor
unique 1
x 4
y 3
end
arch woodfloor
unique 1
x 4
y 4
end
arch woodfloor
unique 1
x 4
y 5
end
arch woodfloor
unique 1
x 4
y 6
end
arch woodfloor
unique 1
x 4
y 7
end
arch locked_door1
name wall
face wall_A.111
msg
You need to buy the apartment extender to remove this wall
endmsg
slaying ExtendedApartmentKey
blocksview 1
x 4
y 7
end
arch woodfloor
unique 1
x 4
y 8
end
arch oakdoor
name Pocket reality
face chest_1.111
slaying Apartments4
hp 1
sp 1
unique 1
x 4
y 8
end
arch woodfloor
type 71
unique 1
is_buildable 1
x 4
y 9
end
arch wall_2_1_2
type 77
is_buildable 1
x 4
y 9
end
arch woodfloor
unique 1
x 5
end
arch wall_2_1_2
x 5
end
arch woodfloor
unique 1
x 5
y 1
end
arch woodfloor
unique 1
x 5
y 2
end
arch woodfloor
unique 1
x 5
y 3
end
arch woodfloor
unique 1
x 5
y 4
end
arch woodfloor
unique 1
x 5
y 5
end
arch woodfloor
unique 1
x 5
y 6
end
arch woodfloor
unique 1
x 5
y 7
end
arch locked_door1
name wall
face wall_A.111
msg
You need to buy the apartment extender to remove this wall
endmsg
slaying ExtendedApartmentKey
blocksview 1
x 5
y 7
end
arch woodfloor
unique 1
x 5
y 8
end
arch oakdoor
name Pocket reality
face chest_1.111
slaying Apartments5
hp 1
sp 1
unique 1
x 5
y 8
end
arch woodfloor
type 71
unique 1
is_buildable 1
x 5
y 9
end
arch wall_2_1_2
type 77
is_buildable 1
x 5
y 9
end
arch woodfloor
unique 1
x 6
end
arch wall_2_1_2
x 6
end
arch woodfloor
unique 1
x 6
y 1
end
arch woodfloor
unique 1
x 6
y 2
end
arch woodfloor
unique 1
x 6
y 3
end
arch woodfloor
unique 1
x 6
y 4
end
arch woodfloor
unique 1
x 6
y 5
end
arch woodfloor
unique 1
x 6
y 6
end
arch woodfloor
unique 1
x 6
y 7
end
arch locked_door1
name wall
face wall_A.111
msg
You need to buy the apartment extender to remove this wall
endmsg
slaying ExtendedApartmentKey
blocksview 1
x 6
y 7
end
arch woodfloor
unique 1
x 6
y 8
end
arch woodfloor
type 71
unique 1
is_buildable 1
x 6
y 9
end
arch wall_2_1_2
type 77
is_buildable 1
x 6
y 9
end
arch woodfloor
unique 1
x 7
end
arch wall_2_1_2
x 7
end
arch woodfloor
unique 1
x 7
y 1
end
arch woodfloor
unique 1
x 7
y 2
end
arch woodfloor
unique 1
x 7
y 3
end
arch woodfloor
unique 1
x 7
y 4
end
arch woodfloor
unique 1
x 7
y 5
end
arch woodfloor
unique 1
x 7
y 6
end
arch woodfloor
unique 1
x 7
y 7
end
arch locked_door1
name wall
face wall_A.111
msg
You need to buy the apartment extender to remove this wall
endmsg
slaying ExtendedApartmentKey
blocksview 1
x 7
y 7
end
arch woodfloor
unique 1
x 7
y 8
end
arch woodfloor
type 71
unique 1
is_buildable 1
x 7
y 9
end
arch wall_2_1_2
type 77
is_buildable 1
x 7
y 9
end
arch woodfloor
unique 1
x 8
end
arch wall_2_1_2
x 8
end
arch woodfloor
unique 1
x 8
y 1
end
arch woodfloor
unique 1
x 8
y 2
end
arch woodfloor
unique 1
x 8
y 3
end
arch woodfloor
unique 1
x 8
y 4
end
arch woodfloor
unique 1
x 8
y 5
end
arch woodfloor
unique 1
x 8
y 6
end
arch woodfloor
unique 1
x 8
y 7
end
arch locked_door1
name wall
face wall_A.111
msg
You need to buy the apartment extender to remove this wall
endmsg
slaying ExtendedApartmentKey
blocksview 1
x 8
y 7
end
arch woodfloor
unique 1
x 8
y 8
end
arch woodfloor
type 71
unique 1
is_buildable 1
x 8
y 9
end
arch wall_2_1_2
type 77
is_buildable 1
x 8
y 9
end
arch woodfloor
unique 1
x 9
end
arch wall_2_1_2
x 9
end
arch woodfloor
unique 1
x 9
y 1
end
arch woodfloor
unique 1
x 9
y 2
end
arch woodfloor
unique 1
x 9
y 3
end
arch woodfloor
unique 1
x 9
y 4
end
arch woodfloor
unique 1
x 9
y 5
end
arch woodfloor
unique 1
x 9
y 6
end
arch woodfloor
unique 1
x 9
y 7
end
arch locked_door1
name wall
face wall_A.111
msg
You need to buy the apartment extender to remove this wall
endmsg
slaying ExtendedApartmentKey
blocksview 1
x 9
y 7
end
arch woodfloor
unique 1
x 9
y 8
end
arch woodfloor
type 71
unique 1
is_buildable 1
x 9
y 9
end
arch wall_2_1_2
type 77
is_buildable 1
x 9
y 9
end
arch woodfloor
unique 1
x 10
end
arch wall_2_1_2
x 10
end
arch woodfloor
unique 1
x 10
y 1
end
arch woodfloor
unique 1
x 10
y 2
end
arch woodfloor
unique 1
x 10
y 3
end
arch woodfloor
unique 1
x 10
y 4
end
arch woodfloor
unique 1
x 10
y 5
end
arch woodfloor
unique 1
x 10
y 6
end
arch woodfloor
unique 1
x 10
y 7
end
arch locked_door1
name wall
face wall_A.111
msg
You need to buy the apartment extender to remove this wall
endmsg
slaying ExtendedApartmentKey
blocksview 1
x 10
y 7
end
arch woodfloor
unique 1
x 10
y 8
end
arch woodfloor
type 71
unique 1
is_buildable 1
x 10
y 9
end
arch wall_2_1_2
type 77
is_buildable 1
x 10
y 9
end
arch woodfloor
unique 1
x 11
end
arch wall_2_1_2
x 11
end
arch woodfloor
unique 1
x 11
y 1
end
arch woodfloor
unique 1
x 11
y 2
end
arch woodfloor
unique 1
x 11
y 3
end
arch woodfloor
unique 1
x 11
y 4
end
arch woodfloor
unique 1
x 11
y 5
end
arch woodfloor
unique 1
x 11
y 6
end
arch gem
nrof 10000
x 11
y 6
end
arch woodfloor
unique 1
x 11
y 7
end
arch locked_door1
name wall
face wall_A.111
msg
You need to buy the apartment extender to remove this wall
endmsg
slaying ExtendedApartmentKey
blocksview 1
x 11
y 7
end
arch woodfloor
unique 1
x 11
y 8
end
arch woodfloor
type 71
unique 1
is_buildable 1
x 11
y 9
end
arch wall_2_1_2
type 77
is_buildable 1
x 11
y 9
end
arch woodfloor
unique 1
x 12
end
arch wall_2_1_2
x 12
end
arch creator
other_arch altar_none
level 30
connected 3
x 12
y 1
end
arch goldfloor
name Drop 12 holy symbols for an altar
slaying holy_symbol
food 12
connected 3
x 12
y 1
end
arch woodfloor
unique 1
x 12
y 2
end
arch woodfloor
unique 1
x 12
y 3
end
arch woodfloor
unique 1
x 12
y 4
end
arch woodfloor
unique 1
x 12
y 5
end
arch goldfloor
name Pay 10000 diamonds
slaying gem
food 10000
connected 2
x 12
y 6
end
arch woodfloor
unique 1
x 12
y 7
end
arch locked_door1
name wall
face wall_A.111
msg
You need to buy the apartment extender to remove this wall
endmsg
slaying ExtendedApartmentKey
blocksview 1
x 12
y 7
end
arch woodfloor
unique 1
x 12
y 8
end
arch locked_door1
name woodfloor
face woodfloor.111
slaying ExtendedApartmentKey
x 12
y 8
end
arch woodfloor
type 71
unique 1
is_buildable 1
x 12
y 9
end
arch wall_2_1_2
type 77
is_buildable 1
x 12
y 9
end
arch woodfloor
unique 1
x 13
end
arch wall_3_3
x 13
end
arch woodfloor
unique 1
x 13
y 1
end
arch wall_2_1_1
x 13
y 1
end
arch woodfloor
unique 1
x 13
y 2
end
arch wall_2_1_1
x 13
y 2
end
arch woodfloor
unique 1
x 13
y 3
end
arch wall_2_1_1
x 13
y 3
end
arch woodfloor
unique 1
x 13
y 4
end
arch wall_2_1_1
x 13
y 4
end
arch woodfloor
unique 1
x 13
y 5
end
arch wall_1_2
x 13
y 5
end
arch woodfloor
unique 1
x 13
y 6
end
arch igate_closed_2
speed 0.500000
resist_magic 30
connected 2
x 13
y 6
end
arch woodfloor
unique 1
x 13
y 7
end
arch wall_1_1
x 13
y 7
end
arch locked_door1
name woodfloor
face woodfloor.111
msg
endmsg
slaying ExtendedApartmentKey
blocksview 1
is_floor 1
x 13
y 7
end
arch locked_door1
name wall
face wall_C.111
msg
endmsg
slaying ExtendedApartmentKey
x 13
y 7
end
arch woodfloor
unique 1
x 13
y 8
end
arch locked_door1
slaying ExtendedApartmentKey
x 13
y 8
end
arch woodfloor
unique 1
x 13
y 8
end
arch wall_2_1_1
type 77
x 13
y 8
end
arch woodfloor
type 71
unique 1
x 13
y 9
end
arch wall_3_1
type 77
x 13
y 9
end
arch woodfloor
unique 1
x 14
end
arch wall_2_1_2
x 14
end
arch check_inv
slaying KurteKeyEureca
no_pass 1
x 14
y 1
end
arch cobblestones
unique 1
x 14
y 1
end
arch cobblestones
unique 1
x 14
y 2
end
arch locked_door1
face cobblesto2.111
msg
Please say the pupland password.
endmsg
slaying SiegfriedKey201169
invisible 1
x 14
y 2
end
arch whirlwind_exit
name Nuernberg
slaying /pup_land/nurnberg/city
hp 25
sp 15
speed 0.000000
walk_on 0
fly_on 0
x 14
y 2
end
arch cobblestones
unique 1
x 14
y 3
end
arch cobblestones
unique 1
x 14
y 4
end
arch cobblestones
unique 1
x 14
y 5
end
arch cobblestones
unique 1
x 14
y 6
end
arch whirlwind_exit
name Brest
slaying /world/world_107_123
hp 27
sp 30
speed 0.000000
walk_on 0
fly_on 0
x 14
y 6
end
arch key2
name Apartment Extender
face axe_2.111
slaying ExtendedApartmentKey
x 14
y 6
end
arch cobblestones
unique 1
x 14
y 7
end
arch whirlwind_exit
name Lake Country
slaying /world/world_109_126
hp 16
sp 19
walk_on 0
fly_on 0
speed 0.000000
x 14
y 7
end
arch cobblestones
unique 1
x 14
y 8
end
arch woodfloor
unique 1
x 14
y 9
end
arch wall_2_1_2
type 77
x 14
y 9
end
arch woodfloor
unique 1
x 15
end
arch wall_2_2_3
x 15
end
arch woodfloor
unique 1
x 15
y 1
end
arch wall_2_1_1
x 15
y 1
end
arch magic_ear
msg
@match Siegfried|siegfried
Ok. Have fun!
endmsg
resist_magic 30
resist_electricity 30
resist_confusion 30
resist_ghosthit 30
connected 554
x 15
y 2
end
arch woodfloor
unique 1
x 15
y 2
end
arch wall_2_1_1
x 15
y 2
end
arch woodfloor
unique 1
x 15
y 3
end
arch wall_2_1_1
x 15
y 3
end
arch woodfloor
unique 1
x 15
y 4
end
arch wall_2_1_1
x 15
y 4
end
arch woodfloor
unique 1
x 15
y 5
end
arch wall_2_1_1
x 15
y 5
end
arch woodfloor
unique 1
x 15
y 6
end
arch wall_2_1_1
x 15
y 6
end
arch woodfloor
unique 1
x 15
y 7
end
arch wall_2_1_1
x 15
y 7
end
arch woodfloor
unique 1
x 15
y 8
end
arch wall_2_1_1
type 77
x 15
y 8
end
arch woodfloor
unique 1
x 15
y 9
end
arch wall_2_2_4
type 77
x 15
y 9
end
arch blocked
x 15
y 10
end
arch blocked
x 16
end
arch blocked
x 16
y 1
end
arch blocked
x 16
y 2
end
arch blocked
x 16
y 3
end
arch blocked
x 16
y 4
end
arch blocked
x 16
y 5
end
arch blocked
x 16
y 6
end
arch blocked
x 16
y 7
end
arch blocked
x 16
y 8
end
arch blocked
x 16
y 9
end
arch blocked
x 16
y 10
end
arch cobblestones
unique 1
x 17
end
arch teleporter
hp 14
sp 4
speed 0.000000
resist_magic 30
resist_electricity 30
resist_confusion 30
resist_ghosthit 30
connected 554
x 17
end
arch key2
name Key to Nuernberg
slaying SiegfriedKey201169
x 17
end
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build.patch.gz
Type: application/x-gzip-compressed
Size: 6761 bytes
Desc: not available
Url : 
     
     http://shadowknight.real-time.com/pipermail/crossfire/attachments/20031110/6fc56f41/build.patch.bin
     
     
-------------- next part --------------
_______________________________________________
crossfire-devel mailing list
     
     crossfire-devel at lists.real-time.com
     
     
     https://mailman.real-time.com/mailman/listinfo/crossfire-devel
     
     
    


More information about the crossfire mailing list