Raised This Month: $66 Target: $400
 16% 

BlockMaker Framework


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Fun Stuff        Approver:   Exolent[jNr] (178)
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 12-20-2009 , 01:16   BlockMaker Framework
Reply With Quote #1

BlockMaker FrameWork

Description:
First of all, this is not a single plugin.
This plugin is intended to help people build blocks without changing the original code.

* What is this?
It's a multi-plugin framework to allow developers build their own type of blocks for maps.

* Why you made this?
Because I see too many people asking for support to modify some other plugins for blocks and I think it's very annoying to modify.

* What's change with this plugin framework?
You can make your own block without any needs to modify the core plugin.

* I can do anything with my block?
Yes, you can do anything but I suggest try to limit to function calls available in this framework to avoid high cpu usage in your own block.

* Are you sure this is the best way to manage blocks cpu and resources?
No I don't, but I'm sure it's an approach.

* Can I ask you to make some blocks for me?
No. Read the api, it's very simple. Anything else is up to you.
Features:
  • Auto snap on blocks
  • Grab blocks
  • Save/Restore blocks from files
  • Menu arquitechture (plugin extension) (Pending)
  • Extensible... You can create your own blocks!!!
  • Support for non-standard blocks (wtf is it?). You can setup custom 3D sizes for blocks.

Cvars:
Currently there no cvars
Usage:
This plugin have some commands to let you put blocks in maps.

bm_save
Saves all blocks in current map to a file.

bm_load
Load previous saved blocks for the current map.

bm_cleanup
Remove all blocks from the current map.

bm_list
Lists all registered blocks in framework.

bm_add [blockname] [size]
Create a block where you're aiming.
Code:
blockname: the nickname of the block you can see with bm_list
size: d = default size, s = small, l = large

example:
for generic large blocks: bm_add default l
for autobhop standard blocks: bm_add autobhop d
bm_del
Deletes the block you're aiming.

bm_rotate
Rotates the block you're aiming.

+bm_grab
Use this bind to grab the blocks with aim.

API Documentation:
I'll be updating this information to make it clear to understand how to use the api

The framework is responsible to call block handlers (Spawn, Touch, Think, etc).
Currently there only 5 handlers working.
Those handlers where called from the original engine function (pfn_Touch, client_PreThink, etc)
  • This is intended to use to modify properties of blocks (ej: make breakable)
    PHP Code:
    block_Spawn(ent): Called only at block creation 
  • This function may be used to trigger actions when some player touches the block.
    PHP Code:
    block_Touch(touchedtoucher): Called from pfn_Touch with some cache cooldown control
  • You can use this function instead client_PreThink / FM_PlayerPreThink
    PHP Code:
    block_PlayerPreThink(id): Called from client_PreThinkYou have to setup this handler on a player to enable the call
  • You can use this function instead client_PostThink / FM_PlayerPostThink
    PHP Code:
    block_PlayerPostThink(id): Called from client_PostThinkYou have to setup this handler on a player to enable the call
  • This is where your block thinks.
    PHP Code:
    block_Think(ent): Called from the register_think function. This is called every think a block needs to think (EV_FL_nextthink). 
  • Pending.
    PHP Code:
    block_AddToFullPack(): Pending
  • Pending.
    PHP Code:
    block_UpdateClientData(): Pending
For the blocks plugins side, you have 2 natives

This is used to register the new block in the framework.
You can setup the name of the block, the base name for the model, the type of touch, cooldown time for touch and 3 different sizes (default, small, large). This native returns the ID of the registered block.
PHP Code:
native _reg_block(const name[], const ver[], const model[], const touch, const Float:cdown, const Float:size[], const Float:sizesmall[], const Float:sizelarge[]) 
touch takes one of the following options
PHP Code:
#define TOUCH_NONE      1<<0
#define TOUCH_ALL       1<<1
#define TOUCH_BOTH      1<<2
#define TOUCH_HEAD      1<<3
#define TOUCH_FOOT      1<<4
#define TOUCH_OTHER     1<<5 
The other native is _set_handler is used to setup which handlers could be called from framework plugin to block plugin.
PHP Code:
native _set_handler(const id, const blockid, const value, const Handlers:handler
Remember you can use this handlers
PHP Code:
enum Handlers {
      
hSpawn,                  // called automaticaly
      
hTouch,                  // called automaticaly with cooldown control
      
hThink,                  // called only when block/plugin enable this handler
      
hAddToFullPack,          // not yet finished
      
hPlayerPreThink,         // called only when block/plugin enable this handler
      
hPlayerPostThink,        // called only when block/plugin enable this handler
      
hUpdateClientData        // not yet finished

Changelog:
PHP Code:
0.1 initial release 
Credits:
- Necro - Models from BlockMaker 4.01. Some ideas and code from BlockMaker 4.01
- Frk_14 - for tests
- Asd' - for tests & Flash block plugin
Extra info:
  • I'm uploading .zip files because of includes needed.
  • This one is fully usable but maybe someone needs a handler that is not yet finished.
  • The plugins of blocks here are only examples. I'm sure most of them could be optimized.
  • I suggest to read the block/plugin examples to understand how it works.
  • All comments and recomendations are welcome.
  • I'm posting the full source code without any amxx. I suggest you to compile yourself the plugins.
  • You need to maintain models directory and filename format.
  • Remember to put the include file in your includes folder.
Attached Files
File Type: zip bmfw_base.zip (5.7 KB, 2524 views)
File Type: zip bmfw_blocks.zip (6.5 KB, 2618 views)
File Type: zip bmfw_models.zip (89.6 KB, 2636 views)
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.

Last edited by joropito; 12-20-2009 at 14:13.
joropito is offline
Send a message via MSN to joropito
Zombiezzz
Veteran Member
Join Date: Nov 2009
Location: Nov 2009
Old 12-20-2009 , 01:25   Re: BlockMaker Framework
Reply With Quote #2

wow ncie! +K
__________________
Zombiezzz is offline
Asd'
Senior Member
Join Date: Jun 2009
Location: Argentina
Old 12-20-2009 , 01:30   Re: BlockMaker Framework
Reply With Quote #3

Good job, and thanks for the credits.
__________________
Asd' is offline
Send a message via MSN to Asd'
Raddish
BANNED
Join Date: Jul 2008
Location: Argentina
Old 12-20-2009 , 02:37   Re: BlockMaker Framework
Reply With Quote #4

Nice job.
Raddish is offline
cikjam
Senior Member
Join Date: Feb 2009
Location: Australia
Old 12-20-2009 , 03:19   Re: BlockMaker Framework
Reply With Quote #5

Woudln't it be easier with a menu? Instead of always going to console or binding like 10 keys.

EDIT: Suggestion: Change +bm_grab to +bmgrab so people dont have to rebind keys.
__________________
R.I.P Aziz 'Zyzz' Sergeyevich Shavershian

Last edited by cikjam; 12-20-2009 at 03:36.
cikjam is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 12-20-2009 , 03:35   Re: BlockMaker Framework
Reply With Quote #6

Nice!!! i will test it later!
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 12-20-2009 , 05:45   Re: BlockMaker Framework
Reply With Quote #7

Damn I was working on the same thing. But as i see your API is not so finished, it doesnt have params, renderings, and such crap
__________________
xPaw is offline
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 12-20-2009 , 05:47   Re: BlockMaker Framework
Reply With Quote #8

Nice plugin, I also agree with cikjam's post

Quote:
Originally Posted by cikjam View Post
Woudln't it be easier with a menu? Instead of always going to console or binding like 10 keys.

EDIT: Suggestion: Change +bm_grab to +bmgrab so people dont have to rebind keys.
KadiR is offline
KiimpaN
Member
Join Date: Jun 2005
Location: Sweden
Old 12-20-2009 , 08:03   Re: BlockMaker Framework
Reply With Quote #9

Great idea, this plugin rocks! But as the other guys above me, I agree that a menu might be a good idea ;)
KiimpaN is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 12-20-2009 , 08:11   Re: BlockMaker Framework
Reply With Quote #10

Quote:
Originally Posted by xPaw View Post
Damn I was working on the same thing. But as i see your API is not so finished, it doesnt have params, renderings, and such crap
A little competition cant harm right?
__________________
I am out of order!
grimvh2 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:13.


Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode