Skip to content

Commit

Permalink
Nugget
Browse files Browse the repository at this point in the history
  • Loading branch information
terracraft321 committed Feb 19, 2018
1 parent cf2e4db commit 6c3d625
Show file tree
Hide file tree
Showing 45 changed files with 527 additions and 8 deletions.
1 change: 0 additions & 1 deletion Entities/Botany/Apothecary/Apothecary.as
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "Descriptions.as";
#include "WARCosts.as";
#include "CheckSpam.as";
#include "CTFShopCommon.as";



Expand Down
Binary file modified Entities/Botany/Apothecary/Apothecary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Entities/Industry/Building/Building.as
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void onInit(CBlob@ this)

// SHOP
this.set_Vec2f("shop offset", Vec2f(0, 0));
this.set_Vec2f("shop menu size", Vec2f(6, 7));
this.set_Vec2f("shop menu size", Vec2f(6, 5));
this.set_string("shop description", "Construct");
this.set_u8("shop icon", 12);
this.Tag(SHOP_AUTOCLOSE);
Expand Down
1 change: 0 additions & 1 deletion Entities/Industry/Well/Well.as
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "Descriptions.as";
#include "WARCosts.as";
#include "CheckSpam.as";
#include "CTFShopCommon.as";
#include "ProductionCommon.as";

const int splashes = 3;
Expand Down
35 changes: 35 additions & 0 deletions Entities/Items/Drugs/Beer/Beer.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
void onInit(CBlob@ this)
{
this.addCommandID("consume");
}

void GetButtonsFor(CBlob@ this, CBlob@ caller)
{
CBitStream params;
params.write_u16(caller.getNetworkID());
caller.CreateGenericButton(22, Vec2f(0, 0), this, this.getCommandID("consume"), "Drink!", params);
}

void onCommand(CBlob@ this, u8 cmd, CBitStream @params)
{
if (cmd == this.getCommandID("consume"))
{
this.getSprite().PlaySound("gasp.ogg");
this.getSprite().PlaySound("Gurgle2.ogg");

CBlob@ caller = getBlobByNetworkID(params.read_u16());
if (caller !is null)
{
if (!caller.exists("drunk") || caller.get_u16("drunk") == 0) caller.AddScript("Drunk.as");

caller.set_u16("drunk", Maths::Min(caller.get_u16("drunk") + 1, 250));
caller.set_u32("next sober", getGameTime());

if (getNet().isServer())
{
this.server_Die();
}

}
}
}
70 changes: 70 additions & 0 deletions Entities/Items/Drugs/Beer/Beer.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
$sprite_factory = generic_sprite
@$sprite_scripts =
$sprite_texture = Beer.png
s32_sprite_frame_width = 8
s32_sprite_frame_height = 8
f32 sprite_offset_x = 0
f32 sprite_offset_y = 0

$sprite_gibs_start = *start*

$gib_type = predefined
$gib_style = stone
u8_gib_count = 5
@u8_gib_frame = 4; 5; 6; 7;
f32 velocity = 10.0
f32 offset_x = 8.0
f32 offset_y = 0.0

$sprite_gibs_end = *end*

$sprite_animation_start = *start*

$sprite_animation_default_name = default
u16 sprite_animation_default_time = 0
u8_sprite_animation_default_loop = 0
@u16 sprite_animation_default_frames = 0;

$sprite_animation_end = *end*

$shape_factory = box2d_shape
@$shape_scripts =
f32 shape_mass = 5.0
f32 shape_radius = 4.0
f32 shape_friction = 0.75
f32 shape_elasticity = 0.2
f32 shape_buoyancy = 0.8
f32 shape_drag = 0.5
bool shape_collides = yes
bool shape_ladder = no
bool shape_platform = no
@f32 verticesXY =

u8 block_support = 0
bool block_background = no
bool block_lightpasses = no
bool block_snaptogrid = no

$movement_factory =

$brain_factory =

$attachment_factory = box2d_attachment
@$attachment_scripts =
@$attachment_points = PICKUP; 0; 0; 1; 0; 0;

$inventory_factory =

$name = beer
@$scripts = Beer.as;
Stone.as;
NoPlayerCollision.as;
f32 health = 1.0
$inventory_name = Bear's Beer
$inventory_icon = -
u8 inventory_icon_frame = 0
u8 inventory_icon_frame_width = 0
u8 inventory_icon_frame_height = 0
u8 inventory_used_width = 1
u8 inventory_used_height = 1
u8 inventory_max_stacks = 1
Binary file added Entities/Items/Drugs/Beer/Beer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions Entities/Items/Drugs/Beer/Drunk.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#include "Knocked.as";

void onInit(CBlob@ this)
{
this.addCommandID("consume");
}

void onTick(CBlob@ this)
{
if (this.hasTag("dead")) return;
u16 level = this.get_u16("drunk");

// print("tick" + getGameTime());

if (this.get_u32("next sober") < getGameTime() && XORRandom(1000) == 0)
{
this.set_u16("drunk", Maths::Max(this.get_u16("drunk") - 1, 0));
}

if (level > 0 && getKnocked(this) < 10 && XORRandom(4000 / (1 + level * 1.5f)) == 0)
{
u8 knock = 5 + XORRandom(20) * level;

SetKnocked(this, knock);
this.getSprite().PlaySound("drunk_fx" + XORRandom(5), 0.8f, this.getSexNum() == 0 ? 1.0f : 2.0f);
}

if (getNet().isClient())
{
if (this.isMyPlayer())
{
f32 rot;
rot += Maths::Sin(getGameTime() / 30.0f) * level * 1.8f;
rot += Maths::Cos(getGameTime() / 25.0f) * level * 1.3f;
rot += Maths::Sin(380 + getGameTime() / 40.0f) * level * 2.5f;

CCamera@ cam = getCamera();
cam.setRotation(rot);
}
}

if (level == 0)
{
print("sober");

this.getCurrentScript().runFlags |= Script::remove_after_this;

if (getNet().isClient() && this.isMyPlayer())
{
CCamera@ cam = getCamera();
cam.setRotation(0);
}
}
}

void onDie(CBlob@ this)
{
if (getNet().isClient() && this.isMyPlayer())
{
CCamera@ cam = getCamera();
cam.setRotation(0);
}

this.set_u16("drunk", 0);

// print("die");
}

f32 onHit(CBlob@ this, Vec2f worldPoint, Vec2f velocity, f32 damage, CBlob@ hitterBlob, u8 customData)
{
f32 modifier = Maths::Max(0.3f, Maths::Min(1, Maths::Pow(0.80f, this.get_u16("drunk"))));
// print("" + modifier);
return damage * modifier;
}
Binary file added Entities/Items/Drugs/Beer/drunk_fx0.ogg
Binary file not shown.
Binary file added Entities/Items/Drugs/Beer/drunk_fx1.ogg
Binary file not shown.
Binary file added Entities/Items/Drugs/Beer/drunk_fx2.ogg
Binary file not shown.
Binary file added Entities/Items/Drugs/Beer/drunk_fx3.ogg
Binary file not shown.
Binary file added Entities/Items/Drugs/Beer/drunk_fx4.ogg
Binary file not shown.
34 changes: 34 additions & 0 deletions Entities/Items/Drugs/Bobomax/Bobomax.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
void onInit(CBlob@ this)
{
this.addCommandID("consume");
}

void GetButtonsFor(CBlob@ this, CBlob@ caller)
{
CBitStream params;
params.write_u16(caller.getNetworkID());
caller.CreateGenericButton(22, Vec2f(0, 0), this, this.getCommandID("consume"), "Eat!", params);
}

void onCommand(CBlob@ this, u8 cmd, CBitStream @params)
{
if (cmd == this.getCommandID("consume"))
{
this.getSprite().PlaySound("Huuu.ogg", 1.0f, 1.5f);
this.getSprite().PlaySound("Gurgle2.ogg");

CBlob@ caller = getBlobByNetworkID(params.read_u16());
if (caller !is null)
{
if (!caller.exists("bobomaxed") || caller.get_u8("bobomaxed") == 0) caller.AddScript("Bobomaxed.as");

caller.set_u8("bobomaxed", Maths::Min(caller.get_u8("bobomaxed") + 1, 250));

if (getNet().isServer())
{
this.server_Die();
}

}
}
}
70 changes: 70 additions & 0 deletions Entities/Items/Drugs/Bobomax/Bobomax.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
$sprite_factory = generic_sprite
@$sprite_scripts =
$sprite_texture = Bobomax.png
s32_sprite_frame_width = 8
s32_sprite_frame_height = 8
f32 sprite_offset_x = 0
f32 sprite_offset_y = 0

$sprite_gibs_start = *start*

$gib_type = predefined
$gib_style = stone
u8_gib_count = 5
@u8_gib_frame = 4; 5; 6; 7;
f32 velocity = 10.0
f32 offset_x = 8.0
f32 offset_y = 0.0

$sprite_gibs_end = *end*

$sprite_animation_start = *start*

$sprite_animation_default_name = default
u16 sprite_animation_default_time = 0
u8_sprite_animation_default_loop = 0
@u16 sprite_animation_default_frames = 0;

$sprite_animation_end = *end*

$shape_factory = box2d_shape
@$shape_scripts =
f32 shape_mass = 5.0
f32 shape_radius = 4.0
f32 shape_friction = 0.75
f32 shape_elasticity = 0.2
f32 shape_buoyancy = 0.8
f32 shape_drag = 0.5
bool shape_collides = yes
bool shape_ladder = no
bool shape_platform = no
@f32 verticesXY =

u8 block_support = 0
bool block_background = no
bool block_lightpasses = no
bool block_snaptogrid = no

$movement_factory =

$brain_factory =

$attachment_factory = box2d_attachment
@$attachment_scripts =
@$attachment_points = PICKUP; 0; 0; 1; 0; 0;

$inventory_factory =

$name = bobomax
@$scripts = Bobomax.as;
Stone.as;
NoPlayerCollision.as;
f32 health = 1.0
$inventory_name = Bobomax
$inventory_icon = -
u8 inventory_icon_frame = 0
u8 inventory_icon_frame_width = 0
u8 inventory_icon_frame_height = 0
u8 inventory_used_width = 1
u8 inventory_used_height = 1
u8 inventory_max_stacks = 1
Binary file added Entities/Items/Drugs/Bobomax/Bobomax.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6c3d625

Please sign in to comment.