Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "VehicleCommon.as"
- class vehiblock
- {
- u16[][] tileids = { { 0 } }; //tileid in world.png
- u16[][] blobids = { { 0 } }; //netid
- u32[][] thisblock = { { 0 } }; //sprite layer id, recode this shit so we use vec2f coords into spritelayers
- u32 curblock;
- vehiblock()
- {
- }
- }
- void onInit(CBlob@ this)
- {
- vehiblock blockclass;
- this.set("blockclass", blockclass);
- for(int i = 0; i < 16; i += 1)
- {
- for(int j = 0; j < 16; j += 1)
- {
- addTile(this, Vec2f(i, j), getMap().getTile(Vec2f(i, j)).type);
- }
- }
- /*Vehicle_Setup( this,
- 95.0f, // move speed
- 0.19f, // turn speed
- Vec2f(0.0f, -5.0f), // jump out velocity
- true // inventory access
- );
- VehicleInfo@ v;
- if (!this.get( "VehicleInfo", @v )) {
- return;
- }*/
- this.setPosition(Vec2f(this.getPosition().x, this.getPosition().y - 128));
- }
- void addTile(CBlob@ this, Vec2f pos, u16 id)
- {
- vehiblock@ block;
- if (!this.get("blockclass", @block)) return;
- if (block.thisblock.size() < pos.x) { block.thisblock.resize(Maths::Ceil(pos.x)+1); block.tileids.resize(Maths::Ceil(pos.x)+1); block.blobids.resize(Maths::Ceil(pos.x)+1); } // serial eyekiller
- if (block.thisblock[pos.x].size() < pos.y) { block.thisblock[pos.x].resize(Maths::Ceil(pos.y)+1); block.tileids[pos.x].resize(Maths::Ceil(pos.y)+1); block.blobids[pos.x].resize(Maths::Ceil(pos.y)+1); }
- block.thisblock[pos.x][pos.y] = block.thisblock[pos.x][pos.y] + 1;
- block.tileids[pos.x][pos.y] = id;
- Vec2f[] vertex = { pos, Vec2f(pos.x+8, pos.y), Vec2f(pos.x+8, pos.y+8), Vec2f(pos.x, pos.y+8) };
- this.getShape().AddShape(vertex);
- CSpriteLayer@ tile = this.getSprite().addSpriteLayer("tile" + block.thisblock[pos.x][pos.y], "world.png", 8, 8); //if they implant non 8x8 rectangles we're fucked
- tile.SetVisible(true);
- tile.SetOffset(pos);
- tile.SetFrame(id);
- }
- void onTick( CBlob@ this )
- {
- /*if (this.hasAttached() || this.getTickSinceCreated() < 30) //driver, seat or gunner, or just created
- {
- VehicleInfo@ v;
- if (!this.get( "VehicleInfo", @v )) {
- return;
- }
- Vehicle_StandardControls( this, v );
- AttachmentPoint@[] aps;
- if (this.getAttachmentPoints( @aps ))
- {
- CSprite@ sprite = this.getSprite();
- uint flyerCount = 0;
- for (uint i = 0; i < aps.length; i++)
- {
- AttachmentPoint@ ap = aps[i];
- if (ap.name == "FLYER")
- {
- CBlob@ blob = ap.getOccupied();
- CSpriteLayer@ propeller = sprite.getSpriteLayer( flyerCount );
- }
- }
- }
- }*/
- }
- void Vehicle_onFire( CBlob@ this, VehicleInfo@ v, CBlob@ bullet, const u8 charge ) {}
- bool Vehicle_canFire( CBlob@ this, VehicleInfo@ v, bool isActionPressed, bool wasActionPressed, u8 &out chargeValue ) {return false;}
- bool doesCollideWithBlob( CBlob@ this, CBlob@ blob )
- {
- return Vehicle_doesCollideWithBlob_boat( this, blob );
- }
- bool canBePickedUp( CBlob@ this, CBlob@ byBlob )
- {
- return false;
- }
- // SPRITE
- void onInit( CSprite@ this )
- {
- }
- void onTick( CSprite@ this )
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement